larness 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (226) hide show
  1. package/README.md +16 -181
  2. package/app.js +22 -31
  3. package/apps/server/dist/{address-UO6lb2Hx.js → address-BE25lU9-.js} +4 -5
  4. package/apps/server/dist/{client-DGXcZxzL.js → client-Co1thYbK.js} +2 -3
  5. package/apps/server/dist/{doctor-CTealIcx.js → doctor-ClvbJZvj.js} +5 -9
  6. package/apps/server/dist/doctor.js +2 -3
  7. package/apps/server/dist/index.js +4908 -3040
  8. package/apps/server/dist/{lock-8kmtcopF.js → lock-DyEoZgG_.js} +1 -2
  9. package/apps/server/dist/managed-CLFUiDbj.js +2138 -0
  10. package/apps/server/dist/{paths-Bp1nTSw3.js → paths-BHryFHwq.js} +91 -188
  11. package/apps/server/dist/{status-Dyecl2ni.js → status-idXF0pm6.js} +3 -4
  12. package/apps/server/dist/status.js +4 -5
  13. package/apps/server/dist/tui.js +53 -55
  14. package/apps/server/drizzle/0023_turn_terminal_reason.sql +1 -0
  15. package/apps/server/drizzle/0024_turn_checkpoints.sql +4 -0
  16. package/apps/server/drizzle/0025_turn_resume.sql +1 -0
  17. package/apps/server/drizzle/0026_session_pin.sql +1 -0
  18. package/apps/server/drizzle/0027_project_sort_order.sql +2 -0
  19. package/apps/server/drizzle/meta/0023_snapshot.json +4967 -0
  20. package/apps/server/drizzle/meta/0024_snapshot.json +4994 -0
  21. package/apps/server/drizzle/meta/0025_snapshot.json +5001 -0
  22. package/apps/server/drizzle/meta/0026_snapshot.json +5008 -0
  23. package/apps/server/drizzle/meta/0027_snapshot.json +5021 -0
  24. package/apps/server/drizzle/meta/_journal.json +35 -0
  25. package/apps/server/package.json +12 -12
  26. package/apps/web/dist/assets/FileEditor-twkRcPR8.js +1 -0
  27. package/apps/web/dist/assets/FileViewer-B6J1gfWW.js +1 -0
  28. package/apps/web/dist/assets/abap-08VXUWAP.js +1 -0
  29. package/apps/web/dist/assets/apex-BWPQTe0t.js +1 -0
  30. package/apps/web/dist/assets/azcli-Bc_sGQ0U.js +1 -0
  31. package/apps/web/dist/assets/bat-i0X4ZdIN.js +1 -0
  32. package/apps/web/dist/assets/bicep-B5-_aFwp.js +2 -0
  33. package/apps/web/dist/assets/cameligo-DMUM7wLl.js +1 -0
  34. package/apps/web/dist/assets/clojure-Cm7r79vr.js +1 -0
  35. package/apps/web/dist/assets/coffee-Ba7i2nA0.js +1 -0
  36. package/apps/web/dist/assets/cpp-C7h46wYY.js +1 -0
  37. package/apps/web/dist/assets/csharp-BKxtCVv1.js +1 -0
  38. package/apps/web/dist/assets/csp-bTuwJoIa.js +1 -0
  39. package/apps/web/dist/assets/css-DIMkf-bt.js +3 -0
  40. package/apps/web/dist/assets/css.worker-C5TGqYcS.js +96 -0
  41. package/apps/web/dist/assets/cssMode-B2gCrV51.js +1 -0
  42. package/apps/web/dist/assets/cypher-CVaqCwHa.js +1 -0
  43. package/apps/web/dist/assets/dart-onAF5SnQ.js +1 -0
  44. package/apps/web/dist/assets/dockerfile-DZFCIeNp.js +1 -0
  45. package/apps/web/dist/assets/ecl-94qehhXe.js +1 -0
  46. package/apps/web/dist/assets/editor-B8GMDV7_.css +1 -0
  47. package/apps/web/dist/assets/editor.api-TQGsXQVT.js +908 -0
  48. package/apps/web/dist/assets/editor.worker-uJzjfcWc.js +33 -0
  49. package/apps/web/dist/assets/elixir-6RTg0lbw.js +1 -0
  50. package/apps/web/dist/assets/flow9-C5_-GSwl.js +1 -0
  51. package/apps/web/dist/assets/freemarker2-Due01FLd.js +3 -0
  52. package/apps/web/dist/assets/fsharp-C8Ef5oNN.js +1 -0
  53. package/apps/web/dist/assets/go-C-y9NEjX.js +1 -0
  54. package/apps/web/dist/assets/graphql-fmXr3nnJ.js +1 -0
  55. package/apps/web/dist/assets/handlebars-Cbmho-0R.js +1 -0
  56. package/apps/web/dist/assets/hcl-CpzslTdj.js +1 -0
  57. package/apps/web/dist/assets/html-1Ke8CI8o.js +1 -0
  58. package/apps/web/dist/assets/html.worker-DthhmbAk.js +509 -0
  59. package/apps/web/dist/assets/htmlMode-KxcipU--.js +1 -0
  60. package/apps/web/dist/assets/index-BvfzAW2A.js +158 -0
  61. package/apps/web/dist/assets/index-DxcI8GSl.css +1 -0
  62. package/apps/web/dist/assets/ini-sBoK_t0W.js +1 -0
  63. package/apps/web/dist/assets/java-BEtHBSE6.js +1 -0
  64. package/apps/web/dist/assets/javascript-DMPkDcJu.js +1 -0
  65. package/apps/web/dist/assets/json.worker-BGaEIa3n.js +65 -0
  66. package/apps/web/dist/assets/jsonMode-CLqudskm.js +7 -0
  67. package/apps/web/dist/assets/julia-Bri6UV-V.js +1 -0
  68. package/apps/web/dist/assets/kotlin-BOotOW0E.js +1 -0
  69. package/apps/web/dist/assets/less-B9JPFI3C.js +2 -0
  70. package/apps/web/dist/assets/lexon-CfSJPG6W.js +1 -0
  71. package/apps/web/dist/assets/liquid-bIUiAHG1.js +1 -0
  72. package/apps/web/dist/assets/lspLanguageFeatures-CplKbdW4.js +4 -0
  73. package/apps/web/dist/assets/lua-CsQS60Ue.js +1 -0
  74. package/apps/web/dist/assets/m3-D-oSqn_W.js +1 -0
  75. package/apps/web/dist/assets/markdown-Cimd5fb3.js +1 -0
  76. package/apps/web/dist/assets/mdx-DiInMCu3.js +1 -0
  77. package/apps/web/dist/assets/mips-CIPQ_RoX.js +1 -0
  78. package/apps/web/dist/assets/monaco-D_A7VB90.js +68 -0
  79. package/apps/web/dist/assets/monaco-n7clI0si.css +1 -0
  80. package/apps/web/dist/assets/msdax-DauUninz.js +1 -0
  81. package/apps/web/dist/assets/mysql-SOo6toE5.js +1 -0
  82. package/apps/web/dist/assets/objective-c-FvmIjYaQ.js +1 -0
  83. package/apps/web/dist/assets/pascal-DrH0SRf2.js +1 -0
  84. package/apps/web/dist/assets/pascaligo-D-ptJ9y-.js +1 -0
  85. package/apps/web/dist/assets/perl-oz_6vUea.js +1 -0
  86. package/apps/web/dist/assets/pgsql-DTj74zXo.js +1 -0
  87. package/apps/web/dist/assets/php-nr791fC2.js +1 -0
  88. package/apps/web/dist/assets/pla-CopQ2nXW.js +1 -0
  89. package/apps/web/dist/assets/postiats-43DmfD33.js +1 -0
  90. package/apps/web/dist/assets/powerquery-D3hlyOfw.js +1 -0
  91. package/apps/web/dist/assets/powershell-DmHpPYUd.js +1 -0
  92. package/apps/web/dist/assets/protobuf-C531GsRP.js +2 -0
  93. package/apps/web/dist/assets/pug-Z5eAx3Zn.js +1 -0
  94. package/apps/web/dist/assets/python-O93J5sRJ.js +1 -0
  95. package/apps/web/dist/assets/qsharp-DkqhCAOL.js +1 -0
  96. package/apps/web/dist/assets/r-BwWrilGY.js +1 -0
  97. package/apps/web/dist/assets/razor-DpA8sAYd.js +1 -0
  98. package/apps/web/dist/assets/redis-ClamHrr6.js +1 -0
  99. package/apps/web/dist/assets/redshift-DT7zqm-g.js +1 -0
  100. package/apps/web/dist/assets/restructuredtext-BYgofb2h.js +1 -0
  101. package/apps/web/dist/assets/ruby-DezsRK8O.js +1 -0
  102. package/apps/web/dist/assets/rust-DdL9SqIa.js +1 -0
  103. package/apps/web/dist/assets/sb-CcwsVR0C.js +1 -0
  104. package/apps/web/dist/assets/scala-DHpiXF5c.js +1 -0
  105. package/apps/web/dist/assets/scheme-BeGwcela.js +1 -0
  106. package/apps/web/dist/assets/scss-gp-XZpBa.js +3 -0
  107. package/apps/web/dist/assets/shell-CC2rA5mh.js +1 -0
  108. package/apps/web/dist/assets/solidity-BEEn4gHE.js +1 -0
  109. package/apps/web/dist/assets/sophia-CRfGWb83.js +1 -0
  110. package/apps/web/dist/assets/sparql-D_Lu-MrJ.js +1 -0
  111. package/apps/web/dist/assets/sql-NEE52Syq.js +1 -0
  112. package/apps/web/dist/assets/st-DbInun42.js +1 -0
  113. package/apps/web/dist/assets/swift-Bxkupp3x.js +1 -0
  114. package/apps/web/dist/assets/systemverilog-Bz4Y3fRF.js +1 -0
  115. package/apps/web/dist/assets/tcl-DISqw1ZD.js +1 -0
  116. package/apps/web/dist/assets/{ts.worker-BrLZGe_E.js → ts.worker-CUR_zL4j.js} +260 -241
  117. package/apps/web/dist/assets/tsMode-qBmFN2NS.js +11 -0
  118. package/apps/web/dist/assets/twig-De2hgUGE.js +1 -0
  119. package/apps/web/dist/assets/typescript-BjR2yH8S.js +1 -0
  120. package/apps/web/dist/assets/typespec-B8J7ngcE.js +1 -0
  121. package/apps/web/dist/assets/vb-DV3o63ZY.js +1 -0
  122. package/apps/web/dist/assets/{wgsl-BTesnYfV.js → wgsl-DpFanUEy.js} +9 -9
  123. package/apps/web/dist/assets/workers-x9_8y1ur.js +1 -0
  124. package/apps/web/dist/assets/xml-CL70_TAY.js +1 -0
  125. package/apps/web/dist/assets/yaml-qno5z39m.js +1 -0
  126. package/apps/web/dist/index.html +2 -2
  127. package/docs/README.md +4 -4
  128. package/docs/guides/install.md +31 -6
  129. package/package.json +18 -17
  130. package/apps/server/dist/managed-CHal_mk1.js +0 -216
  131. package/apps/web/dist/assets/FileEditor-DpVfk7t3.js +0 -1
  132. package/apps/web/dist/assets/FileViewer-Bv5VYaA3.js +0 -1
  133. package/apps/web/dist/assets/abap-DLDM7-KI.js +0 -1
  134. package/apps/web/dist/assets/apex-DNDY2TF8.js +0 -1
  135. package/apps/web/dist/assets/azcli-Y6nb8tq_.js +0 -1
  136. package/apps/web/dist/assets/bat-BwHxbl9M.js +0 -1
  137. package/apps/web/dist/assets/bicep-CFznDFnq.js +0 -2
  138. package/apps/web/dist/assets/cameligo-Bf6VGUru.js +0 -1
  139. package/apps/web/dist/assets/clojure-Dnu-v4kV.js +0 -1
  140. package/apps/web/dist/assets/coffee-Bd8akH9Z.js +0 -1
  141. package/apps/web/dist/assets/cpp-BbWJElDN.js +0 -1
  142. package/apps/web/dist/assets/csharp-Co3qMtFm.js +0 -1
  143. package/apps/web/dist/assets/csp-D-4FJmMZ.js +0 -1
  144. package/apps/web/dist/assets/css-DdJfP1eB.js +0 -3
  145. package/apps/web/dist/assets/css.worker-C_6RgliQ.js +0 -97
  146. package/apps/web/dist/assets/cssMode-EHCHSzzL.js +0 -1
  147. package/apps/web/dist/assets/cypher-cTPe9QuQ.js +0 -1
  148. package/apps/web/dist/assets/dart-BOtBlQCF.js +0 -1
  149. package/apps/web/dist/assets/dockerfile-BG73LgW2.js +0 -1
  150. package/apps/web/dist/assets/ecl-BEgZUVRK.js +0 -1
  151. package/apps/web/dist/assets/editor.worker-D1TDBLlL.js +0 -30
  152. package/apps/web/dist/assets/elixir-BkW5O-1t.js +0 -1
  153. package/apps/web/dist/assets/flow9-BeJ5waoc.js +0 -1
  154. package/apps/web/dist/assets/freemarker2-CYDUi4bR.js +0 -3
  155. package/apps/web/dist/assets/fsharp-PahG7c26.js +0 -1
  156. package/apps/web/dist/assets/go-acbASCJo.js +0 -1
  157. package/apps/web/dist/assets/graphql-BxJiqAUM.js +0 -1
  158. package/apps/web/dist/assets/handlebars-Bl5r-XBz.js +0 -1
  159. package/apps/web/dist/assets/hcl-DtV1sZF8.js +0 -1
  160. package/apps/web/dist/assets/html-Dimr8AuT.js +0 -1
  161. package/apps/web/dist/assets/html.worker-CLyYFd_g.js +0 -474
  162. package/apps/web/dist/assets/htmlMode-DbKEQN5e.js +0 -1
  163. package/apps/web/dist/assets/index-CiO_U1kt.js +0 -158
  164. package/apps/web/dist/assets/index-Cn8Mc6ux.css +0 -1
  165. package/apps/web/dist/assets/ini-Kd9XrMLS.js +0 -1
  166. package/apps/web/dist/assets/java-CXBNlu9o.js +0 -1
  167. package/apps/web/dist/assets/javascript-CAsmnqI3.js +0 -1
  168. package/apps/web/dist/assets/json.worker-BggoxaER.js +0 -62
  169. package/apps/web/dist/assets/jsonMode-FAO7KTW2.js +0 -7
  170. package/apps/web/dist/assets/julia-cl7-CwDS.js +0 -1
  171. package/apps/web/dist/assets/kotlin-s7OhZKlX.js +0 -1
  172. package/apps/web/dist/assets/less-9HpZscsL.js +0 -2
  173. package/apps/web/dist/assets/lexon-OrD6JF1K.js +0 -1
  174. package/apps/web/dist/assets/liquid-5H_43_EZ.js +0 -1
  175. package/apps/web/dist/assets/lspLanguageFeatures-DnuYc3pX.js +0 -4
  176. package/apps/web/dist/assets/lua-Cyyb5UIc.js +0 -1
  177. package/apps/web/dist/assets/m3-B8OfTtLu.js +0 -1
  178. package/apps/web/dist/assets/markdown-BFxVWTOG.js +0 -1
  179. package/apps/web/dist/assets/mdx-DJvtDn95.js +0 -1
  180. package/apps/web/dist/assets/mips-CiqrrVzr.js +0 -1
  181. package/apps/web/dist/assets/monaco-BEZSi3GX.js +0 -1005
  182. package/apps/web/dist/assets/monaco-Ced-qlZg.css +0 -1
  183. package/apps/web/dist/assets/msdax-DmeGPVcC.js +0 -1
  184. package/apps/web/dist/assets/mysql-C_tMU-Nz.js +0 -1
  185. package/apps/web/dist/assets/objective-c-BDtDVThU.js +0 -1
  186. package/apps/web/dist/assets/pascal-vHIfCaH5.js +0 -1
  187. package/apps/web/dist/assets/pascaligo-DtZ0uQbO.js +0 -1
  188. package/apps/web/dist/assets/perl-Ub6l9XKa.js +0 -1
  189. package/apps/web/dist/assets/pgsql-BlNEE0v7.js +0 -1
  190. package/apps/web/dist/assets/php-BBUBE1dy.js +0 -1
  191. package/apps/web/dist/assets/pla-DSh2-awV.js +0 -1
  192. package/apps/web/dist/assets/postiats-CocnycG-.js +0 -1
  193. package/apps/web/dist/assets/powerquery-tScXyioY.js +0 -1
  194. package/apps/web/dist/assets/powershell-COWaemsV.js +0 -1
  195. package/apps/web/dist/assets/protobuf-Brw8urJB.js +0 -2
  196. package/apps/web/dist/assets/pug-8SOpv6rk.js +0 -1
  197. package/apps/web/dist/assets/python-D4581wh8.js +0 -1
  198. package/apps/web/dist/assets/qsharp-Bw9ernYp.js +0 -1
  199. package/apps/web/dist/assets/r-j7ic8hl3.js +0 -1
  200. package/apps/web/dist/assets/razor-Cob92s3y.js +0 -1
  201. package/apps/web/dist/assets/redis-Bu5POkcn.js +0 -1
  202. package/apps/web/dist/assets/redshift-Bs9aos_-.js +0 -1
  203. package/apps/web/dist/assets/restructuredtext-CqXO7rUv.js +0 -1
  204. package/apps/web/dist/assets/ruby-zBfavPgS.js +0 -1
  205. package/apps/web/dist/assets/rust-BzKRNQWT.js +0 -1
  206. package/apps/web/dist/assets/sb-BBc9UKZt.js +0 -1
  207. package/apps/web/dist/assets/scala-D9hQfWCl.js +0 -1
  208. package/apps/web/dist/assets/scheme-BPhDTwHR.js +0 -1
  209. package/apps/web/dist/assets/scss-CBJaRo0y.js +0 -3
  210. package/apps/web/dist/assets/shell-DiJ1NA_G.js +0 -1
  211. package/apps/web/dist/assets/solidity-Db0IVjzk.js +0 -1
  212. package/apps/web/dist/assets/sophia-CnS9iZB_.js +0 -1
  213. package/apps/web/dist/assets/sparql-CJmd_6j2.js +0 -1
  214. package/apps/web/dist/assets/sql-ClhHkBeG.js +0 -1
  215. package/apps/web/dist/assets/st-CHwy0fLd.js +0 -1
  216. package/apps/web/dist/assets/swift-CnmFD0ga.js +0 -1
  217. package/apps/web/dist/assets/systemverilog-Bs9z6M-B.js +0 -1
  218. package/apps/web/dist/assets/tcl-Dm6ycUr_.js +0 -1
  219. package/apps/web/dist/assets/tsMode-WJsr57wC.js +0 -11
  220. package/apps/web/dist/assets/twig-Csy3S7wG.js +0 -1
  221. package/apps/web/dist/assets/typescript-8M7GiCNW.js +0 -1
  222. package/apps/web/dist/assets/typespec-Btyra-wh.js +0 -1
  223. package/apps/web/dist/assets/vb-Db0cS2oM.js +0 -1
  224. package/apps/web/dist/assets/workers-FOC7l7Wh.js +0 -1
  225. package/apps/web/dist/assets/xml-Hm5ZZqOZ.js +0 -1
  226. package/apps/web/dist/assets/yaml-E7sEyvM5.js +0 -1
@@ -1,158 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FileViewer-Bv5VYaA3.js","assets/monaco-BEZSi3GX.js","assets/monaco-Ced-qlZg.css","assets/FileEditor-DpVfk7t3.js"])))=>i.map(i=>d[i]);
2
- var WE=e=>{throw TypeError(e)};var KE=(e,t,n)=>t.has(e)||WE("Cannot "+n);var Jn=(e,t,n)=>(KE(e,t,"read from private field"),n?n.call(e):t.get(e)),VE=(e,t,n)=>t.has(e)?WE("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Ly=(e,t,n,i)=>(KE(e,t,"write to private field"),i?i.call(e,n):t.set(e,n),n);function QL(e,t){for(var n=0;n<t.length;n++){const i=t[n];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(i,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();try{const e=localStorage.getItem("larness.theme");(e==="dark"||e==="system"&&window.matchMedia("(prefers-color-scheme: dark)").matches)&&(document.documentElement.dataset.theme="dark")}catch{}function bm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var By={exports:{}},ed={};var GE;function JL(){if(GE)return ed;GE=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(i,s,a){var l=null;if(a!==void 0&&(l=""+a),s.key!==void 0&&(l=""+s.key),"key"in s){a={};for(var u in s)u!=="key"&&(a[u]=s[u])}else a=s;return s=a.ref,{$$typeof:e,type:i,key:l,ref:s!==void 0?s:null,props:a}}return ed.Fragment=t,ed.jsx=n,ed.jsxs=n,ed}var ZE;function e6(){return ZE||(ZE=1,By.exports=JL()),By.exports}var p=e6();function CD(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=CD(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function kD(){for(var e,t,n=0,i="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=CD(e))&&(i&&(i+=" "),i+=t);return i}const t6=(e,t)=>{const n=new Array(e.length+t.length);for(let i=0;i<e.length;i++)n[i]=e[i];for(let i=0;i<t.length;i++)n[e.length+i]=t[i];return n},n6=(e,t)=>({classGroupId:e,validator:t}),ED=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Hp="-",YE=[],i6="arbitrary..",r6=e=>{const t=o6(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return s6(l);const u=l.split(Hp),f=u[0]===""&&u.length>1?1:0;return ND(u,f,t)},getConflictingClassGroupIds:(l,u)=>{if(u){const f=i[l],h=n[l];return f?h?t6(h,f):f:h||YE}return n[l]||YE}}},ND=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;const s=e[t],a=n.nextPart.get(s);if(a){const h=ND(e,t+1,a);if(h)return h}const l=n.validators;if(l===null)return;const u=t===0?e.join(Hp):e.slice(t).join(Hp),f=l.length;for(let h=0;h<f;h++){const g=l[h];if(g.validator(u))return g.classGroupId}},s6=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),n=t.indexOf(":"),i=t.slice(0,n);return i?i6+i:void 0})(),o6=e=>{const{theme:t,classGroups:n}=e;return a6(n,t)},a6=(e,t)=>{const n=ED();for(const i in e){const s=e[i];s0(s,n,i,t)}return n},s0=(e,t,n,i)=>{const s=e.length;for(let a=0;a<s;a++){const l=e[a];l6(l,t,n,i)}},l6=(e,t,n,i)=>{if(typeof e=="string"){c6(e,t,n);return}if(typeof e=="function"){u6(e,t,n,i);return}d6(e,t,n,i)},c6=(e,t,n)=>{const i=e===""?t:RD(t,e);i.classGroupId=n},u6=(e,t,n,i)=>{if(h6(e)){s0(e(i),t,n,i);return}t.validators===null&&(t.validators=[]),t.validators.push(n6(n,e))},d6=(e,t,n,i)=>{const s=Object.entries(e),a=s.length;for(let l=0;l<a;l++){const[u,f]=s[l];s0(f,RD(t,u),n,i)}},RD=(e,t)=>{let n=e;const i=t.split(Hp),s=i.length;for(let a=0;a<s;a++){const l=i[a];let u=n.nextPart.get(l);u||(u=ED(),n.nextPart.set(l,u)),n=u}return n},h6=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,f6=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=Object.create(null),i=Object.create(null);const s=(a,l)=>{n[a]=l,t++,t>e&&(t=0,i=n,n=Object.create(null))};return{get(a){let l=n[a];if(l!==void 0)return l;if((l=i[a])!==void 0)return s(a,l),l},set(a,l){a in n?n[a]=l:s(a,l)}}},db="!",XE=":",p6=[],QE=(e,t,n,i,s)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:i,isExternal:s}),m6=e=>{const{prefix:t,experimentalParseClassName:n}=e;let i=s=>{const a=[];let l=0,u=0,f=0,h;const g=s.length;for(let S=0;S<g;S++){const C=s[S];if(l===0&&u===0){if(C===XE){a.push(s.slice(f,S)),f=S+1;continue}if(C==="/"){h=S;continue}}C==="["?l++:C==="]"?l--:C==="("?u++:C===")"&&u--}const m=a.length===0?s:s.slice(f);let _=m,b=!1;m.endsWith(db)?(_=m.slice(0,-1),b=!0):m.startsWith(db)&&(_=m.slice(1),b=!0);const x=h&&h>f?h-f:void 0;return QE(a,b,_,x)};if(t){const s=t+XE,a=i;i=l=>l.startsWith(s)?a(l.slice(s.length)):QE(p6,!1,l,void 0,!0)}if(n){const s=i;i=a=>n({className:a,parseClassName:s})}return i},g6=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((n,i)=>{t.set(n,1e6+i)}),n=>{const i=[];let s=[];for(let a=0;a<n.length;a++){const l=n[a],u=l[0]==="[",f=t.has(l);u||f?(s.length>0&&(s.sort(),i.push(...s),s=[]),i.push(l)):s.push(l)}return s.length>0&&(s.sort(),i.push(...s)),i}},v6=e=>({cache:f6(e.cacheSize),parseClassName:m6(e),sortModifiers:g6(e),postfixLookupClassGroupIds:y6(e),...r6(e)}),y6=e=>{const t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let i=0;i<n.length;i++)t[n[i]]=!0;return t},_6=/\s+/,b6=(e,t)=>{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:s,sortModifiers:a,postfixLookupClassGroupIds:l}=t,u=[],f=e.trim().split(_6);let h="";for(let g=f.length-1;g>=0;g-=1){const m=f[g],{isExternal:_,modifiers:b,hasImportantModifier:x,baseClassName:S,maybePostfixModifierPosition:C}=n(m);if(_){h=m+(h.length>0?" "+h:h);continue}let k=!!C,R;if(k){const D=S.substring(0,C);R=i(D);const L=R&&l[R]?i(S):void 0;L&&L!==R&&(R=L,k=!1)}else R=i(S);if(!R){if(!k){h=m+(h.length>0?" "+h:h);continue}if(R=i(S),!R){h=m+(h.length>0?" "+h:h);continue}k=!1}const N=b.length===0?"":b.length===1?b[0]:a(b).join(":"),A=x?N+db:N,I=A+R;if(u.indexOf(I)>-1)continue;u.push(I);const T=s(R,k);for(let D=0;D<T.length;++D){const L=T[D];u.push(A+L)}h=m+(h.length>0?" "+h:h)}return h},x6=(...e)=>{let t=0,n,i,s="";for(;t<e.length;)(n=e[t++])&&(i=TD(n))&&(s&&(s+=" "),s+=i);return s},TD=e=>{if(typeof e=="string")return e;let t,n="";for(let i=0;i<e.length;i++)e[i]&&(t=TD(e[i]))&&(n&&(n+=" "),n+=t);return n},S6=(e,...t)=>{let n,i,s,a;const l=f=>{const h=t.reduce((g,m)=>m(g),e());return n=v6(h),i=n.cache.get,s=n.cache.set,a=u,u(f)},u=f=>{const h=i(f);if(h)return h;const g=b6(f,n);return s(f,g),g};return a=l,(...f)=>a(x6(...f))},w6=[],Nn=e=>{const t=n=>n[e]||w6;return t.isThemeGetter=!0,t.themeKey=e,t},DD=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,AD=/^\((?:(\w[\w-]*):)?(.+)\)$/i,C6=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,k6=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,E6=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,N6=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix|color|light-dark)\(.+\)$/,R6=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,T6=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qo=e=>C6.test(e),rt=e=>!!e&&!Number.isNaN(Number(e)),ss=e=>!!e&&Number.isInteger(Number(e)),Fy=e=>e.endsWith("%")&&rt(e.slice(0,-1)),Gs=e=>k6.test(e),OD=()=>!0,D6=e=>E6.test(e)&&!N6.test(e),o0=()=>!1,A6=e=>R6.test(e),O6=e=>T6.test(e),j6=e=>!Te(e)&&!De(e),z6=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),M6=e=>da(e,MD,o0),Te=e=>DD.test(e),$a=e=>da(e,ID,D6),JE=e=>da(e,$6,rt),I6=e=>da(e,LD,OD),P6=e=>da(e,PD,o0),e2=e=>da(e,jD,o0),L6=e=>da(e,zD,O6),Pf=e=>da(e,BD,A6),De=e=>AD.test(e),td=e=>gl(e,ID),B6=e=>gl(e,PD),t2=e=>gl(e,jD),F6=e=>gl(e,MD),U6=e=>gl(e,zD),Lf=e=>gl(e,BD,!0),H6=e=>gl(e,LD,!0),da=(e,t,n)=>{const i=DD.exec(e);return i?i[1]?t(i[1]):n(i[2]):!1},gl=(e,t,n=!1)=>{const i=AD.exec(e);return i?i[1]?t(i[1]):n:!1},jD=e=>e==="position"||e==="percentage",zD=e=>e==="image"||e==="url",MD=e=>e==="length"||e==="size"||e==="bg-size",ID=e=>e==="length",$6=e=>e==="number",PD=e=>e==="family-name",LD=e=>e==="number"||e==="weight",BD=e=>e==="shadow",q6=()=>{const e=Nn("color"),t=Nn("font"),n=Nn("text"),i=Nn("font-weight"),s=Nn("tracking"),a=Nn("leading"),l=Nn("breakpoint"),u=Nn("container"),f=Nn("spacing"),h=Nn("radius"),g=Nn("shadow"),m=Nn("inset-shadow"),_=Nn("text-shadow"),b=Nn("drop-shadow"),x=Nn("blur"),S=Nn("perspective"),C=Nn("aspect"),k=Nn("ease"),R=Nn("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],I=()=>[...A(),De,Te],T=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],L=()=>[De,Te,f],ee=()=>[qo,"full","auto",...L()],U=()=>[ss,"none","subgrid",De,Te],F=()=>["auto",{span:["full",ss,De,Te]},ss,De,Te],B=()=>[ss,"auto",De,Te],W=()=>["auto","min","max","fr",De,Te],te=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],G=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...L()],Z=()=>[qo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...L()],$=()=>[u,qo,"screen","full","dvw","lvw","svw","min","max","fit",...L()],ae=()=>[qo,"screen","full","lh","dvh","lvh","svh","min","max","fit",...L()],j=()=>[e,De,Te],_e=()=>[...A(),t2,e2,{position:[De,Te]}],Le=()=>["no-repeat",{repeat:["","x","y","space","round"]}],z=()=>["auto","cover","contain",F6,M6,{size:[De,Te]}],M=()=>[Fy,td,$a],K=()=>["","none","full",h,De,Te],ne=()=>["",rt,td,$a],me=()=>["solid","dashed","dotted","double"],Ee=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ve=()=>[rt,Fy,t2,e2],Re=()=>["","none",x,De,Te],re=()=>["none",rt,De,Te],he=()=>["none",rt,De,Te],J=()=>[rt,De,Te],Ie=()=>[qo,"full",...L()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Gs],breakpoint:[Gs],color:[OD],container:[Gs],"drop-shadow":[Gs],ease:["in","out","in-out"],font:[j6],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Gs],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Gs],shadow:[Gs],spacing:["px",rt],text:[Gs],"text-shadow":[Gs],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",qo,Te,De,C]}],container:["container"],"container-type":[{"@container":["","normal","size",De,Te]}],"container-named":[z6],columns:[{columns:[rt,"auto",Te,De,u]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:I()}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ee()}],"inset-x":[{"inset-x":ee()}],"inset-y":[{"inset-y":ee()}],start:[{"inset-s":ee(),start:ee()}],end:[{"inset-e":ee(),end:ee()}],"inset-bs":[{"inset-bs":ee()}],"inset-be":[{"inset-be":ee()}],top:[{top:ee()}],right:[{right:ee()}],bottom:[{bottom:ee()}],left:[{left:ee()}],visibility:["visible","invisible","collapse"],z:[{z:[ss,"auto",De,Te]}],basis:[{basis:[qo,"full","auto",u,...L()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[rt,qo,"auto","initial","none",Te]}],grow:[{grow:["",rt,De,Te]}],shrink:[{shrink:["",rt,De,Te]}],order:[{order:[ss,"first","last","none",De,Te]}],"grid-cols":[{"grid-cols":U()}],"col-start-end":[{col:F()}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":U()}],"row-start-end":[{row:F()}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:L()}],"gap-x":[{"gap-x":L()}],"gap-y":[{"gap-y":L()}],"justify-content":[{justify:[...te(),"normal"]}],"justify-items":[{"justify-items":[...G(),"normal"]}],"justify-self":[{"justify-self":["auto",...G()]}],"align-content":[{content:["normal",...te()]}],"align-items":[{items:[...G(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...G(),{baseline:["","last"]}]}],"place-content":[{"place-content":te()}],"place-items":[{"place-items":[...G(),"baseline"]}],"place-self":[{"place-self":["auto",...G()]}],p:[{p:L()}],px:[{px:L()}],py:[{py:L()}],ps:[{ps:L()}],pe:[{pe:L()}],pbs:[{pbs:L()}],pbe:[{pbe:L()}],pt:[{pt:L()}],pr:[{pr:L()}],pb:[{pb:L()}],pl:[{pl:L()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mbs:[{mbs:P()}],mbe:[{mbe:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":L()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":L()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...$()]}],"min-inline-size":[{"min-inline":["auto",...$()]}],"max-inline-size":[{"max-inline":["none",...$()]}],"block-size":[{block:["auto",...ae()]}],"min-block-size":[{"min-block":["auto",...ae()]}],"max-block-size":[{"max-block":["none",...ae()]}],w:[{w:[u,"screen",...Z()]}],"min-w":[{"min-w":[u,"screen","none",...Z()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh","none",...Z()]}],"font-size":[{text:["base",n,td,$a]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,H6,I6]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Fy,Te]}],"font-family":[{font:[B6,P6,t]}],"font-features":[{"font-features":[Te]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,De,Te]}],"line-clamp":[{"line-clamp":[rt,"none",De,JE]}],leading:[{leading:["none",a,...L()]}],"list-image":[{"list-image":["none",De,Te]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",De,Te]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:j()}],"text-color":[{text:j()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...me(),"wavy"]}],"text-decoration-thickness":[{decoration:[rt,"from-font","auto",De,$a]}],"text-decoration-color":[{decoration:j()}],"underline-offset":[{"underline-offset":[rt,"auto",De,Te]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"tab-size":[{tab:[ss,De,Te]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",De,Te]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",De,Te]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:_e()}],"bg-repeat":[{bg:Le()}],"bg-size":[{bg:z()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ss,De,Te],radial:["",De,Te],conic:["",ss,De,Te]},U6,L6]}],"bg-color":[{bg:j()}],"gradient-from-pos":[{from:M()}],"gradient-via-pos":[{via:M()}],"gradient-to-pos":[{to:M()}],"gradient-from":[{from:j()}],"gradient-via":[{via:j()}],"gradient-to":[{to:j()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:ne()}],"border-w-x":[{"border-x":ne()}],"border-w-y":[{"border-y":ne()}],"border-w-s":[{"border-s":ne()}],"border-w-e":[{"border-e":ne()}],"border-w-bs":[{"border-bs":ne()}],"border-w-be":[{"border-be":ne()}],"border-w-t":[{"border-t":ne()}],"border-w-r":[{"border-r":ne()}],"border-w-b":[{"border-b":ne()}],"border-w-l":[{"border-l":ne()}],"divide-x":[{"divide-x":ne()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ne()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...me(),"hidden","none"]}],"divide-style":[{divide:[...me(),"hidden","none"]}],"border-color":[{border:j()}],"border-color-x":[{"border-x":j()}],"border-color-y":[{"border-y":j()}],"border-color-s":[{"border-s":j()}],"border-color-e":[{"border-e":j()}],"border-color-bs":[{"border-bs":j()}],"border-color-be":[{"border-be":j()}],"border-color-t":[{"border-t":j()}],"border-color-r":[{"border-r":j()}],"border-color-b":[{"border-b":j()}],"border-color-l":[{"border-l":j()}],"divide-color":[{divide:j()}],"outline-style":[{outline:[...me(),"none","hidden"]}],"outline-offset":[{"outline-offset":[rt,De,Te]}],"outline-w":[{outline:["",rt,td,$a]}],"outline-color":[{outline:j()}],shadow:[{shadow:["","inner","none",g,Lf,Pf]}],"shadow-color":[{shadow:j()}],"inset-shadow":[{"inset-shadow":["none",m,Lf,Pf]}],"inset-shadow-color":[{"inset-shadow":j()}],"ring-w":[{ring:ne()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:j()}],"ring-offset-w":[{"ring-offset":[rt,$a]}],"ring-offset-color":[{"ring-offset":j()}],"inset-ring-w":[{"inset-ring":ne()}],"inset-ring-color":[{"inset-ring":j()}],"text-shadow":[{"text-shadow":["none",_,Lf,Pf]}],"text-shadow-color":[{"text-shadow":j()}],opacity:[{opacity:[rt,De,Te]}],"mix-blend":[{"mix-blend":[...Ee(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ee()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[rt]}],"mask-image-linear-from-pos":[{"mask-linear-from":ve()}],"mask-image-linear-to-pos":[{"mask-linear-to":ve()}],"mask-image-linear-from-color":[{"mask-linear-from":j()}],"mask-image-linear-to-color":[{"mask-linear-to":j()}],"mask-image-t-from-pos":[{"mask-t-from":ve()}],"mask-image-t-to-pos":[{"mask-t-to":ve()}],"mask-image-t-from-color":[{"mask-t-from":j()}],"mask-image-t-to-color":[{"mask-t-to":j()}],"mask-image-r-from-pos":[{"mask-r-from":ve()}],"mask-image-r-to-pos":[{"mask-r-to":ve()}],"mask-image-r-from-color":[{"mask-r-from":j()}],"mask-image-r-to-color":[{"mask-r-to":j()}],"mask-image-b-from-pos":[{"mask-b-from":ve()}],"mask-image-b-to-pos":[{"mask-b-to":ve()}],"mask-image-b-from-color":[{"mask-b-from":j()}],"mask-image-b-to-color":[{"mask-b-to":j()}],"mask-image-l-from-pos":[{"mask-l-from":ve()}],"mask-image-l-to-pos":[{"mask-l-to":ve()}],"mask-image-l-from-color":[{"mask-l-from":j()}],"mask-image-l-to-color":[{"mask-l-to":j()}],"mask-image-x-from-pos":[{"mask-x-from":ve()}],"mask-image-x-to-pos":[{"mask-x-to":ve()}],"mask-image-x-from-color":[{"mask-x-from":j()}],"mask-image-x-to-color":[{"mask-x-to":j()}],"mask-image-y-from-pos":[{"mask-y-from":ve()}],"mask-image-y-to-pos":[{"mask-y-to":ve()}],"mask-image-y-from-color":[{"mask-y-from":j()}],"mask-image-y-to-color":[{"mask-y-to":j()}],"mask-image-radial":[{"mask-radial":[De,Te]}],"mask-image-radial-from-pos":[{"mask-radial-from":ve()}],"mask-image-radial-to-pos":[{"mask-radial-to":ve()}],"mask-image-radial-from-color":[{"mask-radial-from":j()}],"mask-image-radial-to-color":[{"mask-radial-to":j()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[rt]}],"mask-image-conic-from-pos":[{"mask-conic-from":ve()}],"mask-image-conic-to-pos":[{"mask-conic-to":ve()}],"mask-image-conic-from-color":[{"mask-conic-from":j()}],"mask-image-conic-to-color":[{"mask-conic-to":j()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:_e()}],"mask-repeat":[{mask:Le()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",De,Te]}],filter:[{filter:["","none",De,Te]}],blur:[{blur:Re()}],brightness:[{brightness:[rt,De,Te]}],contrast:[{contrast:[rt,De,Te]}],"drop-shadow":[{"drop-shadow":["","none",b,Lf,Pf]}],"drop-shadow-color":[{"drop-shadow":j()}],grayscale:[{grayscale:["",rt,De,Te]}],"hue-rotate":[{"hue-rotate":[rt,De,Te]}],invert:[{invert:["",rt,De,Te]}],saturate:[{saturate:[rt,De,Te]}],sepia:[{sepia:["",rt,De,Te]}],"backdrop-filter":[{"backdrop-filter":["","none",De,Te]}],"backdrop-blur":[{"backdrop-blur":Re()}],"backdrop-brightness":[{"backdrop-brightness":[rt,De,Te]}],"backdrop-contrast":[{"backdrop-contrast":[rt,De,Te]}],"backdrop-grayscale":[{"backdrop-grayscale":["",rt,De,Te]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[rt,De,Te]}],"backdrop-invert":[{"backdrop-invert":["",rt,De,Te]}],"backdrop-opacity":[{"backdrop-opacity":[rt,De,Te]}],"backdrop-saturate":[{"backdrop-saturate":[rt,De,Te]}],"backdrop-sepia":[{"backdrop-sepia":["",rt,De,Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":L()}],"border-spacing-x":[{"border-spacing-x":L()}],"border-spacing-y":[{"border-spacing-y":L()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",De,Te]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[rt,"initial",De,Te]}],ease:[{ease:["linear","initial",k,De,Te]}],delay:[{delay:[rt,De,Te]}],animate:[{animate:["none",R,De,Te]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,De,Te]}],"perspective-origin":[{"perspective-origin":I()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:he()}],"scale-x":[{"scale-x":he()}],"scale-y":[{"scale-y":he()}],"scale-z":[{"scale-z":he()}],"scale-3d":["scale-3d"],skew:[{skew:J()}],"skew-x":[{"skew-x":J()}],"skew-y":[{"skew-y":J()}],transform:[{transform:[De,Te,"","none","gpu","cpu"]}],"transform-origin":[{origin:I()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ie()}],"translate-x":[{"translate-x":Ie()}],"translate-y":[{"translate-y":Ie()}],"translate-z":[{"translate-z":Ie()}],"translate-none":["translate-none"],zoom:[{zoom:[ss,De,Te]}],accent:[{accent:j()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:j()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",De,Te]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":j()}],"scrollbar-track-color":[{"scrollbar-track":j()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mbs":[{"scroll-mbs":L()}],"scroll-mbe":[{"scroll-mbe":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pbs":[{"scroll-pbs":L()}],"scroll-pbe":[{"scroll-pbe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",De,Te]}],fill:[{fill:["none",...j()]}],"stroke-w":[{stroke:[rt,td,$a,JE]}],stroke:[{stroke:["none",...j()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["start","end","right","left"],"inset-y":["inset-bs","inset-be","top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["ps","pe","pr","pl"],py:["pbs","pbe","pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["ms","me","mr","ml"],my:["mbs","mbe","mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-s","border-w-e","border-w-r","border-w-l"],"border-w-y":["border-w-bs","border-w-be","border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-s","border-color-e","border-color-r","border-color-l"],"border-color-y":["border-color-bs","border-color-be","border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-ms","scroll-me","scroll-mr","scroll-ml"],"scroll-my":["scroll-mbs","scroll-mbe","scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-ps","scroll-pe","scroll-pr","scroll-pl"],"scroll-py":["scroll-pbs","scroll-pbe","scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},W6=S6(q6);function qe(...e){return W6(kD(e))}const K6={primary:"bg-accent text-white shadow-[0_1px_2px_rgba(0,0,0,.12)] hover:brightness-110 active:brightness-95",secondary:"border border-line bg-surface text-ink shadow-[0_1px_1px_rgba(0,0,0,.03)] hover:bg-surface-2",ghost:"text-ink-2 hover:bg-black/[.045] hover:text-ink dark:hover:bg-white/[.06]",soft:"bg-accent-soft text-accent hover:bg-accent/20",danger:"bg-danger text-white shadow-[0_1px_2px_rgba(0,0,0,.12)] hover:brightness-110"},V6={sm:"h-7 gap-1.5 rounded-lg px-2.5 text-[12px]",md:"h-8 gap-2 rounded-[9px] px-3 text-[12.5px]"};function Se({variant:e="secondary",size:t="md",leading:n,className:i,children:s,type:a="button",...l}){return p.jsxs("button",{type:a,className:qe("inline-flex select-none items-center justify-center whitespace-nowrap font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50 focus-visible:ring-offset-1 focus-visible:ring-offset-canvas","disabled:pointer-events-none disabled:opacity-45",K6[e],V6[t],i),...l,children:[n,s]})}var Uy={exports:{}},We={};var n2;function G6(){if(n2)return We;n2=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),_=Symbol.for("react.view_transition"),b=Symbol.iterator;function x(M){return M===null||typeof M!="object"?null:(M=b&&M[b]||M["@@iterator"],typeof M=="function"?M:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,k={};function R(M,K,ne){this.props=M,this.context=K,this.refs=k,this.updater=ne||S}R.prototype.isReactComponent={},R.prototype.setState=function(M,K){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,K,"setState")},R.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function N(){}N.prototype=R.prototype;function A(M,K,ne){this.props=M,this.context=K,this.refs=k,this.updater=ne||S}var I=A.prototype=new N;I.constructor=A,C(I,R.prototype),I.isPureReactComponent=!0;var T=Array.isArray;function D(){}var L={H:null,A:null,T:null,S:null},ee=Object.prototype.hasOwnProperty;function U(M,K,ne){var me=ne.ref;return{$$typeof:e,type:M,key:K,ref:me!==void 0?me:null,props:ne}}function F(M,K){return U(M.type,K,M.props)}function B(M){return typeof M=="object"&&M!==null&&M.$$typeof===e}function W(M){var K={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(ne){return K[ne]})}var te=/\/+/g;function G(M,K){return typeof M=="object"&&M!==null&&M.key!=null?W(""+M.key):K.toString(36)}function P(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(D,D):(M.status="pending",M.then(function(K){M.status==="pending"&&(M.status="fulfilled",M.value=K)},function(K){M.status==="pending"&&(M.status="rejected",M.reason=K)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function Z(M,K,ne,me,Ee){var ve=typeof M;(ve==="undefined"||ve==="boolean")&&(M=null);var Re=!1;if(M===null)Re=!0;else switch(ve){case"bigint":case"string":case"number":Re=!0;break;case"object":switch(M.$$typeof){case e:case t:Re=!0;break;case g:return Re=M._init,Z(Re(M._payload),K,ne,me,Ee)}}if(Re)return Ee=Ee(M),Re=me===""?"."+G(M,0):me,T(Ee)?(ne="",Re!=null&&(ne=Re.replace(te,"$&/")+"/"),Z(Ee,K,ne,"",function(J){return J})):Ee!=null&&(B(Ee)&&(Ee=F(Ee,ne+(Ee.key==null||M&&M.key===Ee.key?"":(""+Ee.key).replace(te,"$&/")+"/")+Re)),K.push(Ee)),1;Re=0;var re=me===""?".":me+":";if(T(M))for(var he=0;he<M.length;he++)me=M[he],ve=re+G(me,he),Re+=Z(me,K,ne,ve,Ee);else if(he=x(M),typeof he=="function")for(M=he.call(M),he=0;!(me=M.next()).done;)me=me.value,ve=re+G(me,he++),Re+=Z(me,K,ne,ve,Ee);else if(ve==="object"){if(typeof M.then=="function")return Z(P(M),K,ne,me,Ee);throw K=String(M),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return Re}function $(M,K,ne){if(M==null)return M;var me=[],Ee=0;return Z(M,me,"","",function(ve){return K.call(ne,ve,Ee++)}),me}function ae(M){if(M._status===-1){var K=M._result,ne=K();ne.then(function(me){(M._status===0||M._status===-1)&&(M._status=1,M._result=me,ne.status===void 0&&(ne.status="fulfilled",ne.value=me))},function(me){(M._status===0||M._status===-1)&&(M._status=2,M._result=me,ne.status===void 0&&(ne.status="rejected",ne.reason=me))}),M._status===-1&&(M._status=0,M._result=ne)}if(M._status===1)return M._result.default;throw M._result}var j=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)};function _e(M){var K=L.T,ne={};ne.types=K!==null?K.types:null,L.T=ne;try{var me=M(),Ee=L.S;Ee!==null&&Ee(ne,me),typeof me=="object"&&me!==null&&typeof me.then=="function"&&me.then(D,j)}catch(ve){j(ve)}finally{K!==null&&ne.types!==null&&(K.types=ne.types),L.T=K}}function Le(M){var K=L.T;if(K!==null){var ne=K.types;ne===null?K.types=[M]:ne.indexOf(M)===-1&&ne.push(M)}else _e(Le.bind(null,M))}var z={map:$,forEach:function(M,K,ne){$(M,function(){K.apply(this,arguments)},ne)},count:function(M){var K=0;return $(M,function(){K++}),K},toArray:function(M){return $(M,function(K){return K})||[]},only:function(M){if(!B(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return We.Activity=m,We.Children=z,We.Component=R,We.Fragment=n,We.Profiler=s,We.PureComponent=A,We.StrictMode=i,We.Suspense=f,We.ViewTransition=_,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=L,We.__COMPILER_RUNTIME={__proto__:null,c:function(M){return L.H.useMemoCache(M)}},We.addTransitionType=Le,We.cache=function(M){return function(){return M.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(M,K,ne){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var me=C({},M.props),Ee=M.key;if(K!=null)for(ve in K.key!==void 0&&(Ee=""+K.key),K)!ee.call(K,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&K.ref===void 0||(me[ve]=K[ve]);var ve=arguments.length-2;if(ve===1)me.children=ne;else if(1<ve){for(var Re=Array(ve),re=0;re<ve;re++)Re[re]=arguments[re+2];me.children=Re}return U(M.type,Ee,me)},We.createContext=function(M){return M={$$typeof:l,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:a,_context:M},M},We.createElement=function(M,K,ne){var me,Ee={},ve=null;if(K!=null)for(me in K.key!==void 0&&(ve=""+K.key),K)ee.call(K,me)&&me!=="key"&&me!=="__self"&&me!=="__source"&&(Ee[me]=K[me]);var Re=arguments.length-2;if(Re===1)Ee.children=ne;else if(1<Re){for(var re=Array(Re),he=0;he<Re;he++)re[he]=arguments[he+2];Ee.children=re}if(M&&M.defaultProps)for(me in Re=M.defaultProps,Re)Ee[me]===void 0&&(Ee[me]=Re[me]);return U(M,ve,Ee)},We.createRef=function(){return{current:null}},We.forwardRef=function(M){return{$$typeof:u,render:M}},We.isValidElement=B,We.lazy=function(M){return{$$typeof:g,_payload:{_status:-1,_result:M},_init:ae}},We.memo=function(M,K){return{$$typeof:h,type:M,compare:K===void 0?null:K}},We.startTransition=_e,We.unstable_useCacheRefresh=function(){return L.H.useCacheRefresh()},We.use=function(M){return L.H.use(M)},We.useActionState=function(M,K,ne){return L.H.useActionState(M,K,ne)},We.useCallback=function(M,K){return L.H.useCallback(M,K)},We.useContext=function(M){return L.H.useContext(M)},We.useDebugValue=function(){},We.useDeferredValue=function(M,K){return L.H.useDeferredValue(M,K)},We.useEffect=function(M,K){return L.H.useEffect(M,K)},We.useEffectEvent=function(M){return L.H.useEffectEvent(M)},We.useId=function(){return L.H.useId()},We.useImperativeHandle=function(M,K,ne){return L.H.useImperativeHandle(M,K,ne)},We.useInsertionEffect=function(M,K){return L.H.useInsertionEffect(M,K)},We.useLayoutEffect=function(M,K){return L.H.useLayoutEffect(M,K)},We.useMemo=function(M,K){return L.H.useMemo(M,K)},We.useOptimistic=function(M,K){return L.H.useOptimistic(M,K)},We.useReducer=function(M,K,ne){return L.H.useReducer(M,K,ne)},We.useRef=function(M){return L.H.useRef(M)},We.useState=function(M){return L.H.useState(M)},We.useSyncExternalStore=function(M,K,ne){return L.H.useSyncExternalStore(M,K,ne)},We.useTransition=function(){return L.H.useTransition()},We.version="19.3.1",We}var i2;function a0(){return i2||(i2=1,Uy.exports=G6()),Uy.exports}var w=a0();const xp=bm(w),vl=QL({__proto__:null,default:xp},[w]);var Z6=Object.defineProperty,Wc=(e,t)=>Z6(e,"name",{value:t,configurable:!0}),FD=!!(typeof window<"u"&&window.document&&window.document.createElement);function lt(e,t,{checkForDefaultPrevented:n=!0}={}){return Wc(function(s){if(e?.(s),n===!1||!s||!s.defaultPrevented)return t?.(s)},"handleEvent")}Wc(lt,"composeEventHandlers");function Y6(e){if(!FD)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Wc(Y6,"getOwnerWindow");function hb(e){if(!FD)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Wc(hb,"getOwnerDocument");function UD(e,t=!1){const{activeElement:n}=hb(e);if(!n?.nodeName)return null;if(HD(n)&&n.contentDocument)return UD(n.contentDocument.body,t);if(t){const i=n.getAttribute("aria-activedescendant");if(i){const s=hb(n).getElementById(i);if(s)return s}}return n}Wc(UD,"getActiveElement");function HD(e){return e.tagName==="IFRAME"}Wc(HD,"isFrame");var X6=Object.defineProperty,l0=(e,t)=>X6(e,"name",{value:t,configurable:!0});function fb(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}l0(fb,"setRef");function $D(...e){return t=>{let n=!1;const i=e.map(s=>{const a=fb(s,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<i.length;s++){const a=i[s];typeof a=="function"?a():fb(e[s],null)}}}}l0($D,"composeRefs");function rn(...e){return w.useCallback($D(...e),e)}l0(rn,"useComposedRefs");var Q6=Object.defineProperty,Cr=(e,t)=>Q6(e,"name",{value:t,configurable:!0});function J6(e,t){const n=w.createContext(t);n.displayName=e+"Context";const i=Cr(a=>{const{children:l,...u}=a,f=w.useMemo(()=>u,Object.values(u));return p.jsx(n.Provider,{value:f,children:l})},"Provider");i.displayName=e+"Provider";function s(a,l={}){const{optional:u=!1}=l,f=w.useContext(n);if(f)return f;if(t!==void 0)return t;if(!u)throw new Error(`\`${a}\` must be used within \`${e}\``)}return Cr(s,"useContext"),[i,s]}Cr(J6,"createContext");function uo(e,t=[]){let n=[];function i(a,l){const u=w.createContext(l);u.displayName=a+"Context";const f=n.length;n=[...n,l];const h=Cr(m=>{const{scope:_,children:b,...x}=m,S=_?.[e]?.[f]||u,C=w.useMemo(()=>x,Object.values(x));return p.jsx(S.Provider,{value:C,children:b})},"Provider");h.displayName=a+"Provider";function g(m,_,b={}){const{optional:x=!1}=b,S=_?.[e]?.[f]||u,C=w.useContext(S);if(C)return C;if(l!==void 0)return l;if(!x)throw new Error(`\`${m}\` must be used within \`${a}\``)}return Cr(g,"useContext"),[h,g]}Cr(i,"createContext");const s=Cr(()=>{const a=n.map(l=>w.createContext(l));return Cr(function(u){const f=u?.[e]||a;return w.useMemo(()=>({[`__scope${e}`]:{...u,[e]:f}}),[u,f])},"useScope")},"createScope");return s.scopeName=e,[i,qD(s,...t)]}Cr(uo,"createContextScope");function qD(...e){const t=e[0];if(e.length===1)return t;const n=Cr(()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return Cr(function(a){const l=i.reduce((u,{useScope:f,scopeName:h})=>{const m=f(a)[`__scope${h}`];return{...u,...m}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Cr(qD,"composeContextScopes");var ci=globalThis?.document?w.useLayoutEffect:()=>{},eB=Object.defineProperty,tB=(e,t)=>eB(e,"name",{value:t,configurable:!0}),nB=vl[" useId ".trim().toString()]||(()=>{}),iB=0;function ea(e){const[t,n]=w.useState(nB());return ci(()=>{e||n(i=>i??String(iB++))},[e]),e||(t?`radix-${t}`:"")}tB(ea,"useId");var rB=Object.defineProperty,sB=(e,t)=>rB(e,"name",{value:t,configurable:!0}),r2=vl[" useEffectEvent ".trim().toString()],s2=vl[" useInsertionEffect ".trim().toString()];function WD(e){if(typeof r2=="function")return r2(e);const t=w.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof s2=="function"?s2(()=>{t.current=e}):ci(()=>{t.current=e}),w.useMemo(()=>((...n)=>t.current?.(...n)),[])}sB(WD,"useEffectEvent");var oB=Object.defineProperty,Vd=(e,t)=>oB(e,"name",{value:t,configurable:!0}),aB=vl[" useInsertionEffect ".trim().toString()]||ci;function Gd({prop:e,defaultProp:t,onChange:n=Vd(()=>{},"onChange"),caller:i}){const[s,a,l]=KD({defaultProp:t,onChange:n}),u=e!==void 0,f=u?e:s,h=w.useCallback(g=>{if(u){const m=VD(g)?g(e):g;m!==e&&l.current?.(m)}else a(g)},[u,e,a,l]);return[f,h]}Vd(Gd,"useControllableState");function KD({defaultProp:e,onChange:t}){const[n,i]=w.useState(e),s=w.useRef(n),a=w.useRef(t);return aB(()=>{a.current=t},[t]),w.useEffect(()=>{s.current!==n&&(a.current?.(n),s.current=n)},[n,s]),[n,i,a]}Vd(KD,"useUncontrolledState");function VD(e){return typeof e=="function"}Vd(VD,"isFunction");var o2=Symbol("RADIX:SYNC_STATE");function lB(e,t,n,i){const{prop:s,defaultProp:a,onChange:l,caller:u}=t,f=s!==void 0,h=WD(l),g=[{...n,state:a}];i&&g.push(i);const[m,_]=w.useReducer((C,k)=>{if(k.type===o2)return{...C,state:k.state};const R=e(C,k);return f&&!Object.is(R.state,C.state)&&h(R.state),R},...g),b=m.state,x=w.useRef(b);w.useEffect(()=>{x.current!==b&&(x.current=b,f||h(b))},[b,x,f]);const S=w.useMemo(()=>s!==void 0?{...m,state:s}:m,[m,s]);return w.useEffect(()=>{f&&!Object.is(s,m.state)&&_({type:o2,state:s})},[s,m.state,f]),[S,_]}Vd(lB,"useControllableStateReducer");var Hy={exports:{}},ei={};var a2;function cB(){if(a2)return ei;a2=1;var e=a0();function t(g){var m="https://react.dev/errors/"+g;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var _=2;_<arguments.length;_++)m+="&args[]="+encodeURIComponent(arguments[_])}return"Minified React error #"+g+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal"),a=Symbol.for("react.recoverable"),l=Symbol.for("react.optimistic_key");function u(g,m,_){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:b==null?null:b===l?l:""+b,children:g,containerInfo:m,implementation:_}}var f=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(g,m){if(g==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return ei.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,ei.browser=function(g){return{$$typeof:a,_reason:g}},ei.createPortal=function(g,m){var _=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(t(299));return u(g,m,null,_)},ei.flushSync=function(g){var m=f.T,_=i.p;try{if(f.T=null,i.p=2,g)return g()}finally{f.T=m,i.p=_,i.d.f()}},ei.preconnect=function(g,m){typeof g=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,i.d.C(g,m))},ei.prefetchDNS=function(g){typeof g=="string"&&i.d.D(g)},ei.preinit=function(g,m){if(typeof g=="string"&&m&&typeof m.as=="string"){var _=m.as,b=h(_,m.crossOrigin),x=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;_==="style"?i.d.S(g,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:b,integrity:x,fetchPriority:S}):_==="script"&&i.d.X(g,{crossOrigin:b,integrity:x,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},ei.preinitModule=function(g,m){if(typeof g=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var _=h(m.as,m.crossOrigin);i.d.M(g,{crossOrigin:_,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0})}}else m==null&&i.d.M(g)},ei.preload=function(g,m){if(typeof g=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var _=m.as,b=h(_,m.crossOrigin);i.d.L(g,_,{crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},ei.preloadModule=function(g,m){if(typeof g=="string")if(m){var _=h(m.as,m.crossOrigin);i.d.m(g,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:_,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0})}else i.d.m(g)},ei.requestFormReset=function(g){i.d.r(g)},ei.unstable_batchedUpdates=function(g,m){return g(m)},ei.useFormState=function(g,m,_){return f.H.useFormState(g,m,_)},ei.useFormStatus=function(){return f.H.useHostTransitionStatus()},ei.version="19.3.1",ei}var l2;function GD(){if(l2)return Hy.exports;l2=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(),Hy.exports=cB(),Hy.exports}var yl=GD();const ZD=bm(yl);var uB=Object.defineProperty,sr=(e,t)=>uB(e,"name",{value:t,configurable:!0});function ra(e){const t=w.forwardRef((n,i)=>{let{children:s,...a}=n,l=null,u=!1;const f=[];s=nA(s),w.Children.forEach(s,_=>{if(eA(_)){u=!0;const b=_;let x="child"in b.props?b.props.child:b.props.children;for(;c0(x)&&typeof $p=="function";)x=$p(x._payload);l=dB(b,x),f.push(l?.props?.children)}else f.push(_)}),l?l=w.cloneElement(l,void 0,f):!u&&w.Children.count(s)===1&&w.isValidElement(s)&&(l=s);const h=l?JD(l):void 0,g=rn(i,h);if(!l){if(s||s===0)throw new Error(u?pB(e):fB(e));return s}const m=QD(a,l.props??{});return l.type!==w.Fragment&&(m.ref=i?g:h),w.cloneElement(l,m)});return t.displayName=`${e}.Slot`,t}sr(ra,"createSlot");var YD=Symbol.for("radix.slottable");function XD(e){const t=sr(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=YD,t}sr(XD,"createSlottable");var dB=sr((e,t)=>"child"in e.props?w.isValidElement(t)?w.cloneElement(t,void 0,e.props.children(t.props.children)):null:w.isValidElement(t)?t:null,"getSlottableElementFromSlottable");function QD(e,t){const n={...t};for(const i in t){const s=e[i],a=t[i];/^on[A-Z]/.test(i)?s&&a?n[i]=(...u)=>{const f=a(...u);return s(...u),f}:s&&(n[i]=s):i==="style"?n[i]={...s,...a}:i==="className"?n[i]=[s,a].filter(Boolean).join(" "):i==="aria-describedby"&&(n[i]=iA(a,s))}return{...e,...n}}sr(QD,"mergeProps");function JD(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}sr(JD,"getElementRef");function eA(e){return w.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===YD}sr(eA,"isSlottable");var hB=Symbol.for("react.lazy");function c0(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===hB&&"_payload"in e&&tA(e._payload)}sr(c0,"isLazyComponent");function tA(e){return typeof e=="object"&&e!==null&&"then"in e}sr(tA,"isPromiseLike");function nA(e){let t=e;for(;c0(t)&&typeof $p=="function";)t=$p(t._payload);return t}sr(nA,"useUnwrappedLazy");function iA(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const i of String(n).trim().split(/\s+/))i&&t.add(i);return t.size>0?Array.from(t).join(" "):void 0}sr(iA,"concatAriaDescribedby");var fB=sr(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),pB=sr(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),$p=vl[" use ".trim().toString()],mB=Object.defineProperty,gB=(e,t)=>mB(e,"name",{value:t,configurable:!0}),vB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Cn=vB.reduce((e,t)=>{const n=ra(`Primitive.${t}`),i=w.forwardRef((s,a)=>{const{asChild:l,...u}=s,f=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(f,{...u,ref:a})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function u0(e,t){e&&yl.flushSync(()=>e.dispatchEvent(t))}gB(u0,"dispatchDiscreteCustomEvent");var yB=Object.defineProperty,_B=(e,t)=>yB(e,"name",{value:t,configurable:!0}),c2=vl[" useInsertionEffect ".trim().toString()];function _s(e){const t=w.useRef(e);return typeof c2=="function"?c2(()=>{t.current=e}):ci(()=>{t.current=e}),w.useMemo(()=>((...n)=>t.current?.(...n)),[])}_B(_s,"useCallbackRef");var bB=Object.defineProperty,qn=(e,t)=>bB(e,"name",{value:t,configurable:!0}),pb="dismissableLayer.update",xB="dismissableLayer.pointerDownOutside",SB="dismissableLayer.focusOutside",u2,rA=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),d0=w.forwardRef(qn(function(t,n){const{disableOutsidePointerEvents:i=!1,deferPointerDownOutside:s=!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:f,onDismiss:h,...g}=t,m=w.useContext(rA),[_,b]=w.useState(null),x=_?.ownerDocument??globalThis?.document,[,S]=w.useState({}),C=rn(n,b),k=Array.from(m.layers),[R]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),N=R?k.indexOf(R):-1,A=_?k.indexOf(_):-1,I=m.layersWithOutsidePointerEventsDisabled.size>0,T=A>=N,D=w.useRef(!1),L=oA(B=>{l?.(B),f?.(B),B.defaultPrevented||h?.()},{ownerDocument:x,deferPointerDownOutside:s,isDeferredPointerDownOutsideRef:D,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:w.useCallback(B=>{if(!(B instanceof Node))return!1;const W=[...m.branches].some(te=>te.contains(B));return T&&!W},[m.branches,T])}),ee=aA(B=>{if(s&&D.current)return;const W=B.target;[...m.branches].some(G=>G.contains(W))||(u?.(B),f?.(B),B.defaultPrevented||h?.())},x),U=_?A===k.length-1:!1,F=_s(B=>{B.key==="Escape"&&(a?.(B),!B.defaultPrevented&&h&&(B.preventDefault(),h()))});return w.useEffect(()=>{if(U)return x.addEventListener("keydown",F,{capture:!0}),()=>x.removeEventListener("keydown",F,{capture:!0})},[x,U,F]),w.useEffect(()=>{if(_)return i&&(m.layersWithOutsidePointerEventsDisabled.size===0&&(u2=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(_)),m.layers.add(_),mb(),()=>{i&&(m.layersWithOutsidePointerEventsDisabled.delete(_),m.layersWithOutsidePointerEventsDisabled.size===0&&(x.body.style.pointerEvents=u2))}},[_,x,i,m]),w.useEffect(()=>()=>{_&&(m.layers.delete(_),m.layersWithOutsidePointerEventsDisabled.delete(_),mb())},[_,m]),w.useEffect(()=>{const B=qn(()=>S({}),"handleUpdate");return document.addEventListener(pb,B),()=>document.removeEventListener(pb,B)},[]),p.jsx(Cn.div,{...g,ref:C,style:{pointerEvents:I?T?"auto":"none":void 0,...t.style},onFocusCapture:lt(t.onFocusCapture,ee.onFocusCapture),onBlurCapture:lt(t.onBlurCapture,ee.onBlurCapture),onPointerDownCapture:lt(t.onPointerDownCapture,L.onPointerDownCapture)})},"DismissableLayer"));function sA(){const e=w.useContext(rA),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}qn(sA,"useDismissableLayerSurface");var wB=qn(()=>!0,"IS_TRUE");function oA(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:s,dismissableSurfaces:a,shouldHandlePointerDownOutside:l=wB}=t,u=_s(e),f=w.useRef(!1),h=w.useRef(!1),g=w.useRef(new Map),m=w.useRef(()=>{});return w.useEffect(()=>{function _(){h.current=!1,s.current=!1,g.current.clear()}qn(_,"resetOutsideInteraction");function b(){return Array.from(g.current.values()).some(Boolean)}qn(b,"isOutsideInteractionIntercepted");function x(N){if(!h.current)return;const A=N.target;A instanceof Node&&[...a].some(T=>T.contains(A))||g.current.set(N.type,!0),N.type==="click"&&window.setTimeout(()=>{h.current&&m.current()},0)}qn(x,"handleInteractionCapture");function S(N){h.current&&g.current.set(N.type,!1)}qn(S,"handleInteractionBubble");const C=qn(N=>{if(N.target&&!f.current){let A=function(){n.removeEventListener("click",m.current);const T=b();_(),T||h0(xB,u,I,{discrete:!0})};if(qn(A,"handleAndDispatchPointerDownOutsideEvent"),!l(N.target)){n.removeEventListener("click",m.current),_(),f.current=!1;return}const I={originalEvent:N};h.current=!0,s.current=i&&N.button===0,g.current.clear(),!i||N.button!==0?A():(n.removeEventListener("click",m.current),m.current=A,n.addEventListener("click",m.current,{once:!0}))}else n.removeEventListener("click",m.current),_();f.current=!1},"handlePointerDown"),k=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const N of k)n.addEventListener(N,x,!0),n.addEventListener(N,S);const R=window.setTimeout(()=>{n.addEventListener("pointerdown",C)},0);return()=>{window.clearTimeout(R),n.removeEventListener("pointerdown",C),n.removeEventListener("click",m.current);for(const N of k)n.removeEventListener(N,x,!0),n.removeEventListener(N,S)}},[n,u,i,s,a,l]),{onPointerDownCapture:qn(()=>f.current=!0,"onPointerDownCapture")}}qn(oA,"usePointerDownOutside");function aA(e,t=globalThis?.document){const n=_s(e),i=w.useRef(!1);return w.useEffect(()=>{const s=qn(a=>{a.target&&!i.current&&h0(SB,n,{originalEvent:a},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:qn(()=>i.current=!0,"onFocusCapture"),onBlurCapture:qn(()=>i.current=!1,"onBlurCapture")}}qn(aA,"useFocusOutside");function mb(){const e=new CustomEvent(pb);document.dispatchEvent(e)}qn(mb,"dispatchUpdate");function h0(e,t,n,{discrete:i}){const s=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),i?u0(s,a):s.dispatchEvent(a)}qn(h0,"handleAndDispatchCustomEvent");var CB=Object.defineProperty,xn=(e,t)=>CB(e,"name",{value:t,configurable:!0}),$y="focusScope.autoFocusOnMount",qy="focusScope.autoFocusOnUnmount",d2={bubbles:!1,cancelable:!0},lA=w.forwardRef(xn(function(t,n){const{loop:i=!1,trapped:s=!1,branches:a,onMountAutoFocus:l,onUnmountAutoFocus:u,...f}=t,[h,g]=w.useState(null),m=_s(l),_=_s(u),b=w.useRef(null),x=rn(n,g),S=w.useRef(a);w.useEffect(()=>{S.current=a});const C=w.useCallback(N=>N?h?.contains(N)?!0:!!S.current?.some(A=>A.contains(N)):!1,[h]),k=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(s){let N=function(D){if(k.paused||!h)return;const L=D.target;C(L)?b.current=L:Xs(b.current,{select:!0})},A=function(D){if(k.paused||!h)return;const L=D.relatedTarget;L!==null&&(C(L)||Xs(b.current,{select:!0}))},I=function(D){if(document.activeElement===document.body)for(const ee of D)ee.removedNodes.length>0&&Xs(h)};xn(N,"handleFocusIn"),xn(A,"handleFocusOut"),xn(I,"handleMutations"),document.addEventListener("focusin",N),document.addEventListener("focusout",A);const T=new MutationObserver(I);return h&&T.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",A),T.disconnect()}}},[s,h,k.paused,C]),w.useEffect(()=>{if(h){h2.add(k);const N=document.activeElement;if(!h.contains(N)){const I=new CustomEvent($y,d2);h.addEventListener($y,m),h.dispatchEvent(I),I.defaultPrevented||(uA(mA(g0(h)),{select:!0}),document.activeElement===N&&Xs(h))}return()=>{h.removeEventListener($y,m);const I=h.ownerDocument,T=CustomEvent;setTimeout(()=>{const D=new T(qy,d2);h.addEventListener(qy,_),h.dispatchEvent(D),D.defaultPrevented||Xs(N??I.body,{select:!0}),h.removeEventListener(qy,_),h2.remove(k)},0)}}},[h,m,_,k]);const R=w.useCallback(N=>{if(!i&&!s||k.paused)return;const A=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,I=document.activeElement;if(A&&I){const T=N.currentTarget,[D,L]=dA(T);D&&L?!N.shiftKey&&I===L?(N.preventDefault(),i&&Xs(D,{select:!0})):N.shiftKey&&I===D&&(N.preventDefault(),i&&Xs(L,{select:!0})):I===T&&N.preventDefault()}},[i,s,k.paused]);return p.jsx(Cn.div,{tabIndex:-1,...f,ref:x,onKeyDown:R})},"FocusScope")),cA=w.createContext(null);function f0({registry:e,children:t}){return e?p.jsx(cA.Provider,{value:e,children:t}):t}xn(f0,"FocusScopeBranchProvider");function p0(){const[e,t]=w.useState([]),n=w.useMemo(()=>({add:xn(i=>t(s=>s.includes(i)?s:[...s,i]),"add"),remove:xn(i=>t(s=>s.filter(a=>a!==i)),"remove")}),[]);return{nodes:e,registry:n}}xn(p0,"useFocusScopeBranchRegistry");function m0(e){const t=w.useContext(cA);w.useEffect(()=>{if(!(!e||!t))return t.add(e),()=>t.remove(e)},[e,t])}xn(m0,"useFocusScopeBranch");function uA(e,{select:t=!1}={}){const n=document.activeElement;for(const i of e)if(Xs(i,{select:t}),document.activeElement!==n)return}xn(uA,"focusFirst");function dA(e){const t=g0(e),n=gb(t,e),i=gb(t.reverse(),e);return[n,i]}xn(dA,"getTabbableEdges");function g0(e){const t=[],i=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:xn(s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;i.nextNode();)t.push(i.currentNode);return t}xn(g0,"getTabbableCandidates");function gb(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(n?!i.checkVisibility({checkVisibilityCSS:!0}):hA(i,{upTo:t})))return i}xn(gb,"findVisible");function hA(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}xn(hA,"isHidden");function fA(e){return e.tagName==="INPUT"&&typeof e.select=="function"}xn(fA,"isSelectableInput");function Xs(e,{select:t=!1}={}){if(e&&e.focus){const i=(e.ownerDocument??document).activeElement;e.focus({preventScroll:!0}),e!==i&&fA(e)&&t&&e.select()}}xn(Xs,"focus");var h2=pA();function pA(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=vb(e,t),e.unshift(t)},remove(t){e=vb(e,t),e[0]?.resume()}}}xn(pA,"createFocusScopesStack");function vb(e,t){const n=[...e],i=n.indexOf(t);return i!==-1&&n.splice(i,1),n}xn(vb,"arrayRemove");function mA(e){return e.filter(t=>t.tagName!=="A")}xn(mA,"removeLinks");var kB=Object.defineProperty,EB=(e,t)=>kB(e,"name",{value:t,configurable:!0}),v0=w.forwardRef(EB(function(t,n){const{container:i,...s}=t,[a,l]=w.useState(!1);ci(()=>l(!0),[]);const u=i||a&&globalThis?.document?.body;return u?yl.createPortal(p.jsx(Cn.div,{...s,ref:n}),u):null},"Portal")),NB=Object.defineProperty,ro=(e,t)=>NB(e,"name",{value:t,configurable:!0});function gA(e,t){return w.useReducer((n,i)=>t[n][i]??n,e)}ro(gA,"useStateMachine");var ha=ro(e=>{const{present:t,children:n}=e,i=vA(t),s=typeof n=="function"?n({present:i.isPresent}):w.Children.only(n),a=yA(i.ref,_A(s));return typeof n=="function"||i.isPresent?w.cloneElement(s,{ref:a}):null},"Presence");function vA(e){const[t,n]=w.useState(),i=w.useRef(null),s=w.useRef(e),a=w.useRef("none"),l=w.useRef(void 0),u=e?"mounted":"unmounted",[f,h]=gA(u,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return w.useEffect(()=>{f==="mounted"?(a.current=l.current??bc(i.current),l.current=void 0):a.current="none"},[f]),ci(()=>{const g=i.current,m=s.current;if(m!==e){const b=a.current,x=bc(g);e?(l.current=x,h("MOUNT")):x==="none"||g?.display==="none"?h("UNMOUNT"):h(m&&b!==x?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,h]),ci(()=>{if(t){let g;const m=t.ownerDocument.defaultView??window,_=ro(x=>{const C=bc(i.current).includes(CSS.escape(x.animationName));if(x.target===t&&C&&(h("ANIMATION_END"),!s.current)){const k=t.style.animationFillMode;t.style.animationFillMode="forwards",g=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=k)})}},"handleAnimationEnd"),b=ro(x=>{x.target===t&&(a.current=bc(i.current))},"handleAnimationStart");return t.addEventListener("animationstart",b),t.addEventListener("animationcancel",_),t.addEventListener("animationend",_),()=>{m.clearTimeout(g),t.removeEventListener("animationstart",b),t.removeEventListener("animationcancel",_),t.removeEventListener("animationend",_)}}else h("ANIMATION_END")},[t,h]),{isPresent:["mounted","unmountSuspended"].includes(f),ref:w.useCallback(g=>{if(g){const m=getComputedStyle(g);i.current=m,l.current=bc(m)}else i.current=null;n(g)},[])}}ro(vA,"usePresence");function yb(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}ro(yb,"setRef");function yA(...e){const t=w.useRef(e);return t.current=e,w.useCallback(n=>{const i=t.current;let s=!1;const a=i.map(l=>{const u=yb(l,n);return!s&&typeof u=="function"&&(s=!0),u});if(s)return()=>{for(let l=0;l<a.length;l++){const u=a[l];typeof u=="function"?u():yb(i[l],null)}}},[])}ro(yA,"useStableComposedRefs");function bc(e){return e?.animationName||"none"}ro(bc,"getAnimationName");function _A(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ro(_A,"getElementRef");var RB=Object.defineProperty,y0=(e,t)=>RB(e,"name",{value:t,configurable:!0}),Bf=0,fc=null;function TB(e){return xm(),e.children}y0(TB,"FocusGuards");function xm(){w.useEffect(()=>{fc||(fc={start:_b(),end:_b()});const{start:e,end:t}=fc;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Bf++,()=>{Bf===1&&(fc?.start.remove(),fc?.end.remove(),fc=null),Bf=Math.max(0,Bf-1)}},[])}y0(xm,"useFocusGuards");function _b(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}y0(_b,"createFocusGuard");var fs=function(){return fs=Object.assign||function(t){for(var n,i=1,s=arguments.length;i<s;i++){n=arguments[i];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},fs.apply(this,arguments)};function bA(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]]);return n}function DB(e,t,n){if(n||arguments.length===2)for(var i=0,s=t.length,a;i<s;i++)(a||!(i in t))&&(a||(a=Array.prototype.slice.call(t,0,i)),a[i]=t[i]);return e.concat(a||Array.prototype.slice.call(t))}var Sp="right-scroll-bar-position",wp="width-before-scroll-bar",AB="with-scroll-bars-hidden",OB="--removed-body-scroll-bar-size";function Wy(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function jB(e,t){var n=w.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(i){var s=n.value;s!==i&&(n.value=i,n.callback(i,s))}}}})[0];return n.callback=t,n.facade}var zB=typeof window<"u"?w.useLayoutEffect:w.useEffect,f2=new WeakMap;function MB(e,t){var n=jB(null,function(i){return e.forEach(function(s){return Wy(s,i)})});return zB(function(){var i=f2.get(n);if(i){var s=new Set(i),a=new Set(e),l=n.current;s.forEach(function(u){a.has(u)||Wy(u,null)}),a.forEach(function(u){s.has(u)||Wy(u,l)})}f2.set(n,e)},[e]),n}function IB(e){return e}function PB(e,t){t===void 0&&(t=IB);var n=[],i=!1,s={read:function(){if(i)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,i);return n.push(l),function(){n=n.filter(function(u){return u!==l})}},assignSyncMedium:function(a){for(i=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(u){return a(u)},filter:function(){return n}}},assignMedium:function(a){i=!0;var l=[];if(n.length){var u=n;n=[],u.forEach(a),l=n}var f=function(){var g=l;l=[],g.forEach(a)},h=function(){return Promise.resolve().then(f)};h(),n={push:function(g){l.push(g),h()},filter:function(g){return l=l.filter(g),n}}}};return s}function LB(e){e===void 0&&(e={});var t=PB(null);return t.options=fs({async:!0,ssr:!1},e),t}var xA=function(e){var t=e.sideCar,n=bA(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var i=t.read();if(!i)throw new Error("Sidecar medium not found");return w.createElement(i,fs({},n))};xA.isSideCarExport=!0;function BB(e,t){return e.useMedium(t),xA}var SA=LB(),Ky=function(){},Sm=w.forwardRef(function(e,t){var n=w.useRef(null),i=w.useState({onScrollCapture:Ky,onWheelCapture:Ky,onTouchMoveCapture:Ky}),s=i[0],a=i[1],l=e.forwardProps,u=e.children,f=e.className,h=e.removeScrollBar,g=e.enabled,m=e.shards,_=e.sideCar,b=e.noRelative,x=e.noIsolation,S=e.inert,C=e.allowPinchZoom,k=e.as,R=k===void 0?"div":k,N=e.gapMode,A=bA(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),I=_,T=MB([n,t]),D=fs(fs({},A),s);return w.createElement(w.Fragment,null,g&&w.createElement(I,{sideCar:SA,removeScrollBar:h,shards:m,noRelative:b,noIsolation:x,inert:S,setCallbacks:a,allowPinchZoom:!!C,lockRef:n,gapMode:N}),l?w.cloneElement(w.Children.only(u),fs(fs({},D),{ref:T})):w.createElement(R,fs({},D,{className:f,ref:T}),u))});Sm.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Sm.classNames={fullWidth:wp,zeroRight:Sp};var FB=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function UB(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=FB();return t&&e.setAttribute("nonce",t),e}function HB(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function $B(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var qB=function(){var e=0,t=null;return{add:function(n){e==0&&(t=UB())&&(HB(t,n),$B(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},WB=function(){var e=qB();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},wA=function(){var e=WB(),t=function(n){var i=n.styles,s=n.dynamic;return e(i,s),null};return t},KB={left:0,top:0,right:0,gap:0},Vy=function(e){return parseInt(e||"",10)||0},VB=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],i=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Vy(n),Vy(i),Vy(s)]},GB=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return KB;var t=VB(e),n=document.documentElement.clientWidth,i=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,i-n+t[2]-t[0])}},ZB=wA(),Ec="data-scroll-locked",YB=function(e,t,n,i){var s=e.left,a=e.top,l=e.right,u=e.gap;return n===void 0&&(n="margin"),`
3
- .`.concat(AB,` {
4
- overflow: hidden `).concat(i,`;
5
- padding-right: `).concat(u,"px ").concat(i,`;
6
- }
7
- body[`).concat(Ec,`] {
8
- overflow: hidden `).concat(i,`;
9
- overscroll-behavior: contain;
10
- `).concat([t&&"position: relative ".concat(i,";"),n==="margin"&&`
11
- padding-left: `.concat(s,`px;
12
- padding-top: `).concat(a,`px;
13
- padding-right: `).concat(l,`px;
14
- margin-left:0;
15
- margin-top:0;
16
- margin-right: `).concat(u,"px ").concat(i,`;
17
- `),n==="padding"&&"padding-right: ".concat(u,"px ").concat(i,";")].filter(Boolean).join(""),`
18
- }
19
-
20
- .`).concat(Sp,` {
21
- right: `).concat(u,"px ").concat(i,`;
22
- }
23
-
24
- .`).concat(wp,` {
25
- margin-right: `).concat(u,"px ").concat(i,`;
26
- }
27
-
28
- .`).concat(Sp," .").concat(Sp,` {
29
- right: 0 `).concat(i,`;
30
- }
31
-
32
- .`).concat(wp," .").concat(wp,` {
33
- margin-right: 0 `).concat(i,`;
34
- }
35
-
36
- body[`).concat(Ec,`] {
37
- `).concat(OB,": ").concat(u,`px;
38
- }
39
- `)},p2=function(){var e=parseInt(document.body.getAttribute(Ec)||"0",10);return isFinite(e)?e:0},XB=function(){w.useEffect(function(){return document.body.setAttribute(Ec,(p2()+1).toString()),function(){var e=p2()-1;e<=0?document.body.removeAttribute(Ec):document.body.setAttribute(Ec,e.toString())}},[])},QB=function(e){var t=e.noRelative,n=e.noImportant,i=e.gapMode,s=i===void 0?"margin":i;XB();var a=w.useMemo(function(){return GB(s)},[s]);return w.createElement(ZB,{styles:YB(a,!t,s,n?"":"!important")})},bb=!1;if(typeof window<"u")try{var Ff=Object.defineProperty({},"passive",{get:function(){return bb=!0,!0}});window.addEventListener("test",Ff,Ff),window.removeEventListener("test",Ff,Ff)}catch{bb=!1}var pc=bb?{passive:!1}:!1,JB=function(e){return e.tagName==="TEXTAREA"},CA=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!JB(e)&&n[t]==="visible")},e8=function(e){return CA(e,"overflowY")},t8=function(e){return CA(e,"overflowX")},m2=function(e,t){var n=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var s=kA(e,i);if(s){var a=EA(e,i),l=a[1],u=a[2];if(l>u)return!0}i=i.parentNode}while(i&&i!==n.body);return!1},n8=function(e){var t=e.scrollTop,n=e.scrollHeight,i=e.clientHeight;return[t,n,i]},i8=function(e){var t=e.scrollLeft,n=e.scrollWidth,i=e.clientWidth;return[t,n,i]},kA=function(e,t){return e==="v"?e8(t):t8(t)},EA=function(e,t){return e==="v"?n8(t):i8(t)},r8=function(e,t){return e==="h"&&t==="rtl"?-1:1},s8=function(e,t,n,i,s){var a=r8(e,window.getComputedStyle(t).direction),l=a*i,u=n.target,f=t.contains(u),h=!1,g=l>0,m=0,_=0;do{if(!u)break;var b=EA(e,u),x=b[0],S=b[1],C=b[2],k=S-C-a*x;(x||k)&&kA(e,u)&&(m+=k,_+=x);var R=u.parentNode;u=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!f&&u!==document.body||f&&(t.contains(u)||t===u));return(g&&Math.abs(m)<1||!g&&Math.abs(_)<1)&&(h=!0),h},Uf=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},g2=function(e){return[e.deltaX,e.deltaY]},v2=function(e){return e&&"current"in e?e.current:e},o8=function(e,t){return e[0]===t[0]&&e[1]===t[1]},a8=function(e){return`
40
- .block-interactivity-`.concat(e,` {pointer-events: none;}
41
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
42
- `)},l8=0,mc=[];function c8(e){var t=w.useRef([]),n=w.useRef([0,0]),i=w.useRef(),s=w.useState(l8++)[0],a=w.useState(wA)[0],l=w.useRef(e);w.useEffect(function(){l.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var S=DB([e.lockRef.current],(e.shards||[]).map(v2),!0).filter(Boolean);return S.forEach(function(C){return C.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),S.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var u=w.useCallback(function(S,C){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!l.current.allowPinchZoom;var k=Uf(S),R=n.current,N="deltaX"in S?S.deltaX:R[0]-k[0],A="deltaY"in S?S.deltaY:R[1]-k[1],I,T=S.target,D=Math.abs(N)>Math.abs(A)?"h":"v";if("touches"in S&&D==="h"&&T.type==="range")return!1;var L=window.getSelection(),ee=L&&L.anchorNode,U=ee?ee===T||ee.contains(T):!1;if(U)return!1;var F=m2(D,T);if(!F)return!0;if(F?I=D:(I=D==="v"?"h":"v",F=m2(D,T)),!F)return!1;if(!i.current&&"changedTouches"in S&&(N||A)&&(i.current=I),!I)return!0;var B=i.current||I;return s8(B,C,S,B==="h"?N:A)},[]),f=w.useCallback(function(S){var C=S;if(!(!mc.length||mc[mc.length-1]!==a)){var k="deltaY"in C?g2(C):Uf(C),R=t.current.filter(function(I){return I.name===C.type&&(I.target===C.target||C.target===I.shadowParent)&&o8(I.delta,k)})[0];if(R&&R.should){C.cancelable&&C.preventDefault();return}if(!R){var N=(l.current.shards||[]).map(v2).filter(Boolean).filter(function(I){return I.contains(C.target)}),A=N.length>0?u(C,N[0]):!l.current.noIsolation;A&&C.cancelable&&C.preventDefault()}}},[]),h=w.useCallback(function(S,C,k,R){var N={name:S,delta:C,target:k,should:R,shadowParent:u8(k)};t.current.push(N),setTimeout(function(){t.current=t.current.filter(function(A){return A!==N})},1)},[]),g=w.useCallback(function(S){n.current=Uf(S),i.current=void 0},[]),m=w.useCallback(function(S){h(S.type,g2(S),S.target,u(S,e.lockRef.current))},[]),_=w.useCallback(function(S){h(S.type,Uf(S),S.target,u(S,e.lockRef.current))},[]);w.useEffect(function(){return mc.push(a),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:_}),document.addEventListener("wheel",f,pc),document.addEventListener("touchmove",f,pc),document.addEventListener("touchstart",g,pc),function(){mc=mc.filter(function(S){return S!==a}),document.removeEventListener("wheel",f,pc),document.removeEventListener("touchmove",f,pc),document.removeEventListener("touchstart",g,pc)}},[]);var b=e.removeScrollBar,x=e.inert;return w.createElement(w.Fragment,null,x?w.createElement(a,{styles:a8(s)}):null,b?w.createElement(QB,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function u8(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const d8=BB(SA,c8);var _0=w.forwardRef(function(e,t){return w.createElement(Sm,fs({},e,{ref:t,sideCar:d8}))});_0.classNames=Sm.classNames;var h8=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},gc=new WeakMap,Hf=new WeakMap,$f={},Gy=0,NA=function(e){return e&&(e.host||NA(e.parentNode))},f8=function(e,t){return t.map(function(n){if(e.contains(n))return n;var i=NA(n);return i&&e.contains(i)?i:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},p8=function(e,t,n,i){var s=f8(t,Array.isArray(e)?e:[e]);$f[n]||($f[n]=new WeakMap);var a=$f[n],l=[],u=new Set,f=new Set(s),h=function(m){!m||u.has(m)||(u.add(m),h(m.parentNode))};s.forEach(h);var g=function(m){!m||f.has(m)||Array.prototype.forEach.call(m.children,function(_){if(u.has(_))g(_);else try{var b=_.getAttribute(i),x=b!==null&&b!=="false",S=(gc.get(_)||0)+1,C=(a.get(_)||0)+1;gc.set(_,S),a.set(_,C),l.push(_),S===1&&x&&Hf.set(_,!0),C===1&&_.setAttribute(n,"true"),x||_.setAttribute(i,"true")}catch(k){console.error("aria-hidden: cannot operate on ",_,k)}})};return g(t),u.clear(),Gy++,function(){l.forEach(function(m){var _=gc.get(m)-1,b=a.get(m)-1;gc.set(m,_),a.set(m,b),_||(Hf.has(m)||m.removeAttribute(i),Hf.delete(m)),b||m.removeAttribute(n)}),Gy--,Gy||(gc=new WeakMap,gc=new WeakMap,Hf=new WeakMap,$f={})}},RA=function(e,t,n){n===void 0&&(n="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),s=h8(e);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),p8(i,s,n,"aria-hidden")):function(){return null}},m8=Object.defineProperty,or=(e,t)=>m8(e,"name",{value:t,configurable:!0}),b0="Dialog",[TA,sde]=uo(b0),[g8,Es]=TA(b0),v8=or(e=>{const{__scopeDialog:t,children:n,open:i,defaultOpen:s,onOpenChange:a,modal:l=!0}=e,u=w.useRef(null),f=w.useRef(null),{nodes:h,registry:g}=p0(),[m,_]=Gd({prop:i,defaultProp:s??!1,onChange:a,caller:b0}),[b,x]=w.useState(0),[S,C]=w.useState(0);return p.jsx(g8,{scope:t,triggerRef:u,contentRef:f,contentId:ea(),titleId:ea(),descriptionId:ea(),titlePresent:b>0,descriptionPresent:S>0,setTitleCount:x,setDescriptionCount:C,open:m,onOpenChange:_,onOpenToggle:w.useCallback(()=>_(k=>!k),[_]),modal:l,branchNodes:h,branchRegistry:g,children:n})},"Dialog"),DA="DialogPortal",[y8,AA]=TA(DA,{forceMount:void 0}),_8=or(e=>{const{__scopeDialog:t,forceMount:n,children:i,container:s}=e,a=Es(DA,t);return p.jsx(y8,{scope:t,forceMount:n,children:w.Children.map(i,l=>p.jsx(ha,{present:n||a.open,children:p.jsx(v0,{asChild:!0,container:s,children:l})}))})},"DialogPortal"),xb="DialogOverlay",b8=w.forwardRef(or(function(t,n){const i=AA(xb,t.__scopeDialog),{forceMount:s=i.forceMount,...a}=t,l=Es(xb,t.__scopeDialog);return l.modal?p.jsx(ha,{present:s||l.open,children:p.jsx(S8,{...a,ref:n})}):null},"DialogOverlay")),x8=ra("DialogOverlay.RemoveScroll"),S8=w.forwardRef(or(function(t,n){const{__scopeDialog:i,...s}=t,a=Es(xb,i),l=sA(),u=rn(n,l);return p.jsx(_0,{as:x8,allowPinchZoom:!0,shards:w.useMemo(()=>[a.contentRef,...a.branchNodes.map(f=>({current:f}))],[a.contentRef,a.branchNodes]),children:p.jsx(Cn.div,{"data-state":x0(a.open),...s,ref:u,style:{pointerEvents:"auto",...s.style}})})},"DialogOverlayImpl")),Id="DialogContent",w8=w.forwardRef(or(function(t,n){const i=AA(Id,t.__scopeDialog),{forceMount:s=i.forceMount,...a}=t,l=Es(Id,t.__scopeDialog);return p.jsx(ha,{present:s||l.open,children:l.modal?p.jsx(C8,{...a,ref:n}):p.jsx(k8,{...a,ref:n})})},"DialogContent")),C8=w.forwardRef(or(function(t,n){const i=Es(Id,t.__scopeDialog),s=w.useRef(null),a=rn(n,i.contentRef,s);return w.useEffect(()=>{const l=s.current;if(l)return RA(l)},[]),p.jsx(OA,{...t,ref:a,trapFocus:i.open,disableOutsidePointerEvents:i.open,onCloseAutoFocus:lt(t.onCloseAutoFocus,l=>{l.preventDefault(),i.triggerRef.current?.focus()}),onPointerDownOutside:lt(t.onPointerDownOutside,l=>{const u=l.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0;(u.button===2||f)&&l.preventDefault()}),onFocusOutside:lt(t.onFocusOutside,l=>l.preventDefault())})},"DialogContentModal")),k8=w.forwardRef(or(function(t,n){const i=Es(Id,t.__scopeDialog),s=w.useRef(!1),a=w.useRef(!1);return p.jsx(OA,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{t.onCloseAutoFocus?.(l),l.defaultPrevented||(s.current||i.triggerRef.current?.focus(),l.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:l=>{t.onInteractOutside?.(l),l.defaultPrevented||(s.current=!0,l.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const u=l.target;i.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&a.current&&l.preventDefault()}})},"DialogContentNonModal")),OA=w.forwardRef(or(function(t,n){const{__scopeDialog:i,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:l,"aria-describedby":u,children:f,...h}=t,g=Es(Id,i);return xm(),p.jsx(f0,{registry:g.branchRegistry,children:p.jsx(lA,{asChild:!0,loop:!0,trapped:s,branches:g.branchNodes,onMountAutoFocus:a,onUnmountAutoFocus:l,children:p.jsx(d0,{role:"dialog",id:g.contentId,"aria-labelledby":g.titlePresent?g.titleId:void 0,"aria-describedby":g.descriptionPresent?jA(u,g.descriptionId):u,"data-state":x0(g.open),...h,ref:n,deferPointerDownOutside:!0,onDismiss:()=>g.onOpenChange(!1),children:f})})})},"DialogContentImpl")),E8=w.forwardRef(or(function(t,n){const{__scopeDialog:i,...s}=t,a=Es("DialogTitle",i),{setTitleCount:l}=a;return ci(()=>(l(u=>u+1),()=>l(u=>u-1)),[l]),p.jsx(Cn.h2,{id:a.titleId,...s,ref:n})},"DialogTitle")),N8=w.forwardRef(or(function(t,n){const{__scopeDialog:i,...s}=t,a=Es("DialogDescription",i),{setDescriptionCount:l}=a;return ci(()=>(l(u=>u+1),()=>l(u=>u-1)),[l]),p.jsx(Cn.p,{id:a.descriptionId,...s,ref:n})},"DialogDescription")),R8="DialogClose",T8=w.forwardRef(or(function(t,n){const{__scopeDialog:i,...s}=t,a=Es(R8,i);return p.jsx(Cn.button,{type:"button",...s,ref:n,onClick:lt(t.onClick,()=>a.onOpenChange(!1))})},"DialogClose"));function jA(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const i of String(n).trim().split(/\s+/))i&&t.add(i);return t.size>0?Array.from(t).join(" "):void 0}or(jA,"concatAriaDescribedby");function x0(e){return e?"open":"closed"}or(x0,"getState");const xi=v8,S0=T8,ui=w.forwardRef(({className:e,children:t,...n},i)=>p.jsxs(_8,{children:[p.jsx(b8,{className:"fixed inset-0 z-[300] bg-black/20 backdrop-blur-[2px]"}),p.jsx(w8,{ref:i,className:qe("fixed left-1/2 top-1/2 z-[301] w-[min(560px,calc(100vw-40px))] -translate-x-1/2 -translate-y-1/2","rounded-2xl border border-line bg-surface p-5 text-ink shadow-[var(--shadow-pop)] outline-none",e),...n,children:t})]}));ui.displayName="DialogContent";function Si({className:e,...t}){return p.jsx(E8,{className:qe("text-[15px] font-semibold tracking-[-.01em]",e),...t})}function wi({className:e,...t}){return p.jsx(N8,{className:qe("mt-1 text-[12px] leading-5 text-ink-2",e),...t})}var D8=Object.defineProperty,An=(e,t)=>D8(e,"name",{value:t,configurable:!0});function w0(e){const t=e+"CollectionProvider",[n,i]=uo(t),[s,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=An(S=>{const{scope:C,children:k}=S,R=w.useRef(null),N=w.useRef(new Map).current;return p.jsx(s,{scope:C,itemMap:N,collectionRef:R,children:k})},"CollectionProvider");l.displayName=t;const u=e+"CollectionSlot",f=ra(u),h=w.forwardRef((S,C)=>{const{scope:k,children:R}=S,N=a(u,k),A=rn(C,N.collectionRef);return p.jsx(f,{ref:A,children:R})});h.displayName=u;const g=e+"CollectionItemSlot",m="data-radix-collection-item",_=ra(g),b=w.forwardRef((S,C)=>{const{scope:k,children:R,...N}=S,A=w.useRef(null),I=rn(C,A),T=a(g,k);return w.useEffect(()=>(T.itemMap.set(A,{ref:A,...N}),()=>{T.itemMap.delete(A)})),p.jsx(_,{[m]:"",ref:I,children:R})});b.displayName=g;function x(S){const C=a(e+"CollectionConsumer",S);return w.useCallback(()=>{const R=C.collectionRef.current;if(!R)return[];const N=Array.from(R.querySelectorAll(`[${m}]`));return Array.from(C.itemMap.values()).sort((T,D)=>N.indexOf(T.ref.current)-N.indexOf(D.ref.current))},[C.collectionRef,C.itemMap])}return An(x,"useCollection"),[{Provider:l,Slot:h,ItemSlot:b},x,i]}An(w0,"createCollection");var y2=new WeakMap,un,nr,qf=(nr=class extends Map{constructor(n){super(n);VE(this,un);Ly(this,un,[...super.keys()]),y2.set(this,!0)}set(n,i){return y2.get(this)&&!this.has(n)&&Jn(this,un).push(n),super.set(n,i),this}insert(n,i,s){const a=this.has(i),l=a?this.size:this.size+1,u=C0(n),f=u>=0?Math.min(u,l-1):Math.max(l+u,0);if(a?Jn(this,un).indexOf(i)===f:f===this.size)return this.set(i,s),this;const h=Jn(this,un).filter(m=>m!==i);h.splice(f,0,i);const g=h.map(m=>[m,m===i?s:this.get(m)]);this.clear();for(const[m,_]of g)this.set(m,_);return this}with(n,i,s){const a=new nr(this);return a.insert(n,i,s),a}before(n){const i=Jn(this,un).indexOf(n)-1;if(!(i<0))return this.entryAt(i)}setBefore(n,i,s){const a=Jn(this,un).indexOf(n);if(a===-1)return this;const l=Jn(this,un).indexOf(i),u=l!==-1&&l<a?a-1:a;return this.insert(u,i,s)}after(n){let i=Jn(this,un).indexOf(n);if(i=i===-1||i===this.size-1?-1:i+1,i!==-1)return this.entryAt(i)}setAfter(n,i,s){const a=Jn(this,un).indexOf(n);if(a===-1)return this;const l=Jn(this,un).indexOf(i),u=l!==-1&&l<=a?a:a+1;return this.insert(u,i,s)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Ly(this,un,[]),super.clear()}delete(n){const i=super.delete(n);return i&&Jn(this,un).splice(Jn(this,un).indexOf(n),1),i}deleteAt(n){const i=this.keyAt(n);return i!==void 0?this.delete(i):!1}at(n){const i=Cp(Jn(this,un),n);if(i!==void 0)return this.get(i)}entryAt(n){const i=Cp(Jn(this,un),n);if(i!==void 0)return[i,this.get(i)]}indexOf(n){return Jn(this,un).indexOf(n)}keyAt(n){return Cp(Jn(this,un),n)}from(n,i){const s=this.indexOf(n);if(s===-1)return;let a=s+i;return a<0&&(a=0),a>=this.size&&(a=this.size-1),this.at(a)}keyFrom(n,i){const s=this.indexOf(n);if(s===-1)return;let a=s+i;return a<0&&(a=0),a>=this.size&&(a=this.size-1),this.keyAt(a)}find(n,i){let s=0;for(const a of this){if(Reflect.apply(n,i,[a,s,this]))return a;s++}}findIndex(n,i){let s=0;for(const a of this){if(Reflect.apply(n,i,[a,s,this]))return s;s++}return-1}filter(n,i){const s=[];let a=0;for(const l of this)Reflect.apply(n,i,[l,a,this])&&s.push(l),a++;return new nr(s)}map(n,i){const s=[];let a=0;for(const l of this)s.push([l[0],Reflect.apply(n,i,[l,a,this])]),a++;return new nr(s)}reduce(...n){const[i,s]=n,a=n.length>1;if(!a&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let l=0,u=s;for(const f of this)l===0&&!a?u=f:u=Reflect.apply(i,this,[u,f,l,this]),l++;return u}reduceRight(...n){const[i,s]=n,a=n.length>1;if(!a&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let l=s;for(let u=this.size-1;u>=0;u--){const f=this.entryAt(u);u===this.size-1&&!a?l=f:l=Reflect.apply(i,this,[l,f,u,this])}return l}sort(n){if(typeof n!="function")throw new TypeError("OrderedDict.sort requires a compare function");const i=[...this.entries()].sort(n);this.clear();for(const[s,a]of i)this.set(s,a);return this}toSorted(n){if(typeof n!="function")throw new TypeError("OrderedDict.toSorted requires a compare function");const i=[...this.entries()].sort(n);return new nr(i)}toReversed(){const n=new nr;for(let i=this.size-1;i>=0;i--){const s=this.keyAt(i),a=this.get(s);n.set(s,a)}return n}toSpliced(...n){const i=[...this.entries()];return i.splice(...n),new nr(i)}slice(n,i){const s=new nr;for(const a of Jn(this,un).slice(n,i))s.set(a,this.get(a));return s}every(n,i){let s=0;for(const a of this){if(!Reflect.apply(n,i,[a,s,this]))return!1;s++}return!0}some(n,i){let s=0;for(const a of this){if(Reflect.apply(n,i,[a,s,this]))return!0;s++}return!1}},un=new WeakMap,An(nr,"OrderedDict"),nr);function Cp(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=zA(e,t);return n===-1?void 0:e[n]}An(Cp,"at");function zA(e,t){const n=e.length,i=C0(t),s=i>=0?i:n+i;return s<0||s>=n?-1:s}An(zA,"toSafeIndex");function C0(e){return e!==e||e===0?0:Math.trunc(e)}An(C0,"toSafeInteger");function A8(e){const t=e+"CollectionProvider",[n,i]=uo(t),[s,a]=n(t);s.displayName=e+"CollectionStableContextProvider";const[l,u]=n(t);l.displayName=e+"CollectionStatefulContextProvider";const f=An(({state:T,...D})=>T?p.jsx(g,{...D,state:T}):p.jsx(h,{...D}),"CollectionProvider");f.displayName=t;const h=An(T=>{const D=R();return p.jsx(g,{...T,state:D})},"CollectionInit");h.displayName=e+"CollectionInit";const g=An(T=>{const{scope:D,children:L,state:ee}=T,U=w.useRef(null),[F,B]=w.useState(null),W=rn(U,B),[te,G]=ee,P=w.useRef(new qf),Z=w.useCallback(()=>{const $=P.current;return PA($)||$.sort(kp),$},[]);return w.useEffect(()=>{if(!F)return;const $=LA(()=>{G(ae=>{const j=ae.toSorted(kp);return j.some(([Le],z)=>ae.keyAt(z)!==Le)?j:ae})});return $.observe(F,{childList:!0,subtree:!0}),()=>{$.disconnect()}},[F,G]),p.jsx(s,{scope:D,collectionElementRef:W,collectionElementRefObject:U,getCollection:Z,setCollection:G,registryRef:P,children:p.jsx(l,{scope:D,collectionElement:F,collection:te,children:L})})},"CollectionProviderImpl");g.displayName=e+"CollectionProviderImpl";const m=e+"CollectionSlot",_=ra(m),b=w.forwardRef((T,D)=>{const{scope:L,children:ee}=T,U=a(m,L),F=rn(D,U.collectionElementRef);return p.jsx(_,{ref:F,children:ee})});b.displayName=m;const x=e+"CollectionItemSlot",S="data-radix-collection-item",C=ra(x),k=w.forwardRef((T,D)=>{const{scope:L,children:ee,...U}=T,F=w.useRef(null),B=a(x,L),{setCollection:W,registryRef:te}=B,G=w.useRef(U);MA(G.current,U)||(G.current=U);const P=G.current,Z=w.useCallback(j=>{const _e=te.current;j?_e.set(j,{...G.current,element:j}):F.current&&_e.delete(F.current)},[te]),$=rn(D,Z,F);ci(()=>{const j=F.current,_e=te.current;j&&_e.has(j)&&_e.set(j,{...P,element:j})},[P,te]);const ae=w.useRef(null);return w.useEffect(()=>{const j=F.current,_e=ae.current;(_e?.element??null)===j&&(!j||_e?.itemData===P)||(ae.current=j?{element:j,itemData:P}:null,W(Le=>{const z=new qf(Le);return _e&&_e.element!==j&&z.delete(_e.element),j&&z.set(j,{...P,element:j}),z.sort(kp)}))}),w.useEffect(()=>()=>{const j=ae.current;ae.current=null,j&&W(_e=>{if(!_e.has(j.element))return _e;const Le=new qf(_e);return Le.delete(j.element),Le})},[W]),p.jsx(C,{[S]:"",ref:$,children:ee})});k.displayName=x;function R(){return w.useState(new qf)}An(R,"useInitCollection");function N(T){const{collection:D}=u(e+"CollectionConsumer",T);return D}An(N,"useCollection");function A(T){const{getCollection:D}=a(e+"CollectionConsumer",T);return D}return An(A,"useGetCollection"),[{Provider:f,Slot:b,ItemSlot:k},{createCollectionScope:i,useCollection:N,useGetCollection:A,useInitCollection:R}]}An(A8,"createCollection");function MA(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),i=Object.keys(t);if(n.length!==i.length)return!1;for(const s of n)if(!Object.prototype.hasOwnProperty.call(t,s)||e[s]!==t[s])return!1;return!0}An(MA,"shallowEqual");function IA(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}An(IA,"isElementPreceding");function PA(e){let t;for(const n of e.keys()){if(t){const i=t.compareDocumentPosition(n);if(!(i&Node.DOCUMENT_POSITION_DISCONNECTED)&&i&Node.DOCUMENT_POSITION_PRECEDING)return!1}t=n}return!0}An(PA,"isInDocumentOrder");function kp(e,t){return!e[1].element||!t[1].element?0:IA(e[1].element,t[1].element)?-1:1}An(kp,"sortByDocumentPosition");function LA(e){return new MutationObserver(n=>{for(const i of n)if(i.type==="childList"){e();return}})}An(LA,"getChildListObserver");var O8=Object.defineProperty,j8=(e,t)=>O8(e,"name",{value:t,configurable:!0}),z8={LTR:"ltr"},M8=w.createContext(void 0);function k0(e){const t=w.useContext(M8);return e||t||z8.LTR}j8(k0,"useDirection");const I8=["top","right","bottom","left"],sa=Math.min,eo=Math.max,qp=Math.round,Wf=Math.floor,to=e=>({x:e,y:e}),P8={left:"right",right:"left",bottom:"top",top:"bottom"};function BA(e,t,n){return eo(e,sa(t,n))}function so(e,t){return typeof e=="function"?e(t):e}function oa(e){return e.split("-")[0]}function Kc(e){return e.split("-")[1]}function E0(e){return e==="x"?"y":"x"}function N0(e){return e==="y"?"height":"width"}function ms(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function R0(e){return E0(ms(e))}function L8(e,t,n){n===void 0&&(n=!1);const i=Kc(e),s=R0(e),a=N0(s);let l=s==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=Wp(l)),[l,Wp(l)]}function B8(e){const t=Wp(e);return[Sb(e),t,Sb(t)]}function Sb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const _2=["left","right"],b2=["right","left"],F8=["top","bottom"],U8=["bottom","top"];function H8(e,t,n){switch(e){case"top":case"bottom":return n?t?b2:_2:t?_2:b2;case"left":case"right":return t?F8:U8;default:return[]}}function $8(e,t,n,i){const s=Kc(e);let a=H8(oa(e),n==="start",i);return s&&(a=a.map(l=>l+"-"+s),t&&(a=a.concat(a.map(Sb)))),a}function Wp(e){const t=oa(e);return P8[t]+e.slice(t.length)}function q8(e){var t,n,i,s;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(i=e.bottom)!=null?i:0,left:(s=e.left)!=null?s:0}}function FA(e){return typeof e!="number"?q8(e):{top:e,right:e,bottom:e,left:e}}function Kp(e){const{x:t,y:n,width:i,height:s}=e;return{width:i,height:s,top:n,left:t,right:t+i,bottom:n+s,x:t,y:n}}function x2(e,t,n){let{reference:i,floating:s}=e;const a=ms(t),l=R0(t),u=N0(l),f=oa(t),h=a==="y",g=i.x+i.width/2-s.width/2,m=i.y+i.height/2-s.height/2,_=i[u]/2-s[u]/2;let b;switch(f){case"top":b={x:g,y:i.y-s.height};break;case"bottom":b={x:g,y:i.y+i.height};break;case"right":b={x:i.x+i.width,y:m};break;case"left":b={x:i.x-s.width,y:m};break;default:b={x:i.x,y:i.y}}const x=Kc(t);return x&&(b[l]+=_*(x==="end"?1:-1)*(n&&h?-1:1)),b}async function W8(e,t){var n;t===void 0&&(t={});const{x:i,y:s,platform:a,rects:l,elements:u,strategy:f}=e,{boundary:h="clippingAncestors",rootBoundary:g="viewport",elementContext:m="floating",altBoundary:_=!1,padding:b=0}=so(t,e),x=FA(b),C=u[_?m==="floating"?"reference":"floating":m],k=Kp(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(C)))==null||n?C:C.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(u.floating)),boundary:h,rootBoundary:g,strategy:f})),R=m==="floating"?{x:i,y:s,width:l.floating.width,height:l.floating.height}:l.reference,N=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u.floating)),A=await(a.isElement==null?void 0:a.isElement(N))&&await(a.getScale==null?void 0:a.getScale(N))||{x:1,y:1},I=Kp(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:R,offsetParent:N,strategy:f}):R);return{top:(k.top-I.top+x.top)/A.y,bottom:(I.bottom-k.bottom+x.bottom)/A.y,left:(k.left-I.left+x.left)/A.x,right:(I.right-k.right+x.right)/A.x}}const K8=50,V8=async(e,t,n)=>{const{placement:i="bottom",strategy:s="absolute",middleware:a=[],platform:l}=n,u=l.detectOverflow?l:{...l,detectOverflow:W8},f=await(l.isRTL==null?void 0:l.isRTL(t));let h=await l.getElementRects({reference:e,floating:t,strategy:s}),{x:g,y:m}=x2(h,i,f),_=i,b=0;const x={};for(let S=0;S<a.length;S++){const C=a[S];if(!C)continue;const{name:k,fn:R}=C,{x:N,y:A,data:I,reset:T}=await R({x:g,y:m,initialPlacement:i,placement:_,strategy:s,middlewareData:x,rects:h,platform:u,elements:{reference:e,floating:t}});g=N??g,m=A??m,x[k]={...x[k],...I},T&&b<K8&&(b++,typeof T=="object"&&(T.placement&&(_=T.placement),T.rects&&(h=T.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:s}):T.rects),{x:g,y:m}=x2(h,_,f)),S=-1)}return{x:g,y:m,placement:_,strategy:s,middlewareData:x}},G8=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:i,placement:s,rects:a,platform:l,elements:u,middlewareData:f}=t,{element:h,padding:g=0}=so(e,t)||{};if(h==null)return{};const m=FA(g),_={x:n,y:i},b=R0(s),x=N0(b),S=await l.getDimensions(h),C=b==="y",k=C?"top":"left",R=C?"bottom":"right",N=C?"clientHeight":"clientWidth",A=a.reference[x]+a.reference[b]-_[b]-a.floating[x],I=_[b]-a.reference[b],T=await(l.getOffsetParent==null?void 0:l.getOffsetParent(h));let D=T?T[N]:0;(!D||!await(l.isElement==null?void 0:l.isElement(T)))&&(D=u.floating[N]||a.floating[x]);const L=A/2-I/2,ee=D/2-S[x]/2-1,U=sa(m[k],ee),F=sa(m[R],ee),B=D-S[x]-F,W=D/2-S[x]/2+L,te=BA(U,W,B),G=!f.arrow&&Kc(s)!=null&&W!==te&&a.reference[x]/2-(W<U?U:F)-S[x]/2<0,P=G?W<U?W-U:W-B:0;return{[b]:_[b]+P,data:{[b]:te,centerOffset:W-te-P,...G&&{alignmentOffset:P}},reset:G}}}),Z8=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,i;const{placement:s,middlewareData:a,rects:l,initialPlacement:u,platform:f,elements:h}=t,{mainAxis:g=!0,crossAxis:m=!0,fallbackPlacements:_,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:S=!0,...C}=so(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const k=oa(s),R=ms(u),N=oa(u)===u,A=await(f.isRTL==null?void 0:f.isRTL(h.floating)),I=_||(N||!S?[Wp(u)]:B8(u)),T=x!=="none";!_&&T&&I.push(...$8(u,S,x,A));const D=[u,...I],L=await f.detectOverflow(t,C),ee=[];let U=((i=a.flip)==null?void 0:i.overflows)||[];if(g&&ee.push(L[k]),m){const te=L8(s,l,A);ee.push(L[te[0]],L[te[1]])}if(U=[...U,{placement:s,overflows:ee}],!ee.every(te=>te<=0)){var F,B;const te=(((F=a.flip)==null?void 0:F.index)||0)+1,G=D[te];if(G&&(!(m==="alignment"?R!==ms(G):!1)||U.every($=>ms($.placement)===R?$.overflows[0]>0:!0)))return{data:{index:te,overflows:U},reset:{placement:G}};let P=(B=U.filter(Z=>Z.overflows[0]<=0).sort((Z,$)=>Z.overflows[1]-$.overflows[1])[0])==null?void 0:B.placement;if(!P)switch(b){case"bestFit":{var W;const Z=(W=U.filter($=>{if(T){const ae=ms($.placement);return ae===R||ae==="y"}return!0}).map($=>[$.placement,$.overflows.filter(ae=>ae>0).reduce((ae,j)=>ae+j,0)]).sort(($,ae)=>$[1]-ae[1])[0])==null?void 0:W[0];Z&&(P=Z);break}case"initialPlacement":P=u;break}if(s!==P)return{reset:{placement:P}}}return{}}}};function S2(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function w2(e){return I8.some(t=>e[t]>=0)}const Y8=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:i}=t,{strategy:s="referenceHidden",...a}=so(e,t);switch(s){case"referenceHidden":{const l=await i.detectOverflow(t,{...a,elementContext:"reference"}),u=S2(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:w2(u)}}}case"escaped":{const l=await i.detectOverflow(t,{...a,altBoundary:!0}),u=S2(l,n.floating);return{data:{escapedOffsets:u,escaped:w2(u)}}}default:return{}}}}},UA=new Set(["left","top"]);async function X8(e,t){const{placement:n,platform:i,elements:s}=e,a=await(i.isRTL==null?void 0:i.isRTL(s.floating)),l=oa(n),u=Kc(n),f=ms(n)==="y",h=UA.has(l)?-1:1,g=a&&f?-1:1,m=so(t,e);let{mainAxis:_,crossAxis:b,alignmentAxis:x}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof x=="number"&&(b=u==="end"?x*-1:x),f?{x:b*g,y:_*h}:{x:_*h,y:b*g}}const Q8=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,i;const{x:s,y:a,placement:l,middlewareData:u}=t,f=await X8(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(i=u.arrow)!=null&&i.alignmentOffset?{}:{x:s+f.x,y:a+f.y,data:{...f,placement:l}}}}},J8=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:i,placement:s,platform:a}=t,{mainAxis:l=!0,crossAxis:u=!1,limiter:f={fn:R=>{let{x:N,y:A}=R;return{x:N,y:A}}},...h}=so(e,t),g={x:n,y:i},m=await a.detectOverflow(t,h),_=ms(s),b=E0(_);let x=g[b],S=g[_];const C=(R,N)=>BA(N+m[R==="y"?"top":"left"],N,N-m[R==="y"?"bottom":"right"]);l&&(x=C(b,x)),u&&(S=C(_,S));const k=f.fn({...t,[b]:x,[_]:S});return{...k,data:{x:k.x-n,y:k.y-i,enabled:{[b]:l,[_]:u}}}}}},e9=function(e){return e===void 0&&(e={}),{options:e,fn(t){var n,i;const{x:s,y:a,placement:l,rects:u,middlewareData:f}=t,{offset:h=0,mainAxis:g=!0,crossAxis:m=!0}=so(e,t),_={x:s,y:a},b=ms(l),x=E0(b);let S=_[x],C=_[b];const k=so(h,t),R=typeof k=="number"?{mainAxis:k,crossAxis:0}:{mainAxis:(n=k.mainAxis)!=null?n:0,crossAxis:(i=k.crossAxis)!=null?i:0};if(g){const I=x==="y"?"height":"width",T=u.reference[x]-u.floating[I]+R.mainAxis,D=u.reference[x]+u.reference[I]-R.mainAxis;S<T?S=T:S>D&&(S=D)}if(m){var N,A;const I=x==="y"?"width":"height",T=UA.has(oa(l)),D=u.reference[b]-u.floating[I]+(T&&((N=f.offset)==null?void 0:N[b])||0)+(T?0:R.crossAxis),L=u.reference[b]+u.reference[I]+(T?0:((A=f.offset)==null?void 0:A[b])||0)-(T?R.crossAxis:0);C<D?C=D:C>L&&(C=L)}return{[x]:S,[b]:C}}}},t9=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...u}=so(e,t),f=await s.detectOverflow(t,u),h=oa(n),g=Kc(n),m=ms(n)==="y",{width:_,height:b}=i.floating;let x,S;h==="top"||h==="bottom"?(x=h,S=g===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(S=h,x=g==="end"?"top":"bottom");const C=b-f.top-f.bottom,k=_-f.left-f.right,R=sa(b-f[x],C),N=sa(_-f[S],k),A=t.middlewareData.shift,I=!A;let T=R,D=N;A!=null&&A.enabled.x&&(D=k),A!=null&&A.enabled.y&&(T=C),I&&!g&&(m?D=_-2*eo(f.left,f.right):T=b-2*eo(f.top,f.bottom)),await l({...t,availableWidth:D,availableHeight:T});const L=await s.getDimensions(a.floating);return _!==L.width||b!==L.height?{reset:{rects:!0}}:{}}}};function wm(){return typeof window<"u"}function Vc(e){return HA(e)?(e.nodeName||"").toLowerCase():"#document"}function Mi(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ho(e){var t;return(t=(HA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function HA(e){return wm()?e instanceof Node||e instanceof Mi(e).Node:!1}function bs(e){return wm()?e instanceof Element||e instanceof Mi(e).Element:!1}function fa(e){return wm()?e instanceof HTMLElement||e instanceof Mi(e).HTMLElement:!1}function C2(e){return!wm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Mi(e).ShadowRoot}function Cm(e){const{overflow:t,overflowX:n,overflowY:i,display:s}=xs(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+n)&&s!=="inline"&&s!=="contents"}function n9(e){return/^(table|td|th)$/.test(Vc(e))}function km(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const i9=/transform|translate|scale|rotate|perspective|filter/,r9=/paint|layout|strict|content/,qa=e=>!!e&&e!=="none";let Zy;function T0(e){const t=bs(e)?xs(e):e;return qa(t.transform)||qa(t.translate)||qa(t.scale)||qa(t.rotate)||qa(t.perspective)||!D0()&&(qa(t.backdropFilter)||qa(t.filter))||i9.test(t.willChange||"")||r9.test(t.contain||"")}function s9(e){let t=al(e);for(;fa(t)&&!Pd(t);){if(T0(t))return t;if(km(t))return null;t=al(t)}return null}function D0(){return Zy==null&&(Zy=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Zy}function Pd(e){return/^(html|body|#document)$/.test(Vc(e))}function xs(e){return Mi(e).getComputedStyle(e)}function Em(e){return bs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function al(e){if(Vc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||C2(e)&&e.host||ho(e);return C2(t)?t.host:t}function $A(e){const t=al(e);return Pd(t)?(e.ownerDocument||e).body:fa(t)&&Cm(t)?t:$A(t)}function Ld(e,t,n){var i;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=$A(e),a=s===((i=e.ownerDocument)==null?void 0:i.body),l=Mi(s);if(a){const u=wb(l);return t.concat(l,l.visualViewport||[],Cm(s)?s:[],u&&n?Ld(u):[])}else return t.concat(s,Ld(s,[],n))}function wb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function qA(e){const t=xs(e);let n=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const s=fa(e),a=s?e.offsetWidth:n,l=s?e.offsetHeight:i,u=qp(n)!==a||qp(i)!==l;return u&&(n=a,i=l),{width:n,height:i,$:u}}function A0(e){return bs(e)?e:e.contextElement}function Nc(e){const t=A0(e);if(!fa(t))return to(1);const n=t.getBoundingClientRect(),{width:i,height:s,$:a}=qA(t);let l=(a?qp(n.width):n.width)/i,u=(a?qp(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const o9=to(0);function WA(e){const t=Mi(e);return!D0()||!t.visualViewport?o9:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function a9(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Mi(e)}function ll(e,t,n,i){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=A0(e);let l=to(1);t&&(i?bs(i)&&(l=Nc(i)):l=Nc(e));const u=a9(a,n,i)?WA(a):to(0);let f=(s.left+u.x)/l.x,h=(s.top+u.y)/l.y,g=s.width/l.x,m=s.height/l.y;if(a&&i){const _=Mi(a),b=bs(i)?Mi(i):i;let x=_,S=wb(x);for(;S&&b!==x;){const C=Nc(S),k=S.getBoundingClientRect(),R=xs(S),N=k.left+(S.clientLeft+parseFloat(R.paddingLeft))*C.x,A=k.top+(S.clientTop+parseFloat(R.paddingTop))*C.y;f*=C.x,h*=C.y,g*=C.x,m*=C.y,f+=N,h+=A,x=Mi(S),S=wb(x)}}return Kp({width:g,height:m,x:f,y:h})}function Nm(e,t){const n=Em(e).scrollLeft;return t?t.left+n:ll(ho(e)).left+n}function KA(e,t){const n=e.getBoundingClientRect(),i=n.left+t.scrollLeft-Nm(e,n),s=n.top+t.scrollTop;return{x:i,y:s}}function l9(e){let{elements:t,rect:n,offsetParent:i,strategy:s}=e;const a=s==="fixed",l=ho(i),u=t?km(t.floating):!1;if(i===l||u&&a)return n;let f={scrollLeft:0,scrollTop:0},h=to(1);const g=to(0),m=fa(i);if((m||!a)&&((Vc(i)!=="body"||Cm(l))&&(f=Em(i)),m)){const b=ll(i);h=Nc(i),g.x=b.x+i.clientLeft,g.y=b.y+i.clientTop}const _=l&&!m&&!a?KA(l,f):to(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-f.scrollLeft*h.x+g.x+_.x,y:n.y*h.y-f.scrollTop*h.y+g.y+_.y}}function c9(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function u9(e){const t=Em(e),n=e.ownerDocument.body,i=eo(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),s=eo(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let a=-t.scrollLeft+Nm(e);const l=-t.scrollTop;return xs(n).direction==="rtl"&&(a+=eo(e.clientWidth,n.clientWidth)-i),{width:i,height:s,x:a,y:l}}const d9=25;function h9(e,t,n){n===void 0&&(n="viewport");const i=n==="layoutViewport",s=Mi(e),a=ho(e),l=s.visualViewport;let u=a.clientWidth,f=a.clientHeight,h=0,g=0;if(l){const _=!D0()||t==="fixed";i?_||(h=-l.offsetLeft,g=-l.offsetTop):(u=l.width,f=l.height,_&&(h=l.offsetLeft,g=l.offsetTop))}if(Nm(a)<=0){const _=a.ownerDocument,b=_.body,x=getComputedStyle(b),S=_.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,C=Math.abs(a.clientWidth-b.clientWidth-S),k=getComputedStyle(a).scrollbarGutter==="stable both-edges"?C/2:C;k<=d9&&(u-=k)}return{width:u,height:f,x:h,y:g}}function f9(e,t){const n=ll(e,!0,t==="fixed"),i=n.top+e.clientTop,s=n.left+e.clientLeft,a=Nc(e),l=e.clientWidth*a.x,u=e.clientHeight*a.y,f=s*a.x,h=i*a.y;return{width:l,height:u,x:f,y:h}}function k2(e,t,n){let i;if(t==="viewport"||t==="layoutViewport")i=h9(e,n,t);else if(t==="document")i=u9(ho(e));else if(bs(t))i=f9(t,n);else{const s=WA(e);i={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Kp(i)}function p9(e,t){const n=t.get(e);if(n)return n;let i=Ld(e,[],!1).filter(u=>bs(u)&&Vc(u)!=="body"),s=null;const a=xs(e).position==="fixed";let l=a?al(e):e;for(;bs(l)&&!Pd(l);){const u=xs(l),f=T0(l),h=s?s.position:a?"fixed":"";!f&&(h==="fixed"||h==="absolute"&&u.position==="static")?i=i.filter(m=>m!==l):s=u,l=al(l)}return t.set(e,i),i}function m9(e){let{element:t,boundary:n,rootBoundary:i,strategy:s}=e;const l=[...n==="clippingAncestors"?km(t)?[]:p9(t,this._c):[].concat(n),i],u=k2(t,l[0],s);let f=u.top,h=u.right,g=u.bottom,m=u.left;for(let _=1;_<l.length;_++){const b=k2(t,l[_],s);f=eo(b.top,f),h=sa(b.right,h),g=sa(b.bottom,g),m=eo(b.left,m)}return{width:h-m,height:g-f,x:m,y:f}}function g9(e){const{width:t,height:n}=qA(e);return{width:t,height:n}}function v9(e,t,n){const i=fa(t),s=ho(t),a=n==="fixed",l=ll(e,!0,a,t);let u={scrollLeft:0,scrollTop:0};const f=to(0);if((i||!a)&&((Vc(t)!=="body"||Cm(s))&&(u=Em(t)),i)){const _=ll(t,!0,a,t);f.x=_.x+t.clientLeft,f.y=_.y+t.clientTop}!i&&s&&(f.x=Nm(s));const h=s&&!i&&!a?KA(s,u):to(0),g=l.left+u.scrollLeft-f.x-h.x,m=l.top+u.scrollTop-f.y-h.y;return{x:g,y:m,width:l.width,height:l.height}}function Yy(e){return xs(e).position==="static"}function E2(e,t){if(!fa(e)||xs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ho(e)===n&&(n=n.ownerDocument.body),n}function VA(e,t){const n=Mi(e);if(km(e))return n;if(!fa(e)){let s=al(e);for(;s&&!Pd(s);){if(bs(s)&&!Yy(s))return s;s=al(s)}return n}let i=E2(e,t);for(;i&&n9(i)&&Yy(i);)i=E2(i,t);return i&&Pd(i)&&Yy(i)&&!T0(i)?n:i||s9(e)||n}const y9=async function(e){const t=this.getOffsetParent||VA,n=this.getDimensions,i=await n(e.floating);return{reference:v9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function _9(e){return xs(e).direction==="rtl"}const b9={convertOffsetParentRelativeRectToViewportRelativeRect:l9,getDocumentElement:ho,getClippingRect:m9,getOffsetParent:VA,getElementRects:y9,getClientRects:c9,getDimensions:g9,getScale:Nc,isElement:bs,isRTL:_9};function GA(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function x9(e,t,n){let i=null,s;const a=ho(e);function l(){var g;clearTimeout(s),(g=i)==null||g.disconnect(),i=null}function u(g,m){g===void 0&&(g=!1),m===void 0&&(m=1),l();const _=e.getBoundingClientRect(),{left:b,top:x,width:S,height:C}=_;if(g||t(),!S||!C)return;const k=Wf(x),R=Wf(a.clientWidth-(b+S)),N=Wf(a.clientHeight-(x+C)),A=Wf(b),T={rootMargin:-k+"px "+-R+"px "+-N+"px "+-A+"px",threshold:eo(0,sa(1,m))||1};let D=!0;function L(ee){const U=ee[0].intersectionRatio;if(!GA(_,e.getBoundingClientRect()))return u();if(U!==m){if(!D)return u();U?u(!1,U):s=setTimeout(()=>{u(!1,1e-7)},1e3)}D=!1}try{i=new IntersectionObserver(L,{...T,root:a.ownerDocument})}catch{i=new IntersectionObserver(L,T)}i.observe(e)}const f=Mi(e),h=()=>u(n);return f.addEventListener("resize",h),u(!0),()=>{f.removeEventListener("resize",h),l()}}function S9(e,t,n,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=i,h=A0(e),g=s||a?[...h?Ld(h):[],...t?Ld(t):[]]:[];g.forEach(k=>{s&&k.addEventListener("scroll",n),a&&k.addEventListener("resize",n)});const m=h&&u?x9(h,n,a):null;let _=-1,b=null;l&&(b=new ResizeObserver(k=>{let[R]=k;R&&R.target===h&&b&&t&&(b.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var N;(N=b)==null||N.observe(t)})),n()}),h&&!f&&b.observe(h),t&&b.observe(t));let x,S=f?ll(e):null;f&&C();function C(){const k=ll(e);S&&!GA(S,k)&&n(),S=k,x=requestAnimationFrame(C)}return n(),()=>{var k;g.forEach(R=>{s&&R.removeEventListener("scroll",n),a&&R.removeEventListener("resize",n)}),m?.(),(k=b)==null||k.disconnect(),b=null,f&&cancelAnimationFrame(x)}}const w9=Q8,C9=J8,k9=Z8,E9=t9,N9=Y8,N2=G8,R9=e9,T9=(e,t,n)=>{const i=new Map,s=n??{},a={...b9,...s.platform,_c:i};return V8(e,t,{...s,platform:a})};var D9=typeof document<"u",A9=function(){},Ep=D9?w.useLayoutEffect:A9;function Vp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,i,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(i=n;i--!==0;)if(!Vp(e[i],t[i]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(t,s[i]))return!1;for(i=n;i--!==0;){const a=s[i];if(!(a==="_owner"&&e.$$typeof)&&!Vp(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function ZA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function R2(e,t){const n=ZA(e);return Math.round(t*n)/n}function Xy(e){const t=w.useRef(e);return Ep(()=>{t.current=e}),t}function O9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:i=[],platform:s,elements:{reference:a,floating:l}={},transform:u=!0,whileElementsMounted:f,open:h}=e,[g,m]=w.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[_,b]=w.useState(i);Vp(_,i)||b(i);const[x,S]=w.useState(null),[C,k]=w.useState(null),R=w.useCallback($=>{$!==T.current&&(T.current=$,S($))},[]),N=w.useCallback($=>{$!==D.current&&(D.current=$,k($))},[]),A=a||x,I=l||C,T=w.useRef(null),D=w.useRef(null),L=w.useRef(g),ee=f!=null,U=Xy(f),F=Xy(s),B=Xy(h),W=w.useCallback(()=>{if(!T.current||!D.current)return;const $={placement:t,strategy:n,middleware:_};F.current&&($.platform=F.current),T9(T.current,D.current,$).then(ae=>{const j={...ae,isPositioned:B.current!==!1};te.current&&!Vp(L.current,j)&&(L.current=j,yl.flushSync(()=>{m(j)}))})},[_,t,n,F,B]);Ep(()=>{h===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,m($=>({...$,isPositioned:!1})))},[h]);const te=w.useRef(!1);Ep(()=>(te.current=!0,()=>{te.current=!1}),[]),Ep(()=>{if(A&&(T.current=A),I&&(D.current=I),A&&I){if(U.current)return U.current(A,I,W);W()}},[A,I,W,U,ee]);const G=w.useMemo(()=>({reference:T,floating:D,setReference:R,setFloating:N}),[R,N]),P=w.useMemo(()=>({reference:A,floating:I}),[A,I]),Z=w.useMemo(()=>{const $={position:n,left:0,top:0};if(!P.floating)return $;const ae=R2(P.floating,g.x),j=R2(P.floating,g.y);return u?{...$,transform:"translate("+ae+"px, "+j+"px)",...ZA(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ae,top:j}},[n,u,P.floating,g.x,g.y]);return w.useMemo(()=>({...g,update:W,refs:G,elements:P,floatingStyles:Z}),[g,W,G,P,Z])}const j9=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:i,padding:s}=typeof e=="function"?e(n):e;return i&&t(i)?i.current!=null?N2({element:i.current,padding:s}).fn(n):{}:i?N2({element:i,padding:s}).fn(n):{}}}},z9=(e,t)=>{const n=w9(e);return{name:n.name,fn:n.fn,options:[e,t]}},M9=(e,t)=>{const n=C9(e);return{name:n.name,fn:n.fn,options:[e,t]}},I9=(e,t)=>({fn:R9(e).fn,options:[e,t]}),P9=(e,t)=>{const n=k9(e);return{name:n.name,fn:n.fn,options:[e,t]}},L9=(e,t)=>{const n=E9(e);return{name:n.name,fn:n.fn,options:[e,t]}},B9=(e,t)=>{const n=N9(e);return{name:n.name,fn:n.fn,options:[e,t]}},F9=(e,t)=>{const n=j9(e);return{name:n.name,fn:n.fn,options:[e,t]}};var U9=Object.defineProperty,H9=(e,t)=>U9(e,"name",{value:t,configurable:!0}),$9=w.forwardRef(H9(function(t,n){const{children:i,width:s=10,height:a=5,...l}=t;return p.jsx(Cn.svg,{...l,ref:n,width:s,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?i:p.jsx("polygon",{points:"0,0 30,0 15,10"})})},"Arrow")),q9=Object.defineProperty,W9=(e,t)=>q9(e,"name",{value:t,configurable:!0});function YA(e){const[t,n]=w.useState(void 0);return ci(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let i=0;const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const l=a[0];window.cancelAnimationFrame(i),i=window.requestAnimationFrame(()=>{let u,f;if("borderBoxSize"in l){const h=l.borderBoxSize,g=Array.isArray(h)?h[0]:h;u=g.inlineSize,f=g.blockSize}else u=e.offsetWidth,f=e.offsetHeight;n({width:u,height:f})})});return s.observe(e,{box:"border-box"}),()=>{window.cancelAnimationFrame(i),s.unobserve(e)}}else n(void 0)},[e]),t}W9(YA,"useSize");var K9=Object.defineProperty,no=(e,t)=>K9(e,"name",{value:t,configurable:!0}),T2={Partial:"partial"},D2={Optimized:"optimized",Always:"always"},XA="Popper",[QA,Rm]=uo(XA),[V9,JA]=QA(XA),eO=no(e=>{const{__scopePopper:t,children:n}=e,[i,s]=w.useState(null),[a,l]=w.useState(void 0);return p.jsx(V9,{scope:t,anchor:i,onAnchorChange:s,placementState:a,setPlacementState:l,children:n})},"Popper"),G9="PopperAnchor",tO=w.forwardRef(no(function(t,n){const{__scopePopper:i,virtualRef:s,...a}=t,l=JA(G9,i),u=w.useRef(null),f=l.onAnchorChange,h=w.useCallback(S=>{u.current=S,S&&f(S)},[f]),g=rn(n,h),m=w.useRef(null);w.useEffect(()=>{if(!s)return;const S=m.current;m.current=s.current,S!==m.current&&f(m.current)});const _=l.placementState&&Tm(l.placementState),b=_?.[0],x=_?.[1];return s?null:p.jsx(Cn.div,{"data-radix-popper-side":b,"data-radix-popper-align":x,...a,ref:g})},"PopperAnchor")),nO="PopperContent",[Z9,Y9]=QA(nO),iO=w.forwardRef(no(function(t,n){const{__scopePopper:i,side:s="bottom",sideOffset:a=0,align:l="center",alignOffset:u=0,arrowPadding:f=0,avoidCollisions:h=!0,collisionBoundary:g=[],collisionPadding:m=0,sticky:_=T2.Partial,hideWhenDetached:b=!1,updatePositionStrategy:x=D2.Optimized,onPlaced:S,...C}=t,k=JA(nO,i),[R,N]=w.useState(null),A=rn(n,N),[I,T]=w.useState(null),D=YA(I),L=D?.width??0,ee=D?.height??0,U=s+(l!=="center"?"-"+l:""),F=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},B=Array.isArray(g)?g:[g],W=B.length>0,te={padding:F,boundary:B.filter(rO),altBoundary:W},{refs:G,floatingStyles:P,placement:Z,isPositioned:$,middlewareData:ae}=O9({strategy:"fixed",placement:U,whileElementsMounted:no((...ve)=>S9(...ve,{animationFrame:x===D2.Always}),"whileElementsMounted"),elements:{reference:k.anchor},middleware:[z9({mainAxis:a+ee,alignmentAxis:u}),h&&M9({mainAxis:!0,crossAxis:!1,..._===T2.Partial?{limiter:I9()}:{},...te}),h&&P9({...te}),L9({...te,apply:no(({elements:ve,rects:Re,availableWidth:re,availableHeight:he})=>{const{width:J,height:Ie}=Re.reference,Ze=ve.floating.style;Ze.setProperty("--radix-popper-available-width",`${re}px`),Ze.setProperty("--radix-popper-available-height",`${he}px`),Ze.setProperty("--radix-popper-anchor-width",`${J}px`),Ze.setProperty("--radix-popper-anchor-height",`${Ie}px`)},"apply")}),I&&F9({element:I,padding:f}),eF({arrowWidth:L,arrowHeight:ee}),b&&B9(W?{strategy:"referenceHidden",...te}:{strategy:"referenceHidden",padding:te.padding,altBoundary:te.altBoundary})]}),j=k.setPlacementState;ci(()=>(j(Z),()=>{j(void 0)}),[Z,j]);const[_e,Le]=Tm(Z),z=_s(S);ci(()=>{$&&z?.()},[$,z]);const M=ae.arrow?.x,K=ae.arrow?.y,ne=ae.arrow?.centerOffset!==0,[me,Ee]=w.useState();return ci(()=>{R&&Ee(window.getComputedStyle(R).zIndex)},[R]),p.jsx("div",{ref:G.setFloating,"data-radix-popper-content-wrapper":"",style:{...P,transform:$?P.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:me,"--radix-popper-transform-origin":[ae.transformOrigin?.x,ae.transformOrigin?.y].join(" "),...ae.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:p.jsx(Z9,{scope:i,placedSide:_e,placedAlign:Le,onArrowChange:T,arrowX:M,arrowY:K,shouldHideArrow:ne,children:p.jsx(Cn.div,{"data-side":_e,"data-align":Le,...C,ref:A,style:{...C.style,animation:$?C.style?.animation:"none"}})})})},"PopperContent")),X9="PopperArrow",Q9={top:"bottom",right:"left",bottom:"top",left:"right"},J9=w.forwardRef(no(function(t,n){const{__scopePopper:i,...s}=t,a=Y9(X9,i),l=Q9[a.placedSide];return p.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:p.jsx($9,{...s,ref:n,style:{...s.style,display:"block"}})})},"PopperArrow"));function rO(e){return e!==null}no(rO,"isNotNull");var eF=no(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:i,middlewareData:s}=t,l=s.arrow?.centerOffset!==0,u=l?0:e.arrowWidth,f=l?0:e.arrowHeight,[h,g]=Tm(n),m={start:"0%",center:"50%",end:"100%"}[g],_=(s.arrow?.x??0)+u/2,b=(s.arrow?.y??0)+f/2;let x="",S="";return h==="bottom"?(x=l?m:`${_}px`,S=`${-f}px`):h==="top"?(x=l?m:`${_}px`,S=`${i.floating.height+f}px`):h==="right"?(x=`${-f}px`,S=l?m:`${b}px`):h==="left"&&(x=`${i.floating.width+f}px`,S=l?m:`${b}px`),{data:{x,y:S}}}}),"transformOrigin");function Tm(e){const[t,n="center"]=e.split("-");return[t,n]}no(Tm,"getSideAndAlignFromPlacement");var tF=Object.defineProperty,O0=(e,t)=>tF(e,"name",{value:t,configurable:!0}),Qy=!1;function sO(){const[e,t]=w.useState(Qy);return w.useEffect(()=>{Qy||(Qy=!0,t(!0))},[]),e}O0(sO,"useIsHydrated");var oO=vl[" useSyncExternalStore ".trim().toString()];function aO(){return()=>{}}O0(aO,"subscribe");function lO(){return oO(aO,()=>!0,()=>!1)}O0(lO,"useIsHydratedModern");var nF=typeof oO=="function"?lO:sO,iF=Object.defineProperty,_l=(e,t)=>iF(e,"name",{value:t,configurable:!0}),Jy="rovingFocusGroup.onEntryFocus",rF={bubbles:!1,cancelable:!0},Dm="RovingFocusGroup",[Cb,cO,sF]=w0(Dm),[oF,uO]=uo(Dm,[sF]),A2={Vertical:"vertical",Horizontal:"horizontal"},aF={RTL:"rtl"},[lF,cF]=oF(Dm),uF=w.forwardRef(_l(function(t,n){return p.jsx(Cb.Provider,{scope:t.__scopeRovingFocusGroup,children:p.jsx(Cb.Slot,{scope:t.__scopeRovingFocusGroup,children:p.jsx(dF,{...t,ref:n})})})},"RovingFocusGroup")),dF=w.forwardRef(_l(function(t,n){const{__scopeRovingFocusGroup:i,orientation:s,loop:a=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:f,onCurrentTabStopIdChange:h,onEntryFocus:g,preventScrollOnEntryFocus:m=!1,..._}=t,b=w.useRef(null),x=rn(n,b),S=k0(l),[C,k]=Gd({prop:u,defaultProp:f??null,onChange:h,caller:Dm}),[R,N]=w.useState(!1),A=_s(g),I=cO(i),T=w.useRef(!1),[D,L]=w.useState(0);return w.useEffect(()=>{const ee=b.current;if(ee)return ee.addEventListener(Jy,A),()=>ee.removeEventListener(Jy,A)},[A]),p.jsx(lF,{scope:i,orientation:s,dir:S,loop:a,currentTabStopId:C,onItemFocus:w.useCallback(ee=>k(ee),[k]),onItemShiftTab:w.useCallback(()=>N(!0),[]),onFocusableItemAdd:w.useCallback(()=>L(ee=>ee+1),[]),onFocusableItemRemove:w.useCallback(()=>L(ee=>ee-1),[]),children:p.jsx(Cn.div,{tabIndex:R||D===0?-1:0,"data-orientation":s,..._,ref:x,style:{outline:"none",...t.style},onMouseDown:lt(t.onMouseDown,()=>{T.current=!0}),onFocus:lt(t.onFocus,ee=>{const U=!T.current;if(ee.target===ee.currentTarget&&U&&!R){const F=new CustomEvent(Jy,rF);if(ee.currentTarget.dispatchEvent(F),!F.defaultPrevented){const B=I().filter(Z=>Z.focusable),W=B.find(Z=>Z.active),te=B.find(Z=>Z.id===C),P=[W,te,...B].filter(Boolean).map(Z=>Z.ref.current);j0(P,m)}}T.current=!1}),onBlur:lt(t.onBlur,()=>N(!1))})})},"RovingFocusGroupImpl")),hF="RovingFocusGroupItem",fF=w.forwardRef(_l(function(t,n){const{__scopeRovingFocusGroup:i,focusable:s=!0,active:a=!1,tabStopId:l,children:u,...f}=t,h=ea(),g=l||h,m=cF(hF,i),_=m.currentTabStopId===g,b=cO(i),{onFocusableItemAdd:x,onFocusableItemRemove:S,currentTabStopId:C}=m,k=nF();return ci(()=>{if(!(!k||!s))return x(),()=>S()},[k,s,x,S]),w.useEffect(()=>{if(!(k||!s))return x(),()=>S()},[k,s,x,S]),p.jsx(Cb.ItemSlot,{scope:i,id:g,focusable:s,active:a,children:p.jsx(Cn.span,{tabIndex:_?0:-1,"data-orientation":m.orientation,...f,ref:n,onMouseDown:lt(t.onMouseDown,R=>{s?m.onItemFocus(g):R.preventDefault()}),onFocus:lt(t.onFocus,()=>m.onItemFocus(g)),onKeyDown:lt(t.onKeyDown,R=>{if(R.key==="Tab"&&R.shiftKey){m.onItemShiftTab();return}if(R.target!==R.currentTarget)return;const N=hO(R,m.orientation,m.dir);if(N!==void 0){if(R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;R.preventDefault();let I=b().filter(T=>T.focusable).map(T=>T.ref.current);if(N==="last")I.reverse();else if(N==="prev"||N==="next"){N==="prev"&&I.reverse();const T=I.indexOf(R.currentTarget);I=m.loop?fO(I,T+1):I.slice(T+1)}setTimeout(()=>j0(I))}}),children:typeof u=="function"?u({isCurrentTabStop:_,hasTabStop:C!=null}):u})})},"RovingFocusGroupItem")),pF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function dO(e,t){return t!==aF.RTL?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}_l(dO,"getDirectionAwareKey");function hO(e,t,n){const i=dO(e.key,n);if(!(t===A2.Vertical&&["ArrowLeft","ArrowRight"].includes(i))&&!(t===A2.Horizontal&&["ArrowUp","ArrowDown"].includes(i)))return pF[i]}_l(hO,"getFocusIntent");function j0(e,t=!1){const n=document.activeElement;for(const i of e)if(i===n||(i.focus({preventScroll:t}),document.activeElement!==n))return}_l(j0,"focusFirst");function fO(e,t){return e.map((n,i)=>e[(t+i)%e.length])}_l(fO,"wrapArray");var mF=Object.defineProperty,vt=(e,t)=>mF(e,"name",{value:t,configurable:!0}),gF=["Enter"," "],vF=["ArrowDown","PageUp","Home"],pO=["ArrowUp","PageDown","End"],yF=[...vF,...pO],Am="Menu",[kb,_F,bF]=w0(Am),[bl,mO]=uo(Am,[bF,Rm,uO]),z0=Rm(),gO=uO(),[xF,Zd]=bl(Am),[SF,M0]=bl(Am),wF=vt(e=>{const{__scopeMenu:t,open:n=!1,children:i,dir:s,onOpenChange:a,modal:l=!0}=e,u=z0(t),[f,h]=w.useState(null),g=w.useRef(!1),m=_s(a),_=k0(s);return w.useEffect(()=>{const b=vt(()=>{g.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},"handleKeyDown"),x=vt(()=>g.current=!1,"handlePointer");return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),w.useEffect(()=>{if(!n)return;const b=vt(()=>m(!1),"handleBlur");return window.addEventListener("blur",b),()=>window.removeEventListener("blur",b)},[n,m]),p.jsx(eO,{...u,children:p.jsx(xF,{scope:t,open:n,onOpenChange:m,content:f,onContentChange:h,children:p.jsx(SF,{scope:t,onClose:w.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:g,dir:_,modal:l,children:i})})})},"Menu"),CF=w.forwardRef(vt(function(t,n){const{__scopeMenu:i,...s}=t,a=z0(i);return p.jsx(tO,{...a,...s,ref:n})},"MenuAnchor")),vO="MenuPortal",[kF,EF]=bl(vO,{forceMount:void 0}),NF=vt(e=>{const{__scopeMenu:t,forceMount:n,children:i,container:s}=e,a=Zd(vO,t);return p.jsx(kF,{scope:t,forceMount:n,children:p.jsx(ha,{present:n||a.open,children:p.jsx(v0,{asChild:!0,container:s,children:i})})})},"MenuPortal"),ta="MenuContent",[RF,yO]=bl(ta),TF=w.forwardRef(vt(function(t,n){const i=EF(ta,t.__scopeMenu),{forceMount:s=i.forceMount,...a}=t,l=Zd(ta,t.__scopeMenu),u=M0(ta,t.__scopeMenu);return p.jsx(kb.Provider,{scope:t.__scopeMenu,children:p.jsx(ha,{present:s||l.open,children:p.jsx(kb.Slot,{scope:t.__scopeMenu,children:u.modal?p.jsx(DF,{...a,ref:n}):p.jsx(AF,{...a,ref:n})})})})},"MenuContent")),DF=w.forwardRef(vt(function(t,n){const i=Zd(ta,t.__scopeMenu),s=w.useRef(null),a=rn(n,s);return w.useEffect(()=>{const l=s.current;if(l)return RA(l)},[]),p.jsx(_O,{...t,ref:a,trapFocus:i.open,disableOutsidePointerEvents:i.open,disableOutsideScroll:!0,onFocusOutside:lt(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>i.onOpenChange(!1)})},"MenuRootContentModal")),AF=w.forwardRef(vt(function(t,n){const i=Zd(ta,t.__scopeMenu);return p.jsx(_O,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>i.onOpenChange(!1)})},"MenuRootContentNonModal")),OF=ra("MenuContent.ScrollLock"),_O=w.forwardRef(vt(function(t,n){const{__scopeMenu:i,loop:s=!1,trapFocus:a,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:f,onEntryFocus:h,onEscapeKeyDown:g,onPointerDownOutside:m,onFocusOutside:_,onInteractOutside:b,onDismiss:x,disableOutsideScroll:S,...C}=t,k=Zd(ta,i),R=M0(ta,i),N=z0(i),A=gO(i),I=_F(i),[T,D]=w.useState(null),L=w.useRef(null),[ee,U]=w.useState(null);m0(ee);const{nodes:F,registry:B}=p0(),W=!!(a||S),te=rn(n,L,k.onContentChange,U),G=w.useRef(0),P=w.useRef(""),Z=w.useRef(0),$=w.useRef(null),ae=w.useRef("right"),j=w.useRef(0),_e=w.useMemo(()=>S?[L,...F.map(ne=>({current:ne}))]:[],[L,F,S]),Le=S?_0:w.Fragment,z=S?{as:OF,allowPinchZoom:!0,shards:_e}:void 0,M=vt(ne=>{const me=P.current+ne,Ee=I().filter(Ze=>!Ze.disabled),ve=document.activeElement,Re=Ee.find(Ze=>Ze.ref.current===ve)?.textValue,re=Ee.map(Ze=>Ze.textValue),he=kO(re,me,Re),J=Ee.find(Ze=>Ze.textValue===he)?.ref.current;function Ie(Ze){P.current=Ze,window.clearTimeout(G.current),Ze!==""&&(G.current=window.setTimeout(()=>Ie(""),1e3))}vt(Ie,"updateSearch"),Ie(me),J&&setTimeout(()=>J.focus())},"handleTypeaheadSearch");w.useEffect(()=>()=>window.clearTimeout(G.current),[]),xm();const K=w.useCallback(ne=>ae.current===$.current?.side&&NO(ne,$.current?.area),[]);return p.jsx(RF,{scope:i,searchRef:P,onItemEnter:w.useCallback(ne=>{K(ne)&&ne.preventDefault()},[K]),onItemLeave:w.useCallback(ne=>{K(ne)||(L.current?.focus(),D(null))},[K]),onTriggerLeave:w.useCallback(ne=>{K(ne)&&ne.preventDefault()},[K]),pointerGraceTimerRef:Z,onPointerGraceIntentChange:w.useCallback(ne=>{$.current=ne},[]),children:p.jsx(f0,{registry:W?B:null,children:p.jsx(Le,{...z,children:p.jsx(lA,{asChild:!0,trapped:a,branches:F,onMountAutoFocus:lt(l,ne=>{ne.preventDefault(),L.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:p.jsx(d0,{asChild:!0,disableOutsidePointerEvents:f,onEscapeKeyDown:g,onPointerDownOutside:m,onFocusOutside:_,onInteractOutside:b,onDismiss:x,children:p.jsx(uF,{asChild:!0,...A,dir:R.dir,orientation:"vertical",loop:s,currentTabStopId:T,onCurrentTabStopIdChange:D,onEntryFocus:lt(h,ne=>{R.isUsingKeyboardRef.current||ne.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(iO,{role:"menu","aria-orientation":"vertical","data-state":SO(k.open),"data-radix-menu-content":"",dir:R.dir,...N,...C,ref:te,style:{outline:"none",...C.style},onKeyDown:lt(C.onKeyDown,ne=>{const Ee=ne.target.closest("[data-radix-menu-content]")===ne.currentTarget,ve=ne.ctrlKey||ne.altKey||ne.metaKey,Re=ne.key.length===1;Ee&&(ne.key==="Tab"&&ne.preventDefault(),!ve&&Re&&M(ne.key));const re=L.current;if(ne.target!==re||!yF.includes(ne.key))return;ne.preventDefault();const J=I().filter(Ie=>!Ie.disabled).map(Ie=>Ie.ref.current);pO.includes(ne.key)&&J.reverse(),wO(J)}),onBlur:lt(t.onBlur,ne=>{ne.currentTarget.contains(ne.target)||(window.clearTimeout(G.current),P.current="")}),onPointerMove:lt(t.onPointerMove,Gp(ne=>{const me=ne.target,Ee=j.current!==ne.clientX;if(ne.currentTarget.contains(me)&&Ee){const ve=ne.clientX>j.current?"right":"left";ae.current=ve,j.current=ne.clientX}}))})})})})})})})},"MenuContentImpl")),jF=w.forwardRef(vt(function(t,n){const{__scopeMenu:i,...s}=t;return p.jsx(Cn.div,{role:"group",...s,ref:n})},"MenuGroup")),zF=w.forwardRef(vt(function(t,n){const{__scopeMenu:i,...s}=t;return p.jsx(Cn.div,{...s,ref:n})},"MenuLabel")),Eb="MenuItem",O2="menu.itemSelect",bO=w.forwardRef(vt(function(t,n){const{disabled:i=!1,onSelect:s,...a}=t,l=w.useRef(null),u=M0(Eb,t.__scopeMenu),f=yO(Eb,t.__scopeMenu),h=rn(n,l),g=w.useRef(!1),m=vt(()=>{const _=l.current;if(!i&&_){const b=new CustomEvent(O2,{bubbles:!0,cancelable:!0});_.addEventListener(O2,x=>s?.(x),{once:!0}),u0(_,b),b.defaultPrevented?g.current=!1:u.onClose()}},"handleSelect");return p.jsx(MF,{...a,ref:h,disabled:i,onClick:lt(t.onClick,m),onPointerDown:_=>{t.onPointerDown?.(_),g.current=!0},onPointerUp:lt(t.onPointerUp,_=>{g.current||_.currentTarget?.click()}),onKeyDown:lt(t.onKeyDown,_=>{i||_.target!==_.currentTarget||f.searchRef.current!==""&&_.key===" "||gF.includes(_.key)&&(_.currentTarget.click(),_.preventDefault())})})},"MenuItem")),MF=w.forwardRef(vt(function(t,n){const{__scopeMenu:i,disabled:s=!1,textValue:a,...l}=t,u=yO(Eb,i),f=gO(i),h=w.useRef(null),g=rn(n,h),[m,_]=w.useState(!1),[b,x]=w.useState("");return w.useEffect(()=>{const S=h.current;S&&x((S.textContent??"").trim())},[l.children]),p.jsx(kb.ItemSlot,{scope:i,disabled:s,textValue:a??b,children:p.jsx(fF,{asChild:!0,...f,focusable:!s,children:p.jsx(Cn.div,{role:"menuitem","data-highlighted":m?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...l,ref:g,onPointerMove:lt(t.onPointerMove,Gp(S=>{s?u.onItemLeave(S):(u.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:lt(t.onPointerLeave,Gp(S=>u.onItemLeave(S))),onFocus:lt(t.onFocus,()=>_(!0)),onBlur:lt(t.onBlur,()=>_(!1))})})})},"MenuItemImpl")),IF="MenuRadioGroup",[PF,LF]=bl(IF,{value:void 0,onValueChange:vt(()=>{},"onValueChange")}),BF=w.forwardRef(vt(function(t,n){const{value:i,onValueChange:s,...a}=t,l=_s(s);return p.jsx(PF,{scope:t.__scopeMenu,value:i,onValueChange:l,children:p.jsx(jF,{...a,ref:n})})},"MenuRadioGroup")),FF="MenuRadioItem",UF=w.forwardRef(vt(function(t,n){const{value:i,...s}=t,a=LF(FF,t.__scopeMenu),l=i===a.value;return p.jsx(HF,{scope:t.__scopeMenu,checked:l,children:p.jsx(bO,{role:"menuitemradio","aria-checked":l,...s,ref:n,"data-state":P0(l),onSelect:lt(s.onSelect,()=>a.onValueChange?.(i),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),xO="MenuItemIndicator",[HF,$F]=bl(xO,{checked:!1}),qF=w.forwardRef(vt(function(t,n){const{__scopeMenu:i,forceMount:s,...a}=t,l=$F(xO,i);return p.jsx(ha,{present:s||I0(l.checked)||l.checked===!0,children:p.jsx(Cn.span,{...a,ref:n,"data-state":P0(l.checked)})})},"MenuItemIndicator")),WF=w.forwardRef(vt(function(t,n){const{__scopeMenu:i,...s}=t;return p.jsx(Cn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:n})},"MenuSeparator")),KF="MenuSub",[ode,ade]=bl(KF);function SO(e){return e?"open":"closed"}vt(SO,"getOpenState");function I0(e){return e==="indeterminate"}vt(I0,"isIndeterminate");function P0(e){return I0(e)?"indeterminate":e?"checked":"unchecked"}vt(P0,"getCheckedState");function wO(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}vt(wO,"focusFirst");function CO(e,t){return e.map((n,i)=>e[(t+i)%e.length])}vt(CO,"wrapArray");function kO(e,t,n){const s=t.length>1&&Array.from(t).every(h=>h===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let l=CO(e,Math.max(a,0));s.length===1&&(l=l.filter(h=>h!==n));const f=l.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return f!==n?f:void 0}vt(kO,"getNextMatch");function EO(e,t){const{x:n,y:i}=e;let s=!1;for(let a=0,l=t.length-1;a<t.length;l=a++){const u=t[a],f=t[l],h=u.x,g=u.y,m=f.x,_=f.y;g>i!=_>i&&n<(m-h)*(i-g)/(_-g)+h&&(s=!s)}return s}vt(EO,"isPointInPolygon");function NO(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return EO(n,t)}vt(NO,"isPointerInGraceArea");function Gp(e){return t=>t.pointerType==="mouse"?e(t):void 0}vt(Gp,"whenMouse");var VF=Object.defineProperty,Ns=(e,t)=>VF(e,"name",{value:t,configurable:!0}),L0="DropdownMenu",[GF,lde]=uo(L0,[mO]),Rs=mO(),[ZF,RO]=GF(L0),YF=Ns(e=>{const{__scopeDropdownMenu:t,children:n,dir:i,open:s,defaultOpen:a,onOpenChange:l,modal:u=!0}=e,f=Rs(t),h=w.useRef(null),[g,m]=Gd({prop:s,defaultProp:a??!1,onChange:l,caller:L0});return p.jsx(ZF,{scope:t,triggerId:ea(),triggerRef:h,contentId:ea(),open:g,onOpenChange:m,onOpenToggle:w.useCallback(()=>m(_=>!_),[m]),modal:u,children:p.jsx(wF,{...f,open:g,onOpenChange:m,dir:i,modal:u,children:n})})},"DropdownMenu"),XF="DropdownMenuTrigger",QF=w.forwardRef(Ns(function(t,n){const{__scopeDropdownMenu:i,disabled:s=!1,...a}=t,l=RO(XF,i),u=Rs(i),f=rn(n,l.triggerRef);return p.jsx(CF,{asChild:!0,...u,children:p.jsx(Cn.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":s?"":void 0,disabled:s,...a,ref:f,onPointerDown:lt(t.onPointerDown,h=>{!s&&h.button===0&&h.ctrlKey===!1&&(l.onOpenToggle(),l.open||h.preventDefault())}),onKeyDown:lt(t.onKeyDown,h=>{s||(["Enter"," "].includes(h.key)&&l.onOpenToggle(),h.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(h.key)&&h.preventDefault())})})})},"DropdownMenuTrigger")),JF=Ns(e=>{const{__scopeDropdownMenu:t,...n}=e,i=Rs(t);return p.jsx(NF,{...i,...n})},"DropdownMenuPortal"),eU="DropdownMenuContent",tU=w.forwardRef(Ns(function(t,n){const{__scopeDropdownMenu:i,...s}=t,a=RO(eU,i),l=Rs(i),u=w.useRef(!1);return p.jsx(TF,{id:a.contentId,"aria-labelledby":a.triggerId,...l,...s,ref:n,onCloseAutoFocus:lt(t.onCloseAutoFocus,f=>{u.current||a.triggerRef.current?.focus(),u.current=!1,f.preventDefault()}),onInteractOutside:lt(t.onInteractOutside,f=>{const h=f.detail.originalEvent,g=h.button===0&&h.ctrlKey===!0,m=h.button===2||g;(!a.modal||m)&&(u.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),nU=w.forwardRef(Ns(function(t,n){const{__scopeDropdownMenu:i,...s}=t,a=Rs(i);return p.jsx(zF,{...a,...s,ref:n})},"DropdownMenuLabel")),iU=w.forwardRef(Ns(function(t,n){const{__scopeDropdownMenu:i,...s}=t,a=Rs(i);return p.jsx(bO,{...a,...s,ref:n})},"DropdownMenuItem")),rU=w.forwardRef(Ns(function(t,n){const{__scopeDropdownMenu:i,...s}=t,a=Rs(i);return p.jsx(BF,{...a,...s,ref:n})},"DropdownMenuRadioGroup")),sU=w.forwardRef(Ns(function(t,n){const{__scopeDropdownMenu:i,...s}=t,a=Rs(i);return p.jsx(UF,{...a,...s,ref:n})},"DropdownMenuRadioItem")),oU=w.forwardRef(Ns(function(t,n){const{__scopeDropdownMenu:i,...s}=t,a=Rs(i);return p.jsx(qF,{...a,...s,ref:n})},"DropdownMenuItemIndicator")),aU=w.forwardRef(Ns(function(t,n){const{__scopeDropdownMenu:i,...s}=t,a=Rs(i);return p.jsx(WF,{...a,...s,ref:n})},"DropdownMenuSeparator"));const Oc=YF,jc=QF,TO=rU,cl=w.forwardRef(({className:e,sideOffset:t=6,align:n="end",...i},s)=>p.jsx(JF,{children:p.jsx(tU,{ref:s,sideOffset:t,align:n,className:qe("z-[200] min-w-[190px] rounded-xl border border-line bg-surface/95 p-1.5 text-ink shadow-[var(--shadow-pop)] backdrop-blur-xl","data-[state=open]:animate-in data-[state=closed]:animate-out",e),...i})}));cl.displayName="DropdownMenuContent";function Zp({className:e,children:t}){return p.jsx(nU,{className:qe("px-2.5 pb-1 pt-1.5 text-[10.5px] font-semibold text-ink-3",e),children:t})}const na=w.forwardRef(({className:e,inset:t,...n},i)=>p.jsx(iU,{ref:i,className:qe("relative flex cursor-default select-none items-center gap-2 rounded-lg px-2.5 py-1.5 text-[12px] text-ink-2 outline-none transition-colors","data-[highlighted]:bg-black/[.05] data-[highlighted]:text-ink dark:data-[highlighted]:bg-white/[.07]","data-[disabled]:pointer-events-none data-[disabled]:opacity-45",t&&"pl-8",e),...n}));na.displayName="DropdownMenuItem";const Nd=w.forwardRef(({className:e,children:t,...n},i)=>p.jsxs(sU,{ref:i,className:qe("relative flex cursor-default select-none items-center gap-2 rounded-lg py-1.5 pl-2.5 pr-8 text-[12px] text-ink-2 outline-none transition-colors","data-[highlighted]:bg-black/[.05] data-[highlighted]:text-ink dark:data-[highlighted]:bg-white/[.07]",e),...n,children:[t,p.jsx(oU,{className:"absolute right-2",children:p.jsx("span",{className:"block h-1.5 w-1.5 rounded-full bg-accent"})})]}));Nd.displayName="DropdownMenuRadioItem";const B0=w.forwardRef(({className:e,...t},n)=>p.jsx(aU,{ref:n,className:qe("my-1 h-px bg-line",e),...t}));B0.displayName="DropdownMenuSeparator";const bi=w.forwardRef(function({label:t,active:n=!1,tone:i="default",className:s,children:a,type:l="button",...u},f){return p.jsx("button",{ref:f,type:l,"aria-label":t,title:t,"aria-pressed":n||void 0,className:qe("inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-lg transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50","disabled:pointer-events-none disabled:opacity-40",n?"bg-accent-soft text-accent":"text-ink-2 hover:bg-black/[.05] hover:text-ink dark:hover:bg-white/[.07]",i==="danger"&&"hover:bg-danger/10 hover:text-danger",s),...u,children:a})});function lU({children:e,className:t}){return p.jsx("kbd",{className:qe("inline-flex h-[18px] min-w-[18px] items-center justify-center rounded-[5px] border border-line bg-surface-2 px-1 font-sans text-[10px] font-medium text-ink-3",t),children:e})}var cU=Object.defineProperty,uU=(e,t)=>cU(e,"name",{value:t,configurable:!0}),dU=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),hU=w.forwardRef(uU(function(t,n){return p.jsx(Cn.span,{...t,ref:n,style:{...dU,...t.style}})},"VisuallyHidden")),fU=Object.defineProperty,Sn=(e,t)=>fU(e,"name",{value:t,configurable:!0}),[F0,cde]=uo("Tooltip",[Rm]),Om=Rm(),pU="TooltipProvider",mU=700,Nb="tooltip.open",[gU,U0]=F0(pU),vU=Sn(e=>{const{__scopeTooltip:t,delayDuration:n=mU,skipDelayDuration:i=300,disableHoverableContent:s=!1,children:a}=e,l=w.useRef(!0),u=w.useRef(!1),f=w.useRef(0);return w.useEffect(()=>{const h=f.current;return()=>window.clearTimeout(h)},[]),p.jsx(gU,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:w.useCallback(()=>{i<=0||(window.clearTimeout(f.current),l.current=!1)},[i]),onClose:w.useCallback(()=>{i<=0||(window.clearTimeout(f.current),f.current=window.setTimeout(()=>l.current=!0,i))},[i]),isPointerInTransitRef:u,onPointerInTransitChange:w.useCallback(h=>{u.current=h},[]),disableHoverableContent:s,children:a})},"TooltipProvider"),Rb="Tooltip",[yU,Yd]=F0(Rb),_U=Sn(e=>{const{__scopeTooltip:t,children:n,open:i,defaultOpen:s,onOpenChange:a,disableHoverableContent:l,delayDuration:u}=e,f=U0(Rb,e.__scopeTooltip),h=Om(t),[g,m]=w.useState(null),[_,b]=w.useState(void 0),x=ea(),S=w.useRef(0),C=l??f.disableHoverableContent,k=u??f.delayDuration,R=w.useRef(!1),[N,A]=Gd({prop:i,defaultProp:s??!1,onChange:Sn(U=>{U?(f.onOpen(),document.dispatchEvent(new CustomEvent(Nb))):f.onClose(),a?.(U)},"onChange"),caller:Rb}),I=w.useMemo(()=>N?R.current?"delayed-open":"instant-open":"closed",[N]),T=w.useCallback(()=>{window.clearTimeout(S.current),S.current=0,R.current=!1,A(!0)},[A]),D=w.useCallback(()=>{window.clearTimeout(S.current),S.current=0,A(!1)},[A]),L=w.useCallback(()=>{window.clearTimeout(S.current),S.current=window.setTimeout(()=>{R.current=!0,A(!0),S.current=0},k)},[k,A]);w.useEffect(()=>()=>{S.current&&(window.clearTimeout(S.current),S.current=0)},[]);const ee=_??x;return p.jsx(eO,{...h,children:p.jsx(yU,{scope:t,contentId:ee,setContentId:b,open:N,stateAttribute:I,trigger:g,onTriggerChange:m,onTriggerEnter:w.useCallback(()=>{f.isOpenDelayedRef.current?L():T()},[f.isOpenDelayedRef,L,T]),onTriggerLeave:w.useCallback(()=>{C?D():(window.clearTimeout(S.current),S.current=0)},[D,C]),onOpen:T,onClose:D,disableHoverableContent:C,children:n})})},"Tooltip"),j2="TooltipTrigger",bU=w.forwardRef(Sn(function(t,n){const{__scopeTooltip:i,"aria-describedby":s,...a}=t,l=Yd(j2,i),u=U0(j2,i),f=Om(i),h=w.useRef(null),g=rn(n,h,l.onTriggerChange),m=w.useRef(!1),_=w.useRef(!1),b=w.useCallback(()=>m.current=!1,[]);return w.useEffect(()=>()=>document.removeEventListener("pointerup",b),[b]),p.jsx(tO,{asChild:!0,...f,children:p.jsx(Cn.button,{"aria-describedby":l.open?LO(s,l.contentId):s,"data-state":l.stateAttribute,...a,ref:g,onPointerMove:lt(t.onPointerMove,x=>{x.pointerType!=="touch"&&!_.current&&!u.isPointerInTransitRef.current&&(l.onTriggerEnter(),_.current=!0)}),onPointerLeave:lt(t.onPointerLeave,()=>{l.onTriggerLeave(),_.current=!1}),onPointerDown:lt(t.onPointerDown,()=>{l.open&&l.onClose(),m.current=!0,document.addEventListener("pointerup",b,{once:!0})}),onFocus:lt(t.onFocus,()=>{m.current||l.onOpen()}),onBlur:lt(t.onBlur,l.onClose),onClick:lt(t.onClick,l.onClose)})})},"TooltipTrigger")),DO="TooltipPortal",[xU,SU]=F0(DO,{forceMount:void 0}),wU=Sn(e=>{const{__scopeTooltip:t,forceMount:n,children:i,container:s}=e,a=Yd(DO,t);return p.jsx(xU,{scope:t,forceMount:n,children:p.jsx(ha,{present:n||a.open,children:p.jsx(v0,{asChild:!0,container:s,children:i})})})},"TooltipPortal"),Bd="TooltipContent",CU=w.forwardRef(Sn(function(t,n){const i=SU(Bd,t.__scopeTooltip),{forceMount:s=i.forceMount,side:a="top",...l}=t,u=Yd(Bd,t.__scopeTooltip);return p.jsx(ha,{present:s||u.open,children:u.disableHoverableContent?p.jsx(AO,{side:a,...l,ref:n}):p.jsx(kU,{side:a,...l,ref:n})})},"TooltipContent")),kU=w.forwardRef(Sn(function(t,n){const i=Yd(Bd,t.__scopeTooltip),s=U0(Bd,t.__scopeTooltip),a=w.useRef(null),l=rn(n,a),[u,f]=w.useState(null),{trigger:h,onClose:g}=i,m=a.current,{onPointerInTransitChange:_}=s,b=w.useCallback(()=>{f(null),_(!1)},[_]),x=w.useCallback((S,C)=>{const k=S.currentTarget,R={x:S.clientX,y:S.clientY},N=OO(R,k.getBoundingClientRect()),A=jO(R,N),I=zO(C.getBoundingClientRect()),T=IO([...A,...I]);f(T),_(!0)},[_]);return w.useEffect(()=>()=>b(),[b]),w.useEffect(()=>{if(h&&m){const S=Sn(k=>x(k,m),"handleTriggerLeave"),C=Sn(k=>x(k,h),"handleContentLeave");return h.addEventListener("pointerleave",S),m.addEventListener("pointerleave",C),()=>{h.removeEventListener("pointerleave",S),m.removeEventListener("pointerleave",C)}}},[h,m,x,b]),w.useEffect(()=>{if(u){const S=Sn(C=>{const k=C.target,R={x:C.clientX,y:C.clientY},N=h?.contains(k)||m?.contains(k),A=!MO(R,u);N?b():A&&(b(),g())},"handleTrackPointerGrace");return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[h,m,u,g,b]),p.jsx(AO,{...t,ref:l})},"TooltipContentHoverable")),EU=XD("TooltipContent"),AO=w.forwardRef(Sn(function(t,n){const{__scopeTooltip:i,children:s,"aria-label":a,id:l,onEscapeKeyDown:u,onPointerDownOutside:f,...h}=t,g=Yd(Bd,i),m=Om(i),{onClose:_}=g,[b,x]=w.useState(null),S=rn(n,x);m0(b),w.useEffect(()=>(document.addEventListener(Nb,_),()=>document.removeEventListener(Nb,_)),[_]),w.useEffect(()=>{if(g.trigger){const k=Sn(R=>{R.target instanceof Node&&R.target.contains(g.trigger)&&_()},"handleScroll");return window.addEventListener("scroll",k,{capture:!0}),()=>window.removeEventListener("scroll",k,{capture:!0})}},[g.trigger,_]);const{setContentId:C}=g;return ci(()=>(C(l),()=>{C(void 0)}),[l,C]),p.jsx(d0,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:u,onPointerDownOutside:f,onFocusOutside:k=>k.preventDefault(),onDismiss:_,children:p.jsxs(iO,{"data-state":g.stateAttribute,role:a?void 0:"tooltip",id:a?void 0:g.contentId,...m,...h,ref:S,style:{...h.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(EU,{children:s}),a?p.jsx(hU,{id:g.contentId,role:"tooltip",children:a}):null]})})},"TooltipContentImpl")),NU=w.forwardRef(Sn(function(t,n){const{__scopeTooltip:i,...s}=t,a=Om(i);return p.jsx(J9,{...a,...s,ref:n})},"TooltipArrow"));function OO(e,t){const n=Math.abs(t.top-e.y),i=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,i,s,a)){case a:return"left";case s:return"right";case n:return"top";case i:return"bottom";default:throw new Error("unreachable")}}Sn(OO,"getExitSideFromRect");function jO(e,t,n=5){const i=[];switch(t){case"top":i.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":i.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":i.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":i.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return i}Sn(jO,"getPaddedExitPoints");function zO(e){const{top:t,right:n,bottom:i,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:i},{x:s,y:i}]}Sn(zO,"getPointsFromRect");function MO(e,t){const{x:n,y:i}=e;let s=!1;for(let a=0,l=t.length-1;a<t.length;l=a++){const u=t[a],f=t[l],h=u.x,g=u.y,m=f.x,_=f.y;g>i!=_>i&&n<(m-h)*(i-g)/(_-g)+h&&(s=!s)}return s}Sn(MO,"isPointInPolygon");function IO(e){const t=e.slice();return t.sort((n,i)=>n.x<i.x?-1:n.x>i.x?1:n.y<i.y?-1:n.y>i.y?1:0),PO(t)}Sn(IO,"getHull");function PO(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i<e.length;i++){const s=e[i];for(;t.length>=2;){const a=t[t.length-1],l=t[t.length-2];if((a.x-l.x)*(s.y-l.y)>=(a.y-l.y)*(s.x-l.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let i=e.length-1;i>=0;i--){const s=e[i];for(;n.length>=2;){const a=n[n.length-1],l=n[n.length-2];if((a.x-l.x)*(s.y-l.y)>=(a.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}Sn(PO,"getHullPresorted");function LO(...e){const t=new Set;for(const n of e)if(typeof n=="string")for(const i of String(n).trim().split(/\s+/))i&&t.add(i);return t.size>0?Array.from(t).join(" "):void 0}Sn(LO,"concatAriaDescribedby");const RU=vU;function TU({label:e,children:t,side:n="bottom",className:i}){return p.jsxs(_U,{children:[p.jsx(bU,{asChild:!0,children:t}),p.jsx(wU,{children:p.jsxs(CU,{side:n,sideOffset:6,className:qe("z-[200] select-none rounded-md bg-[#1d1d1f] px-2 py-1 text-[11px] font-medium text-white shadow-lg","data-[state=delayed-open]:animate-in dark:bg-[#f5f5f7] dark:text-[#1d1d1f]",i),children:[e,p.jsx(NU,{className:"fill-[#1d1d1f] dark:fill-[#f5f5f7]"})]})})]})}const BO=w.createContext(void 0),zn=e=>{const t=w.useContext(BO);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},DU=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(BO.Provider,{value:e,children:t})),AU={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)};var OU=class{#e=AU;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};const el=new OU;function jU(e){setTimeout(e,0)}const zU=typeof window>"u"||"Deno"in globalThis;function _i(){}function MU(e,t){return typeof e=="function"?e(t):e}function FO(e){return typeof e=="number"&&e>=0&&e!==1/0}function UO(e,t){return Math.max(e+(t||0)-Date.now(),0)}function $t(e,t){return typeof e=="function"?e(t):e}function z2(e,t){const{type:n="all",exact:i,fetchStatus:s,predicate:a,queryKey:l,stale:u}=e;if(l){if(i){if(t.queryHash!==H0(l,t.options))return!1}else if(!zc(t.queryKey,l))return!1}if(n!=="all"){const f=t.isActive();if(n==="active"&&!f||n==="inactive"&&f)return!1}return!(typeof u=="boolean"&&t.isStale()!==u||s&&s!==t.state.fetchStatus||a&&!a(t))}function M2(e,t){const{exact:n,status:i,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ul(t.options.mutationKey)!==ul(a))return!1}else if(!zc(t.options.mutationKey,a))return!1}return!(i&&t.state.status!==i||s&&!s(t))}function H0(e,t){return(t?.queryKeyHashFn||ul)(e)}function ul(e){return JSON.stringify(e,(t,n)=>Tb(n)?Object.keys(n).sort().reduce((i,s)=>(i[s]=n[s],i),{}):n)}function zc(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let i=0;i<t.length;i++)if(!zc(e[i],t[i]))return!1;return!0}const n=Object.keys(t);for(const i of n)if(!zc(e[i],t[i]))return!1;return!0}return!1}const IU=Object.prototype.hasOwnProperty;function HO(e,t,n=0){if(e===t)return e;if(n>500)return t;const i=I2(e)&&I2(t);if(!i&&!(Tb(e)&&Tb(t)))return t;const s=(i?e:Object.keys(e)).length,a=i?t:Object.keys(t),l=a.length,u=i?new Array(l):{};let f=0;for(let h=0;h<l;h++){const g=i?h:a[h],m=e[g],_=t[g];if(m===_){u[g]=m,(i?h<s:IU.call(e,g))&&f++;continue}if(m===null||_===null||typeof m!="object"||typeof _!="object"){u[g]=_;continue}const b=HO(m,_,n+1);u[g]=b,b===m&&f++}return s===l&&f===s?e:u}function Np(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function I2(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Tb(e){if(!P2(e))return!1;const t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!="function")return!1;const i=n.prototype;return!(!P2(i)||!i.hasOwnProperty("isPrototypeOf")||t!==Object.prototype)}function P2(e){return Object.prototype.toString.call(e)==="[object Object]"}function PU(e){return new Promise(t=>{el.setTimeout(t,e)})}function Db(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?HO(e,t):t}function LU(e,t,n=0){const i=[...e,t];return n&&i.length>n?i.slice(1):i}function BU(e,t,n=0){const i=[t,...e];return n&&i.length>n?i.slice(0,-1):i}const $0=Symbol();function $O(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===$0?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function q0(e,t){return typeof e=="function"?e(...t):!!e}function FU(e,t,n){let i=!1,s;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(s??=t(),i||(i=!0,s.aborted?n():s.addEventListener("abort",n,{once:!0})),s)}),e}let UU=()=>zU;const W0=()=>UU();var Gc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},HU=class extends Gc{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}};const K0=new HU,$U=jU;function qU(){let e=[],t=0,n=u=>{u()},i=u=>{u()},s=$U;const a=u=>{t?e.push(u):s(()=>{n(u)})},l=()=>{const u=e;e=[],u.length&&s(()=>{i(()=>{u.forEach(f=>{n(f)})})})};return{batch:u=>{let f;t++;try{f=u()}finally{t--,t||l()}return f},batchCalls:u=>(...f)=>{a(()=>{u(...f)})},schedule:a,setNotifyFunction:u=>{n=u},setBatchNotifyFunction:u=>{i=u},setScheduler:u=>{s=u}}}const On=qU();var WU=class extends Gc{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};const Yp=new WU;function KU(e){return Math.min(1e3*2**e,3e4)}function qO(e){return(e??"online")==="online"?Yp.isOnline():!0}var Ab=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function WO(e){let t=!1,n=0,i,s="pending",a,l;const u=new Promise((R,N)=>{a=R,l=N});u.catch(_i);const f=()=>s!=="pending",h=R=>{if(!f()){const N=new Ab(R);S(N),e.onCancel?.(N)}},g=()=>{t=!0},m=()=>{t=!1},_=()=>K0.isFocused()&&(e.networkMode==="always"||Yp.isOnline())&&e.canRun(),b=()=>qO(e.networkMode)&&e.canRun(),x=R=>{f()||(i?.(),s="resolved",a(R))},S=R=>{f()||(i?.(),s="rejected",l(R))},C=R=>new Promise(N=>{i=A=>{(f()||R())&&N(A)},e.onPause?.()}).then(()=>{i=void 0,f()||e.onContinue?.()}),k=()=>{if(f())return;let R;const N=n===0?e.initialPromise:void 0;try{R=N??e.fn()}catch(A){R=Promise.reject(A)}Promise.resolve(R).then(x).catch(A=>{if(f())return;const I=e.retry??(W0()?0:3),T=e.retryDelay??KU,D=typeof T=="function"?T(n,A):T,L=I===!0||typeof I=="number"&&n<I||typeof I=="function"&&I(n,A);if(t||!L){S(A);return}n++,e.onFail?.(n,A),PU(D).then(()=>_()?void 0:C(_)).then(()=>{t?S(A):k()})})};return{promise:u,status:()=>s,cancel:h,continue:()=>(i?.(),u),cancelRetry:g,continueRetry:m,canStart:b,start:()=>(b()?k():C(b).then(k),u)}}var KO=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),FO(this.gcTime)&&(this.#e=el.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(W0()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(el.clearTimeout(this.#e),this.#e=void 0)}};function VU(e){return{onFetch:(t,n)=>{const i=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],l=t.state.data?.pageParams||[];let u={pages:[],pageParams:[]},f=0;const h=async()=>{let g=!1;const m=x=>{FU(x,()=>t.signal,()=>g=!0)},_=$O(t.options,t.fetchOptions),b=async(x,S,C)=>{if(g)return Promise.reject(t.signal.reason);if(S==null&&x.pages.length)return Promise.resolve(x);const R=(()=>{const T={client:t.client,queryKey:t.queryKey,pageParam:S,direction:C?"backward":"forward",meta:t.options.meta};return m(T),T})(),N=await _(R),{maxPages:A}=t.options,I=C?BU:LU;return{pages:I(x.pages,N,A),pageParams:I(x.pageParams,S,A)}};if(s&&a.length){const x=s==="backward",S=x?VO:Ob,C={pages:a,pageParams:l};u=await b(C,S(i,C),x)}else{const x=e??a.length;do{const S=f===0?l[0]===void 0?i.initialPageParam:l[0]:Ob(i,u);if(f>0&&S==null)break;u=await b(u,S),f++}while(f<x)}return u};t.options.persister?t.fetchFn=()=>t.options.persister?.(h,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=h}}}function Ob(e,{pages:t,pageParams:n}){const i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,n[i],n):void 0}function VO(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function GU(e,t){return t?Ob(e,t)!=null:!1}function ZU(e,t){return!t||!e.getPreviousPageParam?!1:VO(e,t)!=null}var YU=class extends KO{#e;#t;#n;#i;#s;#r;#o;#l;constructor(e){super(),this.#l=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#i=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=B2(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=B2(this.options);t.data!==void 0&&(this.setState(L2(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#i.remove(this)}setData(e,t){const n=Db(this.state.data,e,this.options);return this.#a({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#a({type:"setState",state:e})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(_i).catch(_i):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>$t(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===$0||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>$t(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!UO(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#i.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){const t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#r&&(this.#l||this.state.fetchStatus==="paused"&&this.state.status==="pending"?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#i.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#a({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(h=>h.options.queryFn);f&&this.setOptions(f.options)}const n=new AbortController,i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(this.#l=!0,n.signal)})},s=()=>{const f=$O(this.options,t),g=(()=>{const m={client:this.#s,queryKey:this.queryKey,meta:this.meta};return i(m),m})();return this.#l=!1,this.options.persister?this.options.persister(f,g,this):f(g)},l=(()=>{const f={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:s};return i(f),f})();(this.#e==="infinite"?VU(this.options.pages):this.options.behavior)?.onFetch(l,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==l.fetchOptions?.meta)&&this.#a({type:"fetch",meta:l.fetchOptions?.meta});const u=this.#r=WO({initialPromise:t?.initialPromise,fn:l.fetchFn,onCancel:f=>{f instanceof Ab&&f.revert&&this.setState({...this.#n,fetchStatus:"idle"}),n.abort()},onFail:(f,h)=>{this.#a({type:"failed",failureCount:f,error:h})},onPause:()=>{this.#a({type:"pause"})},onContinue:()=>{this.#a({type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0});try{const f=await u.start();if(f===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(f),this.#i.config.onSuccess?.(f,this),this.#i.config.onSettled?.(f,this.state.error,this),f}catch(f){if(f instanceof Ab){if(f.silent)return this.#r.promise;if(f.revert){if(this.state.data===void 0)throw f;return this.state.data}}throw this.#a({type:"error",error:f}),this.#i.config.onError?.(f,this),this.#i.config.onSettled?.(this.state.data,f,this),f}finally{this.#r===u&&(this.#r=void 0),this.scheduleGc()}}#a(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...GO(n.data,this.options),fetchMeta:e.meta??null};case"success":const i={...n,...L2(e.data,e.dataUpdatedAt),dataUpdateCount:n.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?i:void 0,i;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),On.batch(()=>{this.observers.slice().forEach(n=>{n.onQueryUpdate()}),this.#i.notify({query:this,type:"updated",action:e})})}};function GO(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:qO(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function L2(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function B2(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,i=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var ZO=class extends Gc{#e;#t=void 0;#n=void 0;#i=void 0;#s;#r;#o;#l;#a;#f;#u;#d;#c;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),F2(this.#t,this.options)?this.#h():this.updateResult(),this.#_())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return jb(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return jb(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof $t(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!Np(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&U2(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),i&&(this.#t!==n||$t(this.options.enabled,this.#t)!==$t(t.enabled,this.#t)||$t(this.options.staleTime,this.#t)!==$t(t.staleTime,this.#t))&&this.#g();const s=this.#v();i&&(this.#t!==n||$t(this.options.enabled,this.#t)!==$t(t.enabled,this.#t)||s!==this.#c)&&this.#y(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return Np(this.getCurrentResult(),n)||(this.#i=n,this.#r=this.options,this.#s=this.#t.state),n}getCurrentResult(){return this.#i}trackResult(e,t){return new Proxy(e,{get:(n,i)=>(this.trackProp(i),t?.(i),Reflect.get(n,i))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);let i=()=>{},s;const a=new Promise(l=>{s=l,i=this.#e.getQueryCache().subscribe(u=>{u.type==="updated"&&u.query.queryHash===n.queryHash&&n.state.data!==void 0&&(i(),l(this.createResult(n,t)))})});return Promise.race([n.fetch(t).then(()=>{const l=this.createResult(n,t);return s?.(l),l}).finally(()=>{i()}),a])}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#i))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(_i)),t}#m(e){return!W0()&&$t(this.options.enabled,this.#t)!==!1&&FO(e)}#g(){this.#b();const e=$t(this.options.staleTime,this.#t);if(this.#i.isStale||!this.#m(e))return;const t=UO(this.#i.dataUpdatedAt,e)+1;this.#u=el.setTimeout(()=>{this.#i.isStale||this.updateResult()},t)}#v(){return $t(this.options.refetchInterval,this.#t)??!1}#y(e){this.#x(),this.#c=e,!(this.#c===0||!this.#m(this.#c))&&(this.#d=el.setInterval(()=>{(this.options.refetchIntervalInBackground||K0.isFocused())&&this.#h()},this.#c))}#_(){this.#g(),this.#y(this.#v())}#b(){this.#u!==void 0&&(el.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(el.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){const n=this.#t,i=this.options,s=this.#i,a=this.#s,l=this.#r,u=e!==n?e.state:this.#n,{state:f}=e;let h={...f},g=!1,m;if(t._optimisticResults){const I=this.hasListeners(),T=!I&&F2(e,t),D=I&&U2(e,n,t,i);(T||D)&&(h={...h,...GO(f.data,e.options)}),t._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:_,errorUpdatedAt:b,status:x}=h;m=h.data;let S=!1;if(t.placeholderData!==void 0&&m===void 0&&x==="pending"){let I;s?.isPlaceholderData&&t.placeholderData===l?.placeholderData?(I=s.data,S=!0):I=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,I!==void 0&&(x="success",m=Db(s?.data,I,t),g=!0)}if(t.select&&m!==void 0&&!S)if(s&&m===a?.data&&t.select===this.#l)m=this.#a;else try{this.#l=t.select,m=t.select(m),m=Db(s?.data,m,t),this.#a=m,this.#o=null}catch(I){this.#o=I}else m===void 0&&(this.#o=null);this.#o&&(_=this.#o,m=this.#a,b=Date.now(),x="error",g=!1);const C=h.fetchStatus==="fetching",k=x==="pending",R=x==="error",N=k&&C,A=m!==void 0;return{status:x,fetchStatus:h.fetchStatus,isPending:k,isSuccess:x==="success",isError:R,isInitialLoading:N,isLoading:N,data:m,dataUpdatedAt:h.dataUpdatedAt,error:_,errorUpdatedAt:b,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:h.dataUpdateCount>u.dataUpdateCount||h.errorUpdateCount>u.errorUpdateCount,isFetching:C,isRefetching:C&&!k,isLoadingError:R&&!A,isPaused:h.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:R&&A,isStale:V0(e,t),refetch:this.refetch,isEnabled:$t(t.enabled,e)!==!1}}updateResult(){const e=this.#i,t=this.createResult(this.#t,this.options);if(this.#s=this.#t.state,this.#r=this.options,this.#s.data!==void 0&&(this.#f=this.#t),Np(t,e))return;this.#i=t;const i=(()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!this.#p.size)return!0;const l=new Set(a??this.#p);return this.options.throwOnError&&l.add("error"),Object.keys(this.#i).some(u=>{const f=u;return this.#i[f]!==e[f]&&l.has(f)})})();On.batch(()=>{i&&this.listeners.forEach(s=>{s(this.#i)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#_()}};function XU(e,t){return $t(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&$t(t.retryOnMount,e)===!1)}function F2(e,t){return XU(e,t)||e.state.data!==void 0&&jb(e,t,t.refetchOnMount)}function jb(e,t,n){if($t(t.enabled,e)!==!1&&$t(t.staleTime,e)!=="static"){const i=$t(n,e);return i==="always"||i!==!1&&V0(e,t)}return!1}function U2(e,t,n,i){return(e!==t||$t(i.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&V0(e,n)}function V0(e,t){return $t(t.enabled,e)!==!1&&e.isStaleByTime($t(t.staleTime,e))}var QU=class extends ZO{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:n}=e,i=super.createResult(e,t),{isFetching:s,isRefetching:a,isError:l,isRefetchError:u}=i,f=n.fetchMeta?.fetchMore?.direction,h=l&&f==="forward",g=s&&f==="forward",m=l&&f==="backward",_=s&&f==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:GU(t,n.data),hasPreviousPage:ZU(t,n.data),isFetchNextPageError:h,isFetchingNextPage:g,isFetchPreviousPageError:m,isFetchingPreviousPage:_,isRefetchError:u&&!h&&!m,isRefetching:a&&!g&&!_}}},JU=class extends KO{#e;#t;#n;#i;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||YO(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#i?.continue()??(this.state.status==="pending"?this.execute(this.state.variables):Promise.resolve())}async execute(e){const t=()=>{this.#s({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},i=this.#i=WO({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(l,u)=>{this.#s({type:"failed",failureCount:l,error:u})},onPause:()=>{this.#s({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),s=this.state.status==="pending",a=!i.canStart();try{if(s)t();else{this.#s({type:"pending",variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);const u=await this.options.onMutate?.(e,n);u!==this.state.context&&this.#s({type:"pending",context:u,variables:e,isPaused:a})}const l=await i.start();return await this.#n.config.onSuccess?.(l,e,this.state.context,this,n),await this.options.onSuccess?.(l,e,this.state.context,n),await this.#n.config.onSettled?.(l,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(l,null,e,this.state.context,n),this.#s({type:"success",data:l}),l}catch(l){try{await this.#n.config.onError?.(l,e,this.state.context,this,n)}catch(u){Promise.reject(u)}try{await this.options.onError?.(l,e,this.state.context,n)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,l,this.state.variables,this.state.context,this,n)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,l,e,this.state.context,n)}catch(u){Promise.reject(u)}throw this.#s({type:"error",error:l}),l}finally{this.#i===i&&(this.#i=void 0),this.#n.runNext(this)}}#s(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),On.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function YO(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var e7=class extends Gc{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){const i=new JU({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(i),i}add(e){this.#e.add(e);const t=Kf(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Kf(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const i=n.indexOf(e);i!==-1&&n.splice(i,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Kf(e);if(typeof t=="string"){const n=this.#t.get(t)?.find(i=>i.state.status==="pending");return!n||n===e}else return!0}runNext(e){const t=Kf(e);return typeof t=="string"?this.#t.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){On.batch(()=>{const e=this.getAll();this.#e.clear(),this.#t.clear(),e.forEach(t=>{this.notify({type:"removed",mutation:t})})})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>M2(t,n))}findAll(e={}){return this.getAll().filter(t=>M2(e,t))}notify(e){On.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return On.batch(()=>Promise.all(e.map(t=>t.continue().catch(_i))))}};function Kf(e){return e.options.scope?.id}var t7=class extends Gc{#e;#t=void 0;#n;#i;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),Np(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&ul(n.mutationKey)!==ul(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#s())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#s(),this.#r(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#s(),this.#r()}mutate(t,n){return this.#i=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#s(){const t=this.#n?.state??YO();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#r(t){On.batch(()=>{const n=this.#i;if(n&&this.hasListeners()){const i=this.#t.variables,s=this.#t.context,a={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(t?.type==="success"){try{n.onSuccess?.(t.data,i,s,a)}catch(l){Promise.reject(l)}try{n.onSettled?.(t.data,null,i,s,a)}catch(l){Promise.reject(l)}}else if(t?.type==="error"){try{n.onError?.(t.error,i,s,a)}catch(l){Promise.reject(l)}try{n.onSettled?.(void 0,t.error,i,s,a)}catch(l){Promise.reject(l)}}}this.listeners.forEach(i=>{i(this.#t)})})}},n7=class extends Gc{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){const i=t.queryKey,s=t.queryHash??H0(i,t);let a=this.get(s);return a||(a=new YU({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(i)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){On.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>z2(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>z2(e,n)):t}notify(e){On.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){On.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){On.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},i7=class{#e;#t;#n;#i;#s;#r;#o;#l;constructor(e={}){this.#e=e.queryCache||new n7,this.#t=e.mutationCache||new e7,this.#n=e.defaultOptions||{},this.#i=new Map,this.#s=new Map,this.#r=0}mount(){this.#r++,this.#r===1&&(this.#o=K0.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#l=Yp.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#r--,this.#r===0&&(this.#o?.(),this.#o=void 0,this.#l?.(),this.#l=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),i=n.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime($t(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>[t,n.data])}setQueryData(e,t,n){const i=this.defaultQueryOptions({queryKey:e}),s=this.#e.get(i.queryHash)?.state.data,a=MU(t,s);if(a!==void 0)return this.#e.build(this,i).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return On.batch(()=>this.#e.findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;On.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return On.batch(()=>{const i=n.findAll(e),s=new Set(i);return i.forEach(a=>{a.reset()}),this.refetchQueries({type:"active",predicate:a=>s.has(a)},t)})}cancelQueries(e,t={}){const n={revert:!0,...t},i=On.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(i).then(_i).catch(_i)}invalidateQueries(e,t={}){return On.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},i=On.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(_i)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(i).then(_i)}async query(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t),i=n.isStaleByTime($t(t.staleTime,n))?await n.fetch(t):n.state.data,s=t.select;return s?s(i):i}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime($t(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(_i).catch(_i)}infiniteQuery(e){return e._type="infinite",this.query(e)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(_i).catch(_i)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return Yp.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#i.set(ul(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(i=>{zc(e,i.queryKey)&&Object.assign(n,i.defaultOptions)}),n}setMutationDefaults(e,t){this.#s.set(ul(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(i=>{zc(e,i.mutationKey)&&Object.assign(n,i.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=H0(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===$0&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};const XO=w.createContext(!1),r7=()=>w.useContext(XO);XO.Provider;function s7(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}const o7=w.createContext(s7()),a7=()=>w.useContext(o7),l7=(e,t,n)=>{const i=n?.state.status==="error"&&typeof e.throwOnError=="function"?q0(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||i)&&(t.isReset()||(e.retryOnMount=!1))},c7=e=>{w.useEffect(()=>{e.clearReset()},[e])},u7=({result:e,errorResetBoundary:t,throwOnError:n,query:i,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(s&&e.data===void 0||q0(n,[e.error,i])),d7=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...s)=>n(i(...s)):n(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},h7=(e,t)=>e?.suspense&&t.isPending,f7=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function QO(e,t,n){const i=r7(),s=a7(),a=zn(),l=a.defaultQueryOptions(e),u=a.getQueryCache().get(l.queryHash),f=e.subscribed!==!1;l._optimisticResults=i?"isRestoring":f?"optimistic":void 0,d7(l),l7(l,s,u),c7(s);const[h]=w.useState(()=>new t(a,l)),g=h.getOptimisticResult(l),m=!i&&f;if(w.useSyncExternalStore(w.useCallback(_=>{const b=m?h.subscribe(On.batchCalls(_)):_i;return h.updateResult(),b},[h,m]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),w.useEffect(()=>{h.setOptions(l)},[l,h]),h7(l,g))throw f7(l,h,s);if(u7({result:g,errorResetBoundary:s,throwOnError:l.throwOnError,query:u,suspense:l.suspense}))throw g.error;return l.notifyOnChangeProps?g:h.trackResult(g)}function Pt(e,t){return QO(e,ZO)}function wc(e,t){const n=zn(),[i]=w.useState(()=>new t7(n,e));w.useEffect(()=>{i.setOptions(e)},[i,e]);const s=w.useSyncExternalStore(w.useCallback(l=>i.subscribe(On.batchCalls(l)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),a=w.useCallback((...l)=>{i.mutate(l[0],l[1]).catch(_i)},[i]);if(s.error&&q0(i.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:a,mutateAsync:s.mutate}}function p7(e,t){return QO(e,QU)}var e_={exports:{}},nd={},t_={exports:{}},n_={};var H2;function m7(){return H2||(H2=1,(function(e){function t(P,Z){var $=P.length;P.push(Z);e:for(;0<$;){var ae=$-1>>>1,j=P[ae];if(0<s(j,Z))P[ae]=Z,P[$]=j,$=ae;else break e}}function n(P){return P.length===0?null:P[0]}function i(P){if(P.length===0)return null;var Z=P[0],$=P.pop();if($!==Z){P[0]=$;e:for(var ae=0,j=P.length,_e=j>>>1;ae<_e;){var Le=2*(ae+1)-1,z=P[Le],M=Le+1,K=P[M];if(0>s(z,$))M<j&&0>s(K,z)?(P[ae]=K,P[M]=$,ae=M):(P[ae]=z,P[Le]=$,ae=Le);else if(M<j&&0>s(K,$))P[ae]=K,P[M]=$,ae=M;else break e}}return Z}function s(P,Z){var $=P.sortIndex-Z.sortIndex;return $!==0?$:P.id-Z.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 l=Date,u=l.now();e.unstable_now=function(){return l.now()-u}}var f=[],h=[],g=1,m=null,_=3,b=!1,x=!1,S=!1,C=!1,k=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function A(P){for(var Z=n(h);Z!==null;){if(Z.callback===null)i(h);else if(Z.startTime<=P)i(h),Z.sortIndex=Z.expirationTime,t(f,Z);else break;Z=n(h)}}function I(P){if(S=!1,A(P),!x)if(n(f)!==null)x=!0,T||(T=!0,B());else{var Z=n(h);Z!==null&&G(I,Z.startTime-P)}}var T=!1,D=-1,L=5,ee=-1;function U(){return C?!0:!(e.unstable_now()-ee<L)}function F(){if(C=!1,T){var P=e.unstable_now();ee=P;var Z=!0;try{e:{x=!1,S&&(S=!1,R(D),D=-1),b=!0;var $=_;try{t:{for(A(P),m=n(f);m!==null&&!(m.expirationTime>P&&U());){var ae=m.callback;if(typeof ae=="function"){m.callback=null,_=m.priorityLevel;var j=ae(m.expirationTime<=P);if(P=e.unstable_now(),typeof j=="function"){m.callback=j,A(P),Z=!0;break t}m===n(f)&&i(f),A(P)}else i(f);m=n(f)}if(m!==null)Z=!0;else{var _e=n(h);_e!==null&&G(I,_e.startTime-P),Z=!1}}break e}finally{m=null,_=$,b=!1}Z=void 0}}finally{Z?B():T=!1}}}var B;if(typeof N=="function")B=function(){N(F)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,te=W.port2;W.port1.onmessage=F,B=function(){te.postMessage(null)}}else B=function(){k(F,0)};function G(P,Z){D=k(function(){P(e.unstable_now())},Z)}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(P){P.callback=null},e.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<P?Math.floor(1e3/P):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(P){switch(_){case 1:case 2:case 3:var Z=3;break;default:Z=_}var $=_;_=Z;try{return P()}finally{_=$}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(P,Z){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var $=_;_=P;try{return Z()}finally{_=$}},e.unstable_scheduleCallback=function(P,Z,$){var ae=e.unstable_now();switch(typeof $=="object"&&$!==null?($=$.delay,$=typeof $=="number"&&0<$?ae+$:ae):$=ae,P){case 1:var j=-1;break;case 2:j=250;break;case 5:j=1073741823;break;case 4:j=1e4;break;default:j=5e3}return j=$+j,P={id:g++,callback:Z,priorityLevel:P,startTime:$,expirationTime:j,sortIndex:-1},$>ae?(P.sortIndex=$,t(h,P),n(f)===null&&P===n(h)&&(S?(R(D),D=-1):S=!0,G(I,$-ae))):(P.sortIndex=j,t(f,P),x||b||(x=!0,T||(T=!0,B()))),P},e.unstable_shouldYield=U,e.unstable_wrapCallback=function(P){var Z=_;return function(){var $=_;_=Z;try{return P.apply(this,arguments)}finally{_=$}}}})(n_)),n_}var $2;function g7(){return $2||($2=1,t_.exports=m7()),t_.exports}var q2;function v7(){if(q2)return nd;q2=1;var e=g7(),t=a0(),n=GD();function i(r){var o="https://react.dev/errors/"+r;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)o+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+r+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function a(r){for(var o=r,c=o;c&&!c.alternate;)o=c,(o.flags&4098)!==0&&(r=o.return),c=o.return;for(;o.return;)o=o.return;return o.tag===3?r:null}function l(r){if(r.tag===13){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function u(r){if(r.tag===31){var o=r.memoizedState;if(o===null&&(r=r.alternate,r!==null&&(o=r.memoizedState)),o!==null)return o.dehydrated}return null}function f(r){if(a(r)!==r)throw Error(i(188))}function h(r){var o=r.alternate;if(!o){if(o=a(r),o===null)throw Error(i(188));return o!==r?null:r}for(var c=r,d=o;;){var v=c.return;if(v===null)break;var y=v.alternate;if(y===null){if(d=v.return,d!==null){c=d;continue}break}if(v.child===y.child){for(y=v.child;y;){if(y===c)return f(v),r;if(y===d)return f(v),o;y=y.sibling}throw Error(i(188))}if(c.return!==d.return)c=v,d=y;else{for(var E=!1,O=v.child;O;){if(O===c){E=!0,c=v,d=y;break}if(O===d){E=!0,d=v,c=y;break}O=O.sibling}if(!E){for(O=y.child;O;){if(O===c){E=!0,c=y,d=v;break}if(O===d){E=!0,d=y,c=v;break}O=O.sibling}if(!E)throw Error(i(189))}}if(c.alternate!==d)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?r:o}function g(r){var o=r.tag;if(o===5||o===26||o===27||o===6)return r;for(r=r.child;r!==null;){if(o=g(r),o!==null)return o;r=r.sibling}return null}function m(r,o,c,d,v,y){for(;r!==null;){if((r.tag===5||r.tag===27||r.tag===6)&&c(r,d,v,y)||(r.tag!==22||r.memoizedState===null)&&(o||r.tag!==5&&r.tag!==27)&&m(r.child,o,c,d,v,y))return!0;r=r.sibling}return!1}function _(r){for(r=r.return;r!==null;){if(r.tag===3||r.tag===5||r.tag===27)return r;r=r.return}return null}function b(r){var o=!1;for(r=r.return;r!==null&&(r.tag===4&&(o=!0),!(r.tag===3||r.tag===5||r.tag===27));)r=r.return;return o}function x(r){var o=[null,null],c=_(r);return c===null||S(o,r,c.child,{foundSelf:!1}),o}function S(r,o,c,d){for(;c!==null;){if(c===o)d.foundSelf=!0;else if(c.tag===5||c.tag===27||c.tag===6){if(d.foundSelf)return r[1]=c,!0;r[0]=c}else if((c.tag!==22||c.memoizedState===null)&&S(r,o,c.child,d))return!0;c=c.sibling}return!1}function C(r){switch(r.tag){case 5:case 27:case 6:return r.stateNode;case 3:return r.stateNode.containerInfo;default:throw Error(i(559))}}var k=null,R=null;function N(r,o,c){return r===c?!0:r===o?(k=r,!0):!1}function A(r,o,c){return r===c?(R=r,!1):r===o?(R!==null&&(k=r),!0):!1}function I(r){if(r===null)return null;do r=r===null?null:r.return;while(r&&r.tag!==5&&r.tag!==27&&r.tag!==3);return r||null}function T(r,o,c){for(var d=0,v=r;v;v=c(v))d++;v=0;for(var y=o;y;y=c(y))v++;for(;0<d-v;)r=c(r),d--;for(;0<v-d;)o=c(o),v--;for(;d--;){if(r===o||o!==null&&r===o.alternate)return r;r=c(r),o=c(o)}return null}var D=Object.assign,L=Symbol.for("react.element"),ee=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),B=Symbol.for("react.strict_mode"),W=Symbol.for("react.profiler"),te=Symbol.for("react.consumer"),G=Symbol.for("react.context"),P=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),$=Symbol.for("react.suspense_list"),ae=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),_e=Symbol.for("react.activity"),Le=Symbol.for("react.legacy_hidden"),z=Symbol.for("react.memo_cache_sentinel"),M=Symbol.for("react.view_transition"),K=Symbol.for("react.recoverable"),ne=Symbol.iterator;function me(r){return r===null||typeof r!="object"?null:(r=ne&&r[ne]||r["@@iterator"],typeof r=="function"?r:null)}var Ee=Symbol.for("react.client.reference");function ve(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===Ee?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case F:return"Fragment";case W:return"Profiler";case B:return"StrictMode";case Z:return"Suspense";case $:return"SuspenseList";case _e:return"Activity";case M:return"ViewTransition"}if(typeof r=="object")switch(r.$$typeof){case U:return"Portal";case G:return r.displayName||"Context";case te:return(r._context.displayName||"Context")+".Consumer";case P:var o=r.render;return r=r.displayName,r||(r=o.displayName||o.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case ae:return o=r.displayName||null,o!==null?o:ve(r.type)||"Memo";case j:o=r._payload,r=r._init;try{return ve(r(o))}catch{}}return null}var Re=Array.isArray,re=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J={pending:!1,data:null,method:null,action:null},Ie=[],Ze=-1;function Ut(r){return{current:r}}function Et(r){0>Ze||(r.current=Ie[Ze],Ie[Ze]=null,Ze--)}function tt(r,o){Ze++,Ie[Ze]=r.current,r.current=o}var Lt=Ut(null),xt=Ut(null),Bt=Ut(null),Tr=Ut(null);function go(r,o){switch(tt(Bt,o),tt(xt,r),tt(Lt,null),o.nodeType){case 9:case 11:r=(r=o.documentElement)&&(r=r.namespaceURI)?eE(r):0;break;default:if(r=o.tagName,o=o.namespaceURI)o=eE(o),r=tE(o,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}Et(Lt),tt(Lt,r)}function Dr(){Et(Lt),Et(xt),Et(Bt)}function Wr(r){var o=r.memoizedState;o!==null&&(uc._currentValue=o.memoizedState,tt(Tr,r)),o=Lt.current;var c=tE(o,r.type);o!==c&&(tt(xt,r),tt(Lt,c))}function Kr(r){xt.current===r&&(Et(Lt),Et(xt)),Tr.current===r&&(Et(Tr),uc._currentValue=J)}var le,ye;function Pe(r){if(le===void 0)try{throw Error()}catch(c){var o=c.stack.trim().match(/\n( *(at )?)/);le=o&&o[1]||"",ye=-1<c.stack.indexOf(`
43
- at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
44
- `+le+r+ye}var He=!1;function dn(r,o){if(!r||He)return"";He=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(o){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(xe){var Y=xe}Reflect.construct(r,[],ue)}else{try{ue.call()}catch(xe){Y=xe}ue=!1;try{var se=Object.getOwnPropertyDescriptor(r.prototype,"props");Object.defineProperty(r.prototype,"props",{configurable:!0,set:function(){throw Error()}}),ue=!0,new r}finally{ue&&(se!==void 0?Object.defineProperty(r.prototype,"props",se):delete r.prototype.props)}}}else{try{throw Error()}catch(xe){Y=xe}(ue=r())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(xe){if(xe&&Y&&typeof xe.stack=="string")return[xe.stack,Y.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=d.DetermineComponentFrameRoot(),E=y[0],O=y[1];if(E&&O){var H=E.split(`
45
- `),Q=O.split(`
46
- `);for(v=d=0;d<H.length&&!H[d].includes("DetermineComponentFrameRoot");)d++;for(;v<Q.length&&!Q[v].includes("DetermineComponentFrameRoot");)v++;if(d===H.length||v===Q.length)for(d=H.length-1,v=Q.length-1;1<=d&&0<=v&&H[d]!==Q[v];)v--;for(;1<=d&&0<=v;d--,v--)if(H[d]!==Q[v]){if(d!==1||v!==1)do if(d--,v--,0>v||H[d]!==Q[v]){var oe=`
47
- `+H[d].replace(" at new "," at ");return r.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",r.displayName)),oe}while(1<=d&&0<=v);break}}}finally{He=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?Pe(c):""}function St(r,o){switch(r.tag){case 26:case 27:case 5:return Pe(r.type);case 16:return Pe("Lazy");case 13:return r.child!==o&&o!==null?Pe("Suspense Fallback"):Pe("Suspense");case 19:return Pe("SuspenseList");case 0:case 15:return dn(r.type,!1);case 11:return dn(r.type.render,!1);case 1:return dn(r.type,!0);case 31:return Pe("Activity");case 30:return Pe("ViewTransition");default:return""}}function Be(r){try{var o="",c=null;do o+=St(r,c),c=r,r=r.return;while(r);return o}catch(d){return`
48
- Error generating stack: `+d.message+`
49
- `+d.stack}}var Ye=Object.prototype.hasOwnProperty,kn=e.unstable_scheduleCallback,hn=e.unstable_cancelCallback,Ei=e.unstable_shouldYield,Vr=e.unstable_requestPaint,_t=e.unstable_now,Mn=e.unstable_getCurrentPriorityLevel,Os=e.unstable_ImmediatePriority,lr=e.unstable_UserBlockingPriority,ch=e.unstable_NormalPriority,oP=e.unstable_LowPriority,kS=e.unstable_IdlePriority,aP=e.log,lP=e.unstable_setDisableYieldValue,au=null,Bi=null;function vo(r){if(typeof aP=="function"&&lP(r),Bi&&typeof Bi.setStrictMode=="function")try{Bi.setStrictMode(au,r)}catch{}}var Fi=Math.clz32?Math.clz32:dP,cP=Math.log,uP=Math.LN2;function dP(r){return r>>>=0,r===0?32:31-(cP(r)/uP|0)|0}var uh=256,dh=262144,hh=4194304;function ba(r){var o=r&42;if(o!==0)return o;switch(r&-r){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 r&-r;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function fh(r,o,c){var d=r.pendingLanes;if(d===0)return 0;var v=0,y=r.suspendedLanes,E=r.pingedLanes;r=r.warmLanes;var O=d&134217727;return O!==0?(d=O&~y,d!==0?v=ba(d):(E&=O,E!==0?v=ba(E):c||(c=O&~r,c!==0&&(v=ba(c))))):(O=d&~y,O!==0?v=ba(O):E!==0?v=ba(E):c||(c=d&~r,c!==0&&(v=ba(c)))),v===0?0:o!==0&&o!==v&&(o&y)===0&&(y=v&-v,c=o&-o,y>=c||y===32&&(c&4194048)!==0)?o:v}function lu(r,o){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&o)===0}function ES(r,o){(o&8)!==0&&(o|=o&32);var c=r.entangledLanes;if(c!==0)for(r=r.entanglements,c&=o;0<c;){var d=31-Fi(c),v=1<<d;o|=r[d],c&=~v}return o}function hP(r,o){switch(r){case 1:case 2:case 4:case 8:case 64:return o+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 o+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 NS(){var r=hh;return hh<<=1,(hh&62914560)===0&&(hh=4194304),r}function dg(r){for(var o=[],c=0;31>c;c++)o.push(r);return o}function cu(r,o){r.pendingLanes|=o,o!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function fP(r,o,c,d,v,y){var E=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var O=r.entanglements,H=r.expirationTimes,Q=r.hiddenUpdates;for(c=E&~c;0<c;){var oe=31-Fi(c),ue=1<<oe;O[oe]=0,H[oe]=-1;var Y=Q[oe];if(Y!==null)for(Q[oe]=null,oe=0;oe<Y.length;oe++){var se=Y[oe];se!==null&&(se.lane&=-536870913)}c&=~ue}d!==0&&RS(r,d,0),y!==0&&v===0&&r.tag!==0&&(r.suspendedLanes|=y&~(E&~o))}function RS(r,o,c){r.pendingLanes|=o,r.suspendedLanes&=~o;var d=31-Fi(o);r.entangledLanes|=o,r.entanglements[d]=r.entanglements[d]|1073741824|c&261930}function TS(r,o){var c=r.entangledLanes|=o;for(r=r.entanglements;c;){var d=31-Fi(c),v=1<<d;v&o|r[d]&o&&(r[d]|=o),c&=~v}}function DS(r,o){var c=o&-o;return c=(c&42)!==0?1:hg(c),(c&(r.suspendedLanes|o))!==0?0:c}function hg(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function fg(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function AS(){var r=he.p;return r!==0?r:(r=window.event,r===void 0?32:LE(r.type))}function OS(r,o){var c=he.p;try{return he.p=r,o()}finally{he.p=c}}var js=Math.random().toString(36).slice(2),Vn="__reactFiber$"+js,Ni="__reactProps$"+js,Cl="__reactContainer$"+js,jS="__reactEvents$"+js,pP="__reactListeners$"+js,mP="__reactHandles$"+js,zS="__reactResources$"+js,uu="__reactMarker$"+js,ph="__reactLoad$"+js;function mh(r){delete r[Vn],delete r[Ni],delete r[pP],delete r[mP]}function xa(r){var o;if(o=r[Vn])return o;for(var c=r.parentNode;c;){if(o=c[Cl]||c[Vn]){if(c=o.alternate,o.child!==null||c!==null&&c.child!==null)for(r=yE(r);r!==null;){if(c=r[Vn])return c;r=yE(r)}return o}r=c,c=r.parentNode}return null}function kl(r){if(r=r[Vn]||r[Cl]){var o=r.tag;if(o===5||o===6||o===13||o===31||o===26||o===27||o===3)return r}return null}function du(r){var o=r.tag;if(o===5||o===26||o===27||o===6)return r.stateNode;throw Error(i(33))}function El(r){var o=r[zS];return o||(o=r[zS]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function In(r){r[uu]=!0}function MS(r){r[ph]=void 0}var IS=new Set,PS={};function Sa(r,o){Nl(r,o),Nl(r+"Capture",o)}function Nl(r,o){for(PS[r]=o,r=0;r<o.length;r++)IS.add(o[r])}var gP=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]*$"),LS={},BS={};function vP(r){return Ye.call(BS,r)?!0:Ye.call(LS,r)?!1:gP.test(r)?BS[r]=!0:(LS[r]=!0,!1)}var pt=!1;function FS(){var r=pt;return pt=!1,r}function gh(r,o,c){if(vP(o))if(c===null)r.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":r.removeAttribute(o);return;case"boolean":var d=o.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(o);return}}r.setAttribute(o,c)}}function vh(r,o,c){if(c===null)r.removeAttribute(o);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(o);return}r.setAttribute(o,c)}}function zs(r,o,c,d){if(d===null)r.removeAttribute(c);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(c);return}r.setAttributeNS(o,c,d)}}function Ui(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function US(r){var o=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function yP(r,o,c){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,o);if(!r.hasOwnProperty(o)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var v=d.get,y=d.set;return Object.defineProperty(r,o,{configurable:!0,get:function(){return v.call(this)},set:function(E){c=""+E,y.call(this,E)}}),Object.defineProperty(r,o,{enumerable:d.enumerable}),{getValue:function(){return c},setValue:function(E){c=""+E},stopTracking:function(){r._valueTracker=null,delete r[o]}}}}function pg(r){if(!r._valueTracker){var o=US(r)?"checked":"value";r._valueTracker=yP(r,o,""+r[o])}}function HS(r){if(!r)return!1;var o=r._valueTracker;if(!o)return!0;var c=o.getValue(),d="";return r&&(d=US(r)?r.checked?"true":"false":r.value),r=d,r!==c?(o.setValue(r),!0):!1}var _P=/[\n"\\]/g;function cr(r){return r.replace(_P,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function mg(r,o,c,d,v,y,E,O){r.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?r.type=E:r.removeAttribute("type"),o!=null?E==="number"?(o===0&&r.value===""||r.value!=o)&&(r.value=""+Ui(o)):r.value!==""+Ui(o)&&(r.value=""+Ui(o)):E!=="submit"&&E!=="reset"||r.removeAttribute("value"),o!=null?E==="number"&&r.value==o?gg(r,Ui(r.value)):gg(r,Ui(o)):c!=null?gg(r,Ui(c)):d!=null&&r.removeAttribute("value"),v==null&&y!=null&&(r.defaultChecked=!!y),v!=null&&(r.checked=v&&typeof v!="function"&&typeof v!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?r.name=""+Ui(O):r.removeAttribute("name")}function $S(r,o,c,d,v,y,E,O){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(r.type=y),o!=null||c!=null){if(!(y!=="submit"&&y!=="reset"||o!=null)){pg(r);return}c=c!=null?""+Ui(c):"",o=o!=null?""+Ui(o):c,O||o===r.value||(r.value=o),r.defaultValue=o}d=d??v,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=O?r.checked:!!d,r.defaultChecked=!!d,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(r.name=E),pg(r)}function gg(r,o){r.defaultValue!==""+o&&(r.defaultValue=""+o)}function Rl(r,o,c,d){if(r=r.options,o){o={};for(var v=0;v<c.length;v++)o["$"+c[v]]=!0;for(c=0;c<r.length;c++)v=o.hasOwnProperty("$"+r[c].value),r[c].selected!==v&&(r[c].selected=v),v&&d&&(r[c].defaultSelected=!0)}else{for(c=""+Ui(c),o=null,v=0;v<r.length;v++){if(r[v].value===c){r[v].selected=!0,d&&(r[v].defaultSelected=!0);return}o!==null||r[v].disabled||(o=r[v])}o!==null&&(o.selected=!0)}}function qS(r,o,c){if(o!=null&&(o=""+Ui(o),o!==r.value&&(r.value=o),c==null)){r.defaultValue!==o&&(r.defaultValue=o);return}r.defaultValue=c!=null?""+Ui(c):""}function WS(r,o,c,d){if(o==null){if(d!=null){if(c!=null)throw Error(i(92));if(Re(d)){if(1<d.length)throw Error(i(93));d=d[0]}c=d}c==null&&(c=""),o=c}c=Ui(o),r.defaultValue=c,d=r.textContent,d===c&&d!==""&&d!==null&&(r.value=d),pg(r)}function Tl(r,o){if(o){var c=r.firstChild;if(c&&c===r.lastChild&&c.nodeType===3){c.nodeValue=o;return}}r.textContent=o}var bP=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 KS(r,o,c){var d=o.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?d?r.setProperty(o,""):o==="float"?r.cssFloat="":r[o]="":d?r.setProperty(o,c):typeof c!="number"||c===0||bP.has(o)?o==="float"?r.cssFloat=c:r[o]=(""+c).trim():r[o]=c+"px"}function VS(r,o,c){if(o!=null&&typeof o!="object")throw Error(i(62));if(r=r.style,c!=null){for(var d in c)!c.hasOwnProperty(d)||o!=null&&o.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="",pt=!0);for(var v in o)d=o[v],o.hasOwnProperty(v)&&c[v]!==d&&(KS(r,v,d),pt=!0)}else for(var y in o)o.hasOwnProperty(y)&&KS(r,y,o[y])}function vg(r){if(r.indexOf("-")===-1)return!1;switch(r){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 xP=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),SP=/^[\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 yh(r){return SP.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function Gr(){}var yg=null;function _g(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Dl=null,Al=null;function GS(r){var o=kl(r);if(o&&(r=o.stateNode)){var c=r[Ni]||null;e:switch(r=o.stateNode,o.type){case"input":if(mg(r,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),o=c.name,c.type==="radio"&&o!=null){for(c=r;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+cr(""+o)+'"][type="radio"]'),o=0;o<c.length;o++){var d=c[o];if(d!==r&&d.form===r.form){var v=d[Ni]||null;if(!v)throw Error(i(90));mg(d,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(o=0;o<c.length;o++)d=c[o],d.form===r.form&&HS(d)}break e;case"textarea":qS(r,c.value,c.defaultValue);break e;case"select":o=c.value,o!=null&&Rl(r,!!c.multiple,o,!1)}}}var bg=!1;function ZS(r,o,c){if(bg)return r(o,c);bg=!0;try{var d=r(o);return d}finally{if(bg=!1,(Dl!==null||Al!==null)&&(_f(),Dl&&(o=Dl,r=Al,Al=Dl=null,GS(o),r)))for(o=0;o<r.length;o++)GS(r[o])}}function hu(r,o){var c=r.stateNode;if(c===null)return null;var d=c[Ni]||null;if(d===null)return null;c=d[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(c&&typeof c!="function")throw Error(i(231,o,typeof c));return c}var Ms=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xg=!1;if(Ms)try{var fu={};Object.defineProperty(fu,"passive",{get:function(){xg=!0}}),window.addEventListener("test",fu,fu),window.removeEventListener("test",fu,fu)}catch{xg=!1}var yo=null,Sg=null,_h=null;function YS(){if(_h)return _h;var r,o=Sg,c=o.length,d,v="value"in yo?yo.value:yo.textContent,y=v.length;for(r=0;r<c&&o[r]===v[r];r++);var E=c-r;for(d=1;d<=E&&o[c-d]===v[y-d];d++);return _h=v.slice(r,1<d?1-d:void 0)}function bh(r){var o=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&o===13&&(r=13)):r=o,r===10&&(r=13),32<=r||r===13?r:0}function xh(){return!0}function XS(){return!1}function fi(r){function o(c,d,v,y,E){this._reactName=c,this._targetInst=v,this.type=d,this.nativeEvent=y,this.target=E,this.currentTarget=null;for(var O in r)r.hasOwnProperty(O)&&(c=r[O],this[O]=c?c(y):y[O]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?xh:XS,this.isPropagationStopped=XS,this}return D(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=xh)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=xh)},persist:function(){},isPersistent:xh}),o}var _o={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sh=fi(_o),pu=D({},_o,{view:0,detail:0}),wP=fi(pu),wg,Cg,mu,wh=D({},pu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Eg,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==mu&&(mu&&r.type==="mousemove"?(wg=r.screenX-mu.screenX,Cg=r.screenY-mu.screenY):Cg=wg=0,mu=r),wg)},movementY:function(r){return"movementY"in r?r.movementY:Cg}}),QS=fi(wh),CP=D({},wh,{dataTransfer:0}),kP=fi(CP),EP=D({},pu,{relatedTarget:0}),kg=fi(EP),NP=D({},_o,{animationName:0,elapsedTime:0,pseudoElement:0}),RP=fi(NP),TP=D({},_o,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),DP=fi(TP),AP=D({},_o,{data:0}),JS=fi(AP),OP={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},jP={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"},zP={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function MP(r){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(r):(r=zP[r])?!!o[r]:!1}function Eg(){return MP}var IP=D({},pu,{key:function(r){if(r.key){var o=OP[r.key]||r.key;if(o!=="Unidentified")return o}return r.type==="keypress"?(r=bh(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?jP[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Eg,charCode:function(r){return r.type==="keypress"?bh(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?bh(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),PP=fi(IP),LP=D({},wh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ew=fi(LP),BP=D({},_o,{submitter:0}),FP=fi(BP),UP=D({},pu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Eg}),HP=fi(UP),$P=D({},_o,{propertyName:0,elapsedTime:0,pseudoElement:0}),qP=fi($P),WP=D({},wh,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),KP=fi(WP),VP=D({},_o,{newState:0,oldState:0,source:0}),GP=fi(VP),ZP=[9,13,27,32],Ng=Ms&&"CompositionEvent"in window,gu=null;Ms&&"documentMode"in document&&(gu=document.documentMode);var YP=Ms&&"TextEvent"in window&&!gu,tw=Ms&&(!Ng||gu&&8<gu&&11>=gu),nw=" ",iw=!1;function rw(r,o){switch(r){case"keyup":return ZP.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sw(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Ol=!1;function XP(r,o){switch(r){case"compositionend":return sw(o);case"keypress":return o.which!==32?null:(iw=!0,nw);case"textInput":return r=o.data,r===nw&&iw?null:r;default:return null}}function QP(r,o){if(Ol)return r==="compositionend"||!Ng&&rw(r,o)?(r=YS(),_h=Sg=yo=null,Ol=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return tw&&o.locale!=="ko"?null:o.data;default:return null}}var JP={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 ow(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o==="input"?!!JP[r.type]:o==="textarea"}function aw(r,o,c,d){Dl?Al?Al.push(d):Al=[d]:Dl=d,o=kf(o,"onChange"),0<o.length&&(c=new Sh("onChange","change",null,c,d),r.push({event:c,listeners:o}))}var vu=null,yu=null;function e4(r){Gk(r,0)}function Ch(r){var o=du(r);if(HS(o))return r}function lw(r,o){if(r==="change")return o}var cw=!1;if(Ms){var Rg;if(Ms){var Tg="oninput"in document;if(!Tg){var uw=document.createElement("div");uw.setAttribute("oninput","return;"),Tg=typeof uw.oninput=="function"}Rg=Tg}else Rg=!1;cw=Rg&&(!document.documentMode||9<document.documentMode)}function dw(){vu&&(vu.detachEvent("onpropertychange",hw),yu=vu=null)}function hw(r){if(r.propertyName==="value"&&Ch(yu)){var o=[];aw(o,yu,r,_g(r)),ZS(e4,o)}}function t4(r,o,c){r==="focusin"?(dw(),vu=o,yu=c,vu.attachEvent("onpropertychange",hw)):r==="focusout"&&dw()}function n4(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Ch(yu)}function i4(r,o){if(r==="click")return Ch(o)}function r4(r,o){if(r==="input"||r==="change")return Ch(o)}function s4(r,o){return r===o&&(r!==0||1/r===1/o)||r!==r&&o!==o}var Hi=typeof Object.is=="function"?Object.is:s4;function _u(r,o){if(Hi(r,o))return!0;if(typeof r!="object"||r===null||typeof o!="object"||o===null)return!1;var c=Object.keys(r),d=Object.keys(o);if(c.length!==d.length)return!1;for(d=0;d<c.length;d++){var v=c[d];if(!Ye.call(o,v)||!Hi(r[v],o[v]))return!1}return!0}function Dg(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function fw(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function pw(r,o){var c=fw(r);r=0;for(var d;c;){if(c.nodeType===3){if(d=r+c.textContent.length,r<=o&&d>=o)return{node:c,offset:o-r};r=d}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=fw(c)}}function mw(r,o){return r&&o?r===o?!0:r&&r.nodeType===3?!1:o&&o.nodeType===3?mw(r,o.parentNode):"contains"in r?r.contains(o):r.compareDocumentPosition?!!(r.compareDocumentPosition(o)&16):!1:!1}function gw(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var o=Dg(r.document);o instanceof r.HTMLIFrameElement;){try{var c=typeof o.contentWindow.location.href=="string"}catch{c=!1}if(c)r=o.contentWindow;else break;o=Dg(r.document)}return o}function Ag(r){var o=r&&r.nodeName&&r.nodeName.toLowerCase();return o&&(o==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||o==="textarea"||r.contentEditable==="true")}var o4=Ms&&"documentMode"in document&&11>=document.documentMode,jl=null,Og=null,bu=null,jg=!1;function vw(r,o,c){var d=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;jg||jl==null||jl!==Dg(d)||(d=jl,"selectionStart"in d&&Ag(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),bu&&_u(bu,d)||(bu=d,d=kf(Og,"onSelect"),0<d.length&&(o=new Sh("onSelect","select",null,o,c),r.push({event:o,listeners:d}),o.target=jl)))}function wa(r,o){var c={};return c[r.toLowerCase()]=o.toLowerCase(),c["Webkit"+r]="webkit"+o,c["Moz"+r]="moz"+o,c}var zl={animationend:wa("Animation","AnimationEnd"),animationiteration:wa("Animation","AnimationIteration"),animationstart:wa("Animation","AnimationStart"),transitionrun:wa("Transition","TransitionRun"),transitionstart:wa("Transition","TransitionStart"),transitioncancel:wa("Transition","TransitionCancel"),transitionend:wa("Transition","TransitionEnd")},zg={},yw={};Ms&&(yw=document.createElement("div").style,"AnimationEvent"in window||(delete zl.animationend.animation,delete zl.animationiteration.animation,delete zl.animationstart.animation),"TransitionEvent"in window||delete zl.transitionend.transition);function Ca(r){if(zg[r])return zg[r];if(!zl[r])return r;var o=zl[r],c;for(c in o)if(o.hasOwnProperty(c)&&c in yw)return zg[r]=o[c];return r}var _w=Ca("animationend"),bw=Ca("animationiteration"),xw=Ca("animationstart"),a4=Ca("transitionrun"),l4=Ca("transitionstart"),c4=Ca("transitioncancel"),Sw=Ca("transitionend"),ww=new Map,Mg="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Mg.push("scrollEnd");function Ar(r,o){ww.set(r,o),Sa(o,[r])}var u4=0;function Is(r,o){if(r.name!=null&&r.name!=="auto")return r.name;if(o.autoName!==null)return o.autoName;r=Mr.identifierPrefix;var c=u4++;return r="_"+r+"t_"+c.toString(32)+"_",o.autoName=r}function Cw(r){if(r==null||typeof r=="string")return r;var o=null,c=ec;if(c!==null)for(var d=0;d<c.length;d++){var v=r[c[d]];if(v!=null){if(v==="none")return"none";o=o==null?v:o+(" "+v)}}return o??r.default}function Ps(r,o){return r=Cw(r),o=Cw(o),o==null?r==="auto"?null:r:o==="auto"?null:o}var kh=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},ur=[],Ml=0,Ig=0;function Eh(){for(var r=Ml,o=Ig=Ml=0;o<r;){var c=ur[o];ur[o++]=null;var d=ur[o];ur[o++]=null;var v=ur[o];ur[o++]=null;var y=ur[o];if(ur[o++]=null,d!==null&&v!==null){var E=d.pending;E===null?v.next=v:(v.next=E.next,E.next=v),d.pending=v}y!==0&&kw(c,v,y)}}function Nh(r,o,c,d){ur[Ml++]=r,ur[Ml++]=o,ur[Ml++]=c,ur[Ml++]=d,Ig|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function Pg(r,o,c,d){return Nh(r,o,c,d),Rh(r)}function ka(r,o){return Nh(r,null,null,o),Rh(r)}function kw(r,o,c){r.lanes|=c;var d=r.alternate;d!==null&&(d.lanes|=c);for(var v=!1,y=r.return;y!==null;)y.childLanes|=c,d=y.alternate,d!==null&&(d.childLanes|=c),y.tag===22&&(r=y.stateNode,r===null||r._visibility&1||(v=!0)),r=y,y=y.return;return r.tag===3?(y=r.stateNode,v&&o!==null&&(v=31-Fi(c),r=y.hiddenUpdates,d=r[v],d===null?r[v]=[o]:d.push(o),o.lane=c|536870912),y):null}function Rh(r){if(50<Hu)throw Hu=0,yf=null,Error(i(185));for(var o=r.return;o!==null;)r=o,o=r.return;return r.tag===3?r.stateNode:null}var Il={};function d4(r,o,c,d){this.tag=r,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ri(r,o,c,d){return new d4(r,o,c,d)}function Lg(r){return r=r.prototype,!(!r||!r.isReactComponent)}function Ls(r,o){var c=r.alternate;return c===null?(c=Ri(r.tag,o,r.key,r.mode),c.elementType=r.elementType,c.type=r.type,c.stateNode=r.stateNode,c.alternate=r,r.alternate=c):(c.pendingProps=o,c.type=r.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=r.flags&1206910976,c.childLanes=r.childLanes,c.lanes=r.lanes,c.child=r.child,c.memoizedProps=r.memoizedProps,c.memoizedState=r.memoizedState,c.updateQueue=r.updateQueue,o=r.dependencies,c.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},c.sibling=r.sibling,c.index=r.index,c.ref=r.ref,c.refCleanup=r.refCleanup,c}function Ew(r,o){r.flags&=1206910978;var c=r.alternate;return c===null?(r.childLanes=0,r.lanes=o,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=c.childLanes,r.lanes=c.lanes,r.child=c.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=c.memoizedProps,r.memoizedState=c.memoizedState,r.updateQueue=c.updateQueue,r.type=c.type,o=c.dependencies,r.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),r}function Th(r,o,c,d,v,y){var E=0;if(d=r,typeof d=="function")Lg(d)&&(E=1);else if(typeof d=="string")E=BL(r,c,Lt.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(d){case _e:return r=Ri(31,c,o,v),r.elementType=_e,r.lanes=y,r;case F:return Ea(c.children,v,y,o);case B:E=8,v|=24;break;case W:return r=Ri(12,c,o,v|2),r.elementType=W,r.lanes=y,r;case Z:return r=Ri(13,c,o,v),r.elementType=Z,r.lanes=y,r;case $:return r=Ri(19,c,o,v),r.elementType=$,r.lanes=y,r;case Le:case M:return r=v|32,r=Ri(30,c,o,r),r.elementType=M,r.lanes=y,r.stateNode={autoName:null,paired:null,clones:null,ref:null},r;default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case G:E=10;break e;case te:E=9;break e;case P:E=11;break e;case ae:E=14;break e;case j:E=16,d=null;break e}E=29,c=Error(i(130,r===null?"null":typeof r,"")),d=null}return o=Ri(E,c,o,v),o.elementType=r,o.type=d,o.lanes=y,o}function Ea(r,o,c,d){return r=Ri(7,r,d,o),r.lanes=c,r}function Bg(r,o,c){return r=Ri(6,r,null,o),r.lanes=c,r}function Nw(r){var o=Ri(18,null,null,0);return o.stateNode=r,o}function Fg(r,o,c){return o=Ri(4,r.children!==null?r.children:[],r.key,o),o.lanes=c,o.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},o}var Rw=new WeakMap;function dr(r,o){if(typeof r=="object"&&r!==null){var c=Rw.get(r);return c!==void 0?c:(o={value:r,source:o,stack:Be(o)},Rw.set(r,o),o)}return{value:r,source:o,stack:Be(o)}}var Pl=[],Ll=0,Dh=null,xu=0,hr=[],fr=0,bo=null,Zr=1,Yr="";function Bs(r,o){Pl[Ll++]=xu,Pl[Ll++]=Dh,Dh=r,xu=o}function Tw(r,o,c){hr[fr++]=Zr,hr[fr++]=Yr,hr[fr++]=bo,bo=r;var d=Zr;r=Yr;var v=32-Fi(d)-1;d&=~(1<<v),c+=1;var y=32-Fi(o)+v;if(30<y){var E=v-v%5;y=(d&(1<<E)-1).toString(32),d>>=E,v-=E,Zr=1<<32-Fi(o)+v|c<<v|d,Yr=y+r}else Zr=1<<y|c<<v|d,Yr=r}function Ah(r){r.return!==null&&(Bs(r,1),Tw(r,1,0))}function Ug(r){for(;r===Dh;)Dh=Pl[--Ll],Pl[Ll]=null,xu=Pl[--Ll],Pl[Ll]=null;for(;r===bo;)bo=hr[--fr],hr[fr]=null,Yr=hr[--fr],hr[fr]=null,Zr=hr[--fr],hr[fr]=null}function Dw(r,o){hr[fr++]=Zr,hr[fr++]=Yr,hr[fr++]=bo,Zr=o.id,Yr=o.overflow,bo=r}var Pn=null,zt=null,nt=!1,xo=null,pr=!1,Hg=Error(i(519));function So(r){var o=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Su(dr(o,r)),Hg}function Aw(r){var o=r.stateNode,c=r.type,d=r.memoizedProps;switch(o[Vn]=r,o[Ni]=d,c){case"dialog":ut("cancel",o),ut("close",o);break;case"iframe":case"object":case"embed":ut("load",o);break;case"video":case"audio":for(c=0;c<qu.length;c++)ut(qu[c],o);break;case"source":ut("error",o);break;case"img":case"image":case"link":ut("error",o),ut("load",o);break;case"details":ut("toggle",o);break;case"input":ut("invalid",o),$S(o,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ut("invalid",o);break;case"textarea":ut("invalid",o),WS(o,d.value,d.defaultValue,d.children)}c=d.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||o.textContent===""+c||d.suppressHydrationWarning===!0||Qk(o.textContent,c)?(d.popover!=null&&(ut("beforetoggle",o),ut("toggle",o)),d.onScroll!=null&&ut("scroll",o),d.onScrollEnd!=null&&ut("scrollend",o),d.onClick!=null&&(o.onclick=Gr),o=!0):o=!1,o||So(r,!0)}function Oh(r){for(Pn=r.return;Pn;)switch(Pn.tag){case 5:case 31:case 13:pr=!1;return;case 27:case 3:pr=!0;return;default:Pn=Pn.return}}function Bl(r){if(r!==Pn)return!1;if(!nt)return Oh(r),nt=!0,!1;var o=r.tag,c;if((c=o!==3&&o!==27)&&((c=o===5)&&(c=r.type,c=!(c!=="form"&&c!=="button")||yy(r.type,r.memoizedProps)),c=!c),c&&zt&&So(r),Oh(r),o===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));zt=vE(r)}else if(o===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));zt=vE(r)}else o===27?(o=zt,Lo(r.type)?(r=Ny,Ny=null,zt=r):zt=o):zt=Pn?gr(r.stateNode.nextSibling):null;return!0}function Na(){zt=Pn=null,nt=!1}function $g(){var r=xo;return r!==null&&(Ai===null?Ai=r:Ai.push.apply(Ai,r),xo=null),r}function Su(r){xo===null?xo=[r]:xo.push(r)}var qg=Ut(null),Ra=null,Fs=null;function wo(r,o,c){tt(qg,o._currentValue),o._currentValue=c}function Us(r){r._currentValue=qg.current,Et(qg)}function jh(r,o,c){for(;r!==null;){var d=r.alternate;if((r.childLanes&o)!==o?(r.childLanes|=o,d!==null&&(d.childLanes|=o)):d!==null&&(d.childLanes&o)!==o&&(d.childLanes|=o),r===c)break;r=r.return}}function Wg(r,o,c,d){var v=r.child;for(v!==null&&(v.return=r);v!==null;){var y=v.dependencies;if(y!==null){var E=v.child;y=y.firstContext;e:for(;y!==null;){var O=y;y=v;for(var H=0;H<o.length;H++)if(O.context===o[H]){y.lanes|=c,O=y.alternate,O!==null&&(O.lanes|=c),jh(y.return,c,r),d||(E=null);break e}y=O.next}}else if(v.tag===18){if(E=v.return,E===null)throw Error(i(341));E.lanes|=c,y=E.alternate,y!==null&&(y.lanes|=c),jh(E,c,r),E=null}else v.tag===13&&v.memoizedState!==null&&v.memoizedState.dehydrated===null?(v.lanes|=c,E=v.alternate,E!==null&&(E.lanes|=c),jh(v.return,c,r),E=v.child,E=E!==null?E.sibling:null):E=v.child;if(E!==null)E.return=v;else for(E=v;E!==null;){if(E===r){E=null;break}if(v=E.sibling,v!==null){v.return=E.return,E=v;break}E=E.return}v=E}}function Ta(r,o,c,d){r=null;for(var v=o,y=!1;v!==null;){if(!y){if((v.flags&524288)!==0)y=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var E=v.alternate;if(E===null)throw Error(i(387));if(E=E.memoizedProps,E!==null){var O=v.type;Hi(v.pendingProps.value,E.value)||(r!==null?r.push(O):r=[O])}}else if(v===Tr.current){if(E=v.alternate,E===null)throw Error(i(387));E.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(r!==null?r.push(uc):r=[uc])}v=v.return}return r!==null&&Wg(o,r,c,d),o.flags|=262144,r!==null}function zh(r){for(r=r.firstContext;r!==null;){if(!Hi(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Da(r){Ra=r,Fs=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function Gn(r){return Ow(Ra,r)}function Mh(r,o){return Ra===null&&Da(r),Ow(r,o)}function Ow(r,o){var c=o._currentValue;if(o={context:o,memoizedValue:c,next:null},Fs===null){if(r===null)throw Error(i(308));Fs=o,r.dependencies={lanes:0,firstContext:o},r.flags|=524288}else Fs=Fs.next=o;return c}var h4=typeof AbortController<"u"?AbortController:function(){var r=[],o=this.signal={aborted:!1,addEventListener:function(c,d){r.push(d)}};this.abort=function(){o.aborted=!0,r.forEach(function(c){return c()})}},f4=e.unstable_scheduleCallback,p4=e.unstable_NormalPriority,fn={$$typeof:G,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Kg(){return{controller:new h4,data:new Map,refCount:0}}function wu(r){r.refCount--,r.refCount===0&&f4(p4,function(){r.controller.abort()})}function jw(r,o){if((r.pendingLanes&4194048)!==0){var c=r.transitionTypes;for(c===null&&(c=r.transitionTypes=[]),r=0;r<o.length;r++){var d=o[r];c.indexOf(d)===-1&&c.push(d)}}}var Cu=null;function m4(r){var o=r.transitionTypes;return r.transitionTypes=null,o}var ku=null,Vg=0,Aa=0,Fl=null;function g4(r,o){if(ku===null){var c=ku=[];Vg=0,Aa=cy(),Fl={status:"pending",value:void 0,then:function(d){c.push(d)}}}return Vg++,o.then(zw,zw),o}function zw(){if(--Vg===0&&(Cu=null,ku!==null)){Fl!==null&&(Fl.status="fulfilled");var r=ku;ku=null,Aa=0,Fl=null;for(var o=0;o<r.length;o++)(0,r[o])()}}function v4(r,o){var c=[],d={status:"pending",value:null,reason:null,then:function(v){c.push(v)}};return r.then(function(){d.status="fulfilled",d.value=o;for(var v=0;v<c.length;v++)(0,c[v])(o)},function(v){for(d.status="rejected",d.reason=v,v=0;v<c.length;v++)(0,c[v])(void 0)}),d}var Mw=re.S;re.S=function(r,o){if(Nk=_t(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&g4(r,o),Cu!==null)for(var c=rc;c!==null;)jw(c,Cu),c=c.next;if(c=r.types,c!==null){for(var d=rc;d!==null;)jw(d,c),d=d.next;if(Aa!==0){d=Cu,d===null&&(d=Cu=[]);for(var v=0;v<c.length;v++){var y=c[v];d.indexOf(y)===-1&&d.push(y)}}}Mw!==null&&Mw(r,o)};var Oa=Ut(null);function Gg(){var r=Oa.current;return r!==null?r:At.pooledCache}function Ih(r,o){o===null?tt(Oa,Oa.current):tt(Oa,o.pool)}function Iw(){var r=Gg();return r===null?null:{parent:fn._currentValue,pool:r}}var Ul=Error(i(460)),Zg=Error(i(474)),Ph=Error(i(542)),Lh={then:function(){}};function Pw(r){return r=r.status,r==="fulfilled"||r==="rejected"}function Lw(r,o,c){switch(c=r[c],c===void 0?r.push(o):c!==o&&(o.then(Gr,Gr),o=c),o.status){case"fulfilled":return o.value;case"rejected":throw r=o.reason,Fw(r),r===void 0&&!("reason"in o)?Error(i(600)):r;default:if(typeof o.status=="string")o.then(Gr,Gr);else{if(r=At,r!==null&&100<r.shellSuspendCounter)throw Error(i(482));r=o,r.status="pending",r.then(function(d){if(o.status==="pending"){var v=o;v.status="fulfilled",v.value=d}},function(d){if(o.status==="pending"){var v=o;v.status="rejected",v.reason=d}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw r=o.reason,Fw(r),r}throw za=o,Ul}}function ja(r){try{var o=r._init;return o(r._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(za=c,Ul):c}}var za=null;function Bw(){if(za===null)throw Error(i(459));var r=za;return za=null,r}function Fw(r){if(r===Ul||r===Ph)throw Error(i(483))}var Hl=null,Eu=0;function Bh(r){var o=Eu;return Eu+=1,Hl===null&&(Hl=[]),Lw(Hl,r,o)}function Co(r,o){o=o.props.ref,r.ref=o!==void 0?o:null}function Fh(r,o){throw o.$$typeof===L?Error(i(525)):(r=Object.prototype.toString.call(o),Error(i(31,r==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":r)))}function Uw(r){function o(X,q){if(r){var ie=X.deletions;ie===null?(X.deletions=[q],X.flags|=16):ie.push(q)}}function c(X,q){if(!r)return null;for(;q!==null;)o(X,q),q=q.sibling;return null}function d(X){for(var q=new Map;X!==null;)X.key===null?q.set(X.index,X):q.set(X.key,X),X=X.sibling;return q}function v(X,q){return X=Ls(X,q),X.index=0,X.sibling=null,X}function y(X,q,ie){return X.index=ie,r?(ie=X.alternate,ie!==null?(ie=ie.index,ie<q?(X.flags|=2,q):ie):(X.flags|=134217730,q)):(X.flags|=1048576,q)}function E(X){return r&&X.alternate===null&&(X.flags|=134217730),X}function O(X,q,ie,ce){return q===null||q.tag!==6?(q=Bg(ie,X.mode,ce),q.return=X,q):(q=v(q,ie),q.return=X,q)}function H(X,q,ie,ce){var Ne=ie.type;return Ne===F?(X=oe(X,q,ie.props.children,ce,ie.key),Co(X,ie),X):q!==null&&(q.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===j&&ja(Ne)===q.type)?(q=v(q,ie.props),Co(q,ie),q.return=X,q):(q=Th(ie.type,ie.key,ie.props,null,X.mode,ce),Co(q,ie),q.return=X,q)}function Q(X,q,ie,ce){return q===null||q.tag!==4||q.stateNode.containerInfo!==ie.containerInfo||q.stateNode.implementation!==ie.implementation?(q=Fg(ie,X.mode,ce),q.return=X,q):(q=v(q,ie.children||[]),q.return=X,q)}function oe(X,q,ie,ce,Ne){return q===null||q.tag!==7?(q=Ea(ie,X.mode,ce,Ne),q.return=X,q):(q=v(q,ie),q.return=X,q)}function ue(X,q,ie){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=Bg(""+q,X.mode,ie),q.return=X,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case ee:return ie=Th(q.type,q.key,q.props,null,X.mode,ie),Co(ie,q),ie.return=X,ie;case U:return q=Fg(q,X.mode,ie),q.return=X,q;case j:return q=ja(q),ue(X,q,ie)}if(Re(q)||me(q))return q=Ea(q,X.mode,ie,null),q.return=X,q;if(typeof q.then=="function")return ue(X,Bh(q),ie);if(q.$$typeof===G)return ue(X,Mh(X,q),ie);Fh(X,q)}return null}function Y(X,q,ie,ce){var Ne=q!==null?q.key:null;if(typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint")return Ne!==null?null:O(X,q,""+ie,ce);if(typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case ee:return ie.key===Ne?H(X,q,ie,ce):null;case U:return ie.key===Ne?Q(X,q,ie,ce):null;case j:return ie=ja(ie),Y(X,q,ie,ce)}if(Re(ie)||me(ie))return Ne!==null?null:oe(X,q,ie,ce,null);if(typeof ie.then=="function")return Y(X,q,Bh(ie),ce);if(ie.$$typeof===G)return Y(X,q,Mh(X,ie),ce);Fh(X,ie)}return null}function se(X,q,ie,ce,Ne){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return X=X.get(ie)||null,O(q,X,""+ce,Ne);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case ee:return X=X.get(ce.key===null?ie:ce.key)||null,H(q,X,ce,Ne);case U:return X=X.get(ce.key===null?ie:ce.key)||null,Q(q,X,ce,Ne);case j:return ce=ja(ce),se(X,q,ie,ce,Ne)}if(Re(ce)||me(ce))return X=X.get(ie)||null,oe(q,X,ce,Ne,null);if(typeof ce.then=="function")return se(X,q,ie,Bh(ce),Ne);if(ce.$$typeof===G)return se(X,q,ie,Mh(q,ce),Ne);Fh(q,ce)}return null}function xe(X,q,ie,ce){for(var Ne=null,ht=null,Me=q,Ue=q=0,gn=null;Me!==null&&Ue<ie.length;Ue++){Me.index>Ue?(gn=Me,Me=null):gn=Me.sibling;var ft=Y(X,Me,ie[Ue],ce);if(ft===null){Me===null&&(Me=gn);break}r&&Me&&ft.alternate===null&&o(X,Me),q=y(ft,q,Ue),ht===null?Ne=ft:ht.sibling=ft,ht=ft,Me=gn}if(Ue===ie.length)return c(X,Me),nt&&Bs(X,Ue),Ne;if(Me===null){for(;Ue<ie.length;Ue++)Me=ue(X,ie[Ue],ce),Me!==null&&(q=y(Me,q,Ue),ht===null?Ne=Me:ht.sibling=Me,ht=Me);return nt&&Bs(X,Ue),Ne}for(Me=d(Me);Ue<ie.length;Ue++)gn=se(Me,X,Ue,ie[Ue],ce),gn!==null&&(r&&(ft=gn.alternate,ft!==null&&Me.delete(ft.key===null?Ue:ft.key)),q=y(gn,q,Ue),ht===null?Ne=gn:ht.sibling=gn,ht=gn);return r&&Me.forEach(function($o){return o(X,$o)}),nt&&Bs(X,Ue),Ne}function je(X,q,ie,ce){if(ie==null)throw Error(i(151));for(var Ne=null,ht=null,Me=q,Ue=q=0,gn=null,ft=ie.next();Me!==null&&!ft.done;Ue++,ft=ie.next()){Me.index>Ue?(gn=Me,Me=null):gn=Me.sibling;var $o=Y(X,Me,ft.value,ce);if($o===null){Me===null&&(Me=gn);break}r&&Me&&$o.alternate===null&&o(X,Me),q=y($o,q,Ue),ht===null?Ne=$o:ht.sibling=$o,ht=$o,Me=gn}if(ft.done)return c(X,Me),nt&&Bs(X,Ue),Ne;if(Me===null){for(;!ft.done;Ue++,ft=ie.next())ft=ue(X,ft.value,ce),ft!==null&&(q=y(ft,q,Ue),ht===null?Ne=ft:ht.sibling=ft,ht=ft);return nt&&Bs(X,Ue),Ne}for(Me=d(Me);!ft.done;Ue++,ft=ie.next())ft=se(Me,X,Ue,ft.value,ce),ft!==null&&(r&&(gn=ft.alternate,gn!==null&&Me.delete(gn.key===null?Ue:gn.key)),q=y(ft,q,Ue),ht===null?Ne=ft:ht.sibling=ft,ht=ft);return r&&Me.forEach(function(XL){return o(X,XL)}),nt&&Bs(X,Ue),Ne}function Qe(X,q,ie,ce){if(typeof ie=="object"&&ie!==null&&ie.type===F&&ie.key===null&&ie.props.ref===void 0&&(ie=ie.props.children),typeof ie=="object"&&ie!==null){switch(ie.$$typeof){case ee:e:{for(var Ne=ie.key;q!==null;){if(q.key===Ne){if(Ne=ie.type,Ne===F){if(q.tag===7){c(X,q.sibling),ce=v(q,ie.props.children),Co(ce,ie),ce.return=X,X=ce;break e}}else if(q.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===j&&ja(Ne)===q.type){c(X,q.sibling),ce=v(q,ie.props),Co(ce,ie),ce.return=X,X=ce;break e}c(X,q);break}else o(X,q);q=q.sibling}ie.type===F?(ce=Ea(ie.props.children,X.mode,ce,ie.key),Co(ce,ie),ce.return=X,X=ce):(ce=Th(ie.type,ie.key,ie.props,null,X.mode,ce),Co(ce,ie),ce.return=X,X=ce)}return E(X);case U:e:{for(Ne=ie.key;q!==null;){if(q.key===Ne)if(q.tag===4&&q.stateNode.containerInfo===ie.containerInfo&&q.stateNode.implementation===ie.implementation){c(X,q.sibling),ce=v(q,ie.children||[]),ce.return=X,X=ce;break e}else{c(X,q);break}else o(X,q);q=q.sibling}ce=Fg(ie,X.mode,ce),ce.return=X,X=ce}return E(X);case j:return ie=ja(ie),Qe(X,q,ie,ce)}if(Re(ie))return xe(X,q,ie,ce);if(me(ie)){if(Ne=me(ie),typeof Ne!="function")throw Error(i(150));return ie=Ne.call(ie),je(X,q,ie,ce)}if(typeof ie.then=="function")return Qe(X,q,Bh(ie),ce);if(ie.$$typeof===G)return Qe(X,q,Mh(X,ie),ce);Fh(X,ie)}return typeof ie=="string"&&ie!==""||typeof ie=="number"||typeof ie=="bigint"?(ie=""+ie,q!==null&&q.tag===6?(c(X,q.sibling),ce=v(q,ie),ce.return=X,X=ce):(c(X,q),ce=Bg(ie,X.mode,ce),ce.return=X,X=ce),E(X)):c(X,q)}return function(X,q,ie,ce){try{Eu=0;var Ne=Qe(X,q,ie,ce);return Hl=null,Ne}catch(Me){if(Me===Ul||Me===Ph)throw Me;var ht=Ri(29,Me,null,X.mode);return ht.lanes=ce,ht.return=X,ht}}}var Ma=Uw(!0),Hw=Uw(!1),ko=!1;function Yg(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xg(r,o){r=r.updateQueue,o.updateQueue===r&&(o.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Eo(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function No(r,o,c){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(gt&2)!==0){var v=d.pending;return v===null?o.next=o:(o.next=v.next,v.next=o),d.pending=o,o=Rh(r),kw(r,null,c),o}return Nh(r,d,o,c),Rh(r)}function Nu(r,o,c){if(o=o.updateQueue,o!==null&&(o=o.shared,(c&4194048)!==0)){var d=o.lanes;d&=r.pendingLanes,c|=d,o.lanes=c,TS(r,c)}}function Qg(r,o){var c=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,c===d)){var v=null,y=null;if(c=c.firstBaseUpdate,c!==null){do{var E={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};y===null?v=y=E:y=y.next=E,c=c.next}while(c!==null);y===null?v=y=o:y=y.next=o}else v=y=o;c={baseState:d.baseState,firstBaseUpdate:v,lastBaseUpdate:y,shared:d.shared,callbacks:d.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=o:r.next=o,c.lastBaseUpdate=o}var Jg=!1;function Ru(){if(Jg){var r=Fl;if(r!==null)throw r}}function Tu(r,o,c,d){Jg=!1;var v=r.updateQueue;ko=!1;var y=v.firstBaseUpdate,E=v.lastBaseUpdate,O=v.shared.pending;if(O!==null){v.shared.pending=null;var H=O,Q=H.next;H.next=null,E===null?y=Q:E.next=Q,E=H;var oe=r.alternate;oe!==null&&(oe=oe.updateQueue,O=oe.lastBaseUpdate,O!==E&&(O===null?oe.firstBaseUpdate=Q:O.next=Q,oe.lastBaseUpdate=H))}if(y!==null){var ue=v.baseState;E=0,oe=Q=H=null,O=y;do{var Y=O.lane&-536870913,se=Y!==O.lane;if(se?(dt&Y)===Y:(d&Y)===Y){Y!==0&&Y===Aa&&(Jg=!0),oe!==null&&(oe=oe.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var xe=r,je=O;Y=o;var Qe=c;switch(je.tag){case 1:if(xe=je.payload,typeof xe=="function"){ue=xe.call(Qe,ue,Y);break e}ue=xe;break e;case 3:xe.flags=xe.flags&-65537|128;case 0:if(xe=je.payload,Y=typeof xe=="function"?xe.call(Qe,ue,Y):xe,Y==null)break e;ue=D({},ue,Y);break e;case 2:ko=!0}}Y=O.callback,Y!==null&&(r.flags|=64,se&&(r.flags|=8192),se=v.callbacks,se===null?v.callbacks=[Y]:se.push(Y))}else se={lane:Y,tag:O.tag,payload:O.payload,callback:O.callback,next:null},oe===null?(Q=oe=se,H=ue):oe=oe.next=se,E|=Y;if(O=O.next,O===null){if(O=v.shared.pending,O===null)break;se=O,O=se.next,se.next=null,v.lastBaseUpdate=se,v.shared.pending=null}}while(!0);oe===null&&(H=ue),v.baseState=H,v.firstBaseUpdate=Q,v.lastBaseUpdate=oe,y===null&&(v.shared.lanes=0),zo|=E,r.lanes=E,r.memoizedState=ue}}function $w(r,o){if(typeof r!="function")throw Error(i(191,r));r.call(o)}function qw(r,o){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;r<c.length;r++)$w(c[r],o)}var Ro=Ut(null),Uh=Ut(0);function Ww(r,o){r=Ks,tt(Uh,r),tt(Ro,o),Ks=r|o.baseLanes}function ev(){tt(Uh,Ks),tt(Ro,Ro.current)}function tv(){Ks=Uh.current,Et(Ro),Et(Uh)}var Zn=Ut(null),oi=null;function To(r){var o=r.alternate;tt(Yn,Yn.current&1),tt(Zn,r),oi===null&&(o===null||Ro.current!==null||o.memoizedState!==null)&&(oi=r)}function nv(r){tt(Yn,Yn.current),tt(Zn,r),oi===null&&(oi=r)}function Kw(r){r.tag===22?(tt(Yn,Yn.current),tt(Zn,r),oi===null&&(oi=r)):Do()}function Do(){tt(Yn,Yn.current),tt(Zn,Zn.current)}function $i(r){Et(Zn),oi===r&&(oi=null),Et(Yn)}var Yn=Ut(0);function Du(r,o){tt(Zn,Zn.current),tt(Yn,o)}function iv(r){Et(Yn),Et(Zn),oi===r&&(oi=null)}function Hh(r){for(var o=r;o!==null;){if(o.tag===13){var c=o.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||ky(c)||Ey(c)))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!=="independent"){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Hs=0,Xe=null,Nt=null,pn=null,$h=!1,$l=!1,Ia=!1,qh=0,Au=0,ql=null,y4=0;function en(){throw Error(i(321))}function rv(r,o){if(o===null)return!1;for(var c=0;c<o.length&&c<r.length;c++)if(!Hi(r[c],o[c]))return!1;return!0}function sv(r,o,c,d,v,y){return Hs=y,Xe=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,re.H=r===null||r.memoizedState===null?TC:DC,Ia=!1,y=c(d,v),Ia=!1,$l&&(y=Gw(o,c,d,v)),Vw(r),y}function Vw(r){re.H=Xh;var o=Nt!==null&&Nt.next!==null;if(Hs=0,pn=Nt=Xe=null,$h=!1,Au=0,ql=null,o)throw Error(i(300));r===null||mn||(r=r.dependencies,r!==null&&zh(r)&&(mn=!0))}function Gw(r,o,c,d){Xe=r;var v=0;do{if($l&&(ql=null),Au=0,$l=!1,25<=v)throw Error(i(301));if(v+=1,pn=Nt=null,r.updateQueue!=null){var y=r.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}re.H=E4,y=o(c,d)}while($l);return y}function _4(){var r=re.H,o=r.useState()[0];return o=typeof o.then=="function"?Ou(o):o,r=r.useState()[0],(Nt!==null?Nt.memoizedState:null)!==r&&(Xe.flags|=1024),o}function ov(){var r=qh!==0;return qh=0,r}function av(r,o,c){o.updateQueue=r.updateQueue,o.flags&=-2053,r.lanes&=~c}function lv(r){if($h){for(r=r.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}$h=!1}Hs=0,pn=Nt=Xe=null,$l=!1,Au=qh=0,ql=null}function pi(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return pn===null?Xe.memoizedState=pn=r:pn=pn.next=r,pn}function ln(){if(Nt===null){var r=Xe.alternate;r=r!==null?r.memoizedState:null}else r=Nt.next;var o=pn===null?Xe.memoizedState:pn.next;if(o!==null)pn=o,Nt=r;else{if(r===null)throw Xe.alternate===null?Error(i(467)):Error(i(310));Nt=r,r={memoizedState:Nt.memoizedState,baseState:Nt.baseState,baseQueue:Nt.baseQueue,queue:Nt.queue,next:null},pn===null?Xe.memoizedState=pn=r:pn=pn.next=r}return pn}function Wh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ou(r){var o=Au;return Au+=1,ql===null&&(ql=[]),r=Lw(ql,r,o),o=Xe,(pn===null?o.memoizedState:pn.next)===null&&(o=o.alternate,re.H=o===null||o.memoizedState===null?TC:DC),r}function Kh(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return Ou(r);if(r.$$typeof===K)return;if(r.$$typeof===G)return Gn(r)}throw Error(i(438,String(r)))}function cv(r){var o=null,c=Xe.updateQueue;if(c!==null&&(o=c.memoCache),o==null){var d=Xe.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(o={data:d.data.map(function(v){return v.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),c===null&&(c=Wh(),Xe.updateQueue=c),c.memoCache=o,c=o.data[o.index],c===void 0)for(c=o.data[o.index]=Array(r),d=0;d<r;d++)c[d]=z;return o.index++,c}function $s(r,o){return typeof o=="function"?o(r):o}function Vh(r){var o=ln();return uv(o,Nt,r)}function uv(r,o,c){var d=r.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=c;var v=r.baseQueue,y=d.pending;if(y!==null){if(v!==null){var E=v.next;v.next=y.next,y.next=E}o.baseQueue=v=y,d.pending=null}if(y=r.baseState,v===null)r.memoizedState=y;else{o=v.next;var O=E=null,H=null,Q=o,oe=!1;do{var ue=Q.lane&-536870913;if(ue!==Q.lane?(dt&ue)===ue:(Hs&ue)===ue){var Y=Q.revertLane;if(Y===0)H!==null&&(H=H.next={lane:0,revertLane:0,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null}),ue===Aa&&(oe=!0);else if((Hs&Y)===Y){Q=Q.next,Y===Aa&&(oe=!0);continue}else ue={lane:0,revertLane:Q.revertLane,gesture:null,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},H===null?(O=H=ue,E=y):H=H.next=ue,Xe.lanes|=Y,zo|=Y;ue=Q.action,Ia&&c(y,ue),y=Q.hasEagerState?Q.eagerState:c(y,ue)}else Y={lane:ue,revertLane:Q.revertLane,gesture:Q.gesture,action:Q.action,hasEagerState:Q.hasEagerState,eagerState:Q.eagerState,next:null},H===null?(O=H=Y,E=y):H=H.next=Y,Xe.lanes|=ue,zo|=ue;Q=Q.next}while(Q!==null&&Q!==o);if(H===null?E=y:H.next=O,!Hi(y,r.memoizedState)&&(mn=!0,oe&&(c=Fl,c!==null)))throw c;r.memoizedState=y,r.baseState=E,r.baseQueue=H,d.lastRenderedState=y}return v===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function dv(r){var o=ln(),c=o.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=r;var d=c.dispatch,v=c.pending,y=o.memoizedState;if(v!==null){c.pending=null;var E=v=v.next;do y=r(y,E.action),E=E.next;while(E!==v);Hi(y,o.memoizedState)||(mn=!0),o.memoizedState=y,o.baseQueue===null&&(o.baseState=y),c.lastRenderedState=y}return[y,d]}function Zw(r,o,c){var d=Xe,v=ln(),y=nt;if(y){if(c===void 0)throw Error(i(407));c=c()}else c=o();var E=!Hi((Nt||v).memoizedState,c);if(E&&(v.memoizedState=c,mn=!0),v=v.queue,pv(Qw.bind(null,d,v,r),[r]),r=v.getSnapshot!==o||E||pn!==null&&(pn.memoizedState.tag&1)!==0,Wl(r?9:8,{destroy:void 0},Xw.bind(null,d,v,c,o),null),r){if(d.flags|=2048,At===null)throw Error(i(349));y||(Hs&127)!==0||Yw(d,o,c)}return c}function Yw(r,o,c){r.flags|=16384,r={getSnapshot:o,value:c},o=Xe.updateQueue,o===null?(o=Wh(),Xe.updateQueue=o,o.stores=[r]):(c=o.stores,c===null?o.stores=[r]:c.push(r))}function Xw(r,o,c,d){o.value=c,o.getSnapshot=d,Jw(o)&&eC(r)}function Qw(r,o,c){return c(function(){Jw(o)&&eC(r)})}function Jw(r){var o=r.getSnapshot;r=r.value;try{var c=o();return!Hi(r,c)}catch{return!0}}function eC(r){var o=ka(r,2);o!==null&&Oi(o,r,2)}function hv(r){var o=pi();if(typeof r=="function"){var c=r;if(r=c(),Ia){vo(!0);try{c()}finally{vo(!1)}}}return o.memoizedState=o.baseState=r,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$s,lastRenderedState:r},o}function tC(r,o,c,d){return r.baseState=c,uv(r,Nt,typeof d=="function"?d:$s)}function b4(r,o,c,d,v){if(Yh(r))throw Error(i(485));if(r=o.action,r!==null){var y={payload:v,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){y.listeners.push(E)}};re.T!==null?c(!0):y.isTransition=!1,d(y),c=o.pending,c===null?(y.next=o.pending=y,nC(o,y)):(y.next=c.next,o.pending=c.next=y)}}function nC(r,o){var c=o.action,d=o.payload,v=r.state;if(o.isTransition){var y=re.T,E={};E.types=y!==null?y.types:null,re.T=E;try{var O=c(v,d),H=re.S;H!==null&&H(E,O),iC(r,o,O)}catch(Q){fv(r,o,Q)}finally{y!==null&&E.types!==null&&(y.types=E.types),re.T=y}}else try{y=c(v,d),iC(r,o,y)}catch(Q){fv(r,o,Q)}}function iC(r,o,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(d){rC(r,o,d)},function(d){return fv(r,o,d)}):rC(r,o,c)}function rC(r,o,c){o.status="fulfilled",o.value=c,sC(o),r.state=c,o=r.pending,o!==null&&(c=o.next,c===o?r.pending=null:(c=c.next,o.next=c,nC(r,c)))}function fv(r,o,c){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do o.status="rejected",o.reason=c,sC(o),o=o.next;while(o!==d)}r.action=null}function sC(r){r=r.listeners;for(var o=0;o<r.length;o++)(0,r[o])()}function oC(r,o){return o}function aC(r,o){if(nt){var c=At.formState;if(c!==null){e:{var d=Xe;if(nt){if(zt){t:{for(var v=zt,y=pr;v.nodeType!==8;){if(!y){v=null;break t}if(v=gr(v.nextSibling),v===null){v=null;break t}}y=v.data,v=y==="F!"||y==="F"?v:null}if(v){zt=gr(v.nextSibling),d=v.data==="F!";break e}}So(d)}d=!1}d&&(o=c[0])}}return c=pi(),c.memoizedState=c.baseState=o,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oC,lastRenderedState:o},c.queue=d,c=EC.bind(null,Xe,d),d.dispatch=c,d=hv(!1),y=_v.bind(null,Xe,!1,d.queue),d=pi(),v={state:o,dispatch:null,action:r,pending:null},d.queue=v,c=b4.bind(null,Xe,v,y,c),v.dispatch=c,d.memoizedState=r,[o,c,!1]}function lC(r){var o=ln();return cC(o,Nt,r)}function cC(r,o,c){if(o=uv(r,o,oC)[0],r=Vh($s)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var d=Ou(o)}catch(E){throw E===Ul?Ph:E}else d=o;o=ln();var v=o.queue,y=v.dispatch;return c!==o.memoizedState&&(Xe.flags|=2048,Wl(9,{destroy:void 0},x4.bind(null,v,c),null)),[d,y,r]}function x4(r,o){r.action=o}function uC(r){var o=ln(),c=Nt;if(c!==null)return cC(o,c,r);ln(),o=o.memoizedState,c=ln();var d=c.queue.dispatch;return c.memoizedState=r,[o,d,!1]}function Wl(r,o,c,d){return r={tag:r,create:c,deps:d,inst:o,next:null},o=Xe.updateQueue,o===null&&(o=Wh(),Xe.updateQueue=o),c=o.lastEffect,c===null?o.lastEffect=r.next=r:(d=c.next,c.next=r,r.next=d,o.lastEffect=r),r}function dC(){return ln().memoizedState}function Gh(r,o,c,d){var v=pi();Xe.flags|=r,v.memoizedState=Wl(1|o,{destroy:void 0},c,d===void 0?null:d)}function Zh(r,o,c,d){var v=ln();d=d===void 0?null:d;var y=v.memoizedState.inst;Nt!==null&&d!==null&&rv(d,Nt.memoizedState.deps)?v.memoizedState=Wl(o,y,c,d):(Xe.flags|=r,v.memoizedState=Wl(1|o,y,c,d))}function hC(r,o){Gh(8390656,8,r,o)}function pv(r,o){Zh(2048,8,r,o)}function S4(r){Xe.flags|=4;var o=Xe.updateQueue;if(o===null)o=Wh(),Xe.updateQueue=o,o.events=[r];else{var c=o.events;c===null?o.events=[r]:c.push(r)}}function fC(r){var o=ln().memoizedState;return S4({ref:o,nextImpl:r}),function(){if((gt&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}function pC(r,o){return Zh(4,2,r,o)}function mC(r,o){return Zh(4,4,r,o)}function gC(r,o){if(typeof o=="function"){r=r();var c=o(r);return function(){typeof c=="function"?c():o(null)}}if(o!=null)return r=r(),o.current=r,function(){o.current=null}}function vC(r,o,c){c=c!=null?c.concat([r]):null,Zh(4,4,gC.bind(null,o,r),c)}function mv(){}function yC(r,o){var c=ln();o=o===void 0?null:o;var d=c.memoizedState;return o!==null&&rv(o,d[1])?d[0]:(c.memoizedState=[r,o],r)}function _C(r,o){var c=ln();o=o===void 0?null:o;var d=c.memoizedState;if(o!==null&&rv(o,d[1]))return d[0];if(d=r(),Ia){vo(!0);try{r()}finally{vo(!1)}}return c.memoizedState=[d,o],d}function gv(r,o,c){return c===void 0||(Hs&1073741824)!==0&&(dt&261930)===0?r.memoizedState=o:(r.memoizedState=c,r=Tk(),Xe.lanes|=r,zo|=r,c)}function bC(r,o,c,d){return Hi(c,o)?c:Ro.current!==null?(r=gv(r,c,d),Hi(r,o)||(mn=!0),r):(Hs&106)===0||(Hs&1073741824)!==0&&(dt&261930)===0?(mn=!0,r.memoizedState=c):(r=Tk(),Xe.lanes|=r,zo|=r,o)}function xC(r,o,c,d,v){var y=he.p;he.p=y!==0&&8>y?y:8;var E=re.T,O={};O.types=E!==null?E.types:null,re.T=O,_v(r,!1,o,c);try{var H=v(),Q=re.S;if(Q!==null&&Q(O,H),H!==null&&typeof H=="object"&&typeof H.then=="function"){var oe=v4(H,d);ju(r,o,oe,Vi(r))}else ju(r,o,d,Vi(r))}catch(ue){ju(r,o,{then:function(){},status:"rejected",reason:ue},Vi())}finally{he.p=y,E!==null&&O.types!==null&&(E.types=O.types),re.T=E}}function w4(){}function vv(r,o,c,d){if(r.tag!==5)throw Error(i(476));var v=SC(r).queue;xC(r,v,o,J,c===null?w4:function(){return wC(r),c(d)})}function SC(r){var o=r.memoizedState;if(o!==null)return o;o={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$s,lastRenderedState:J},next:null};var c={};return o.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:$s,lastRenderedState:c},next:null},r.memoizedState=o,r=r.alternate,r!==null&&(r.memoizedState=o),o}function wC(r){var o=SC(r);o.next===null&&(o=r.alternate.memoizedState),ju(r,o.next.queue,{},Vi())}function yv(){return Gn(uc)}function CC(){return ln().memoizedState}function kC(){return ln().memoizedState}function C4(r){for(var o=r.return;o!==null;){switch(o.tag){case 24:case 3:var c=Vi();r=Eo(c);var d=No(o,r,c);d!==null&&(Oi(d,o,c),Nu(d,o,c)),o={cache:Kg()},r.payload=o;return}o=o.return}}function k4(r,o,c){var d=Vi();c={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Yh(r)?NC(o,c):(c=Pg(r,o,c,d),c!==null&&(Oi(c,r,d),RC(c,o,d)))}function EC(r,o,c){var d=Vi();ju(r,o,c,d)}function ju(r,o,c,d){var v={lane:d,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Yh(r))NC(o,v);else{var y=r.alternate;if(r.lanes===0&&(y===null||y.lanes===0)&&(y=o.lastRenderedReducer,y!==null))try{var E=o.lastRenderedState,O=y(E,c);if(v.hasEagerState=!0,v.eagerState=O,Hi(O,E))return Nh(r,o,v,0),At===null&&Eh(),!1}catch{}if(c=Pg(r,o,v,d),c!==null)return Oi(c,r,d),RC(c,o,d),!0}return!1}function _v(r,o,c,d){if(d={lane:2,revertLane:cy(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Yh(r)){if(o)throw Error(i(479))}else o=Pg(r,c,d,2),o!==null&&Oi(o,r,2)}function Yh(r){var o=r.alternate;return r===Xe||o!==null&&o===Xe}function NC(r,o){$l=$h=!0;var c=r.pending;c===null?o.next=o:(o.next=c.next,c.next=o),r.pending=o}function RC(r,o,c){if((c&4194048)!==0){var d=o.lanes;d&=r.pendingLanes,c|=d,o.lanes=c,TS(r,c)}}var Xh={readContext:Gn,use:Kh,useCallback:en,useContext:en,useEffect:en,useImperativeHandle:en,useLayoutEffect:en,useInsertionEffect:en,useMemo:en,useReducer:en,useRef:en,useState:en,useDebugValue:en,useDeferredValue:en,useTransition:en,useSyncExternalStore:en,useId:en,useHostTransitionStatus:en,useFormState:en,useActionState:en,useOptimistic:en,useMemoCache:en,useCacheRefresh:en,useEffectEvent:en},TC={readContext:Gn,use:Kh,useCallback:function(r,o){return pi().memoizedState=[r,o===void 0?null:o],r},useContext:Gn,useEffect:hC,useImperativeHandle:function(r,o,c){c=c!=null?c.concat([r]):null,Gh(4194308,4,gC.bind(null,o,r),c)},useLayoutEffect:function(r,o){return Gh(4194308,4,r,o)},useInsertionEffect:function(r,o){Gh(4,2,r,o)},useMemo:function(r,o){var c=pi();o=o===void 0?null:o;var d=r();if(Ia){vo(!0);try{r()}finally{vo(!1)}}return c.memoizedState=[d,o],d},useReducer:function(r,o,c){var d=pi();if(c!==void 0){var v=c(o);if(Ia){vo(!0);try{c(o)}finally{vo(!1)}}}else v=o;return d.memoizedState=d.baseState=v,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:v},d.queue=r,r=r.dispatch=k4.bind(null,Xe,r),[d.memoizedState,r]},useRef:function(r){var o=pi();return r={current:r},o.memoizedState=r},useState:function(r){r=hv(r);var o=r.queue,c=EC.bind(null,Xe,o);return o.dispatch=c,[r.memoizedState,c]},useDebugValue:mv,useDeferredValue:function(r,o){var c=pi();return gv(c,r,o)},useTransition:function(){var r=hv(!1);return r=xC.bind(null,Xe,r.queue,!0,!1),pi().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,o,c){var d=Xe,v=pi();if(nt){if(c===void 0)throw Error(i(407));c=c()}else{if(c=o(),At===null)throw Error(i(349));(dt&127)!==0||Yw(d,o,c)}v.memoizedState=c;var y={value:c,getSnapshot:o};return v.queue=y,hC(Qw.bind(null,d,y,r),[r]),d.flags|=2048,Wl(9,{destroy:void 0},Xw.bind(null,d,y,c,o),null),c},useId:function(){var r=pi(),o=At.identifierPrefix;if(nt){var c=Yr,d=Zr;c=(d&~(1<<32-Fi(d)-1)).toString(32)+c,o="_"+o+"R_"+c,c=qh++,0<c&&(o+="H"+c.toString(32)),o+="_"}else c=y4++,o="_"+o+"r_"+c.toString(32)+"_";return r.memoizedState=o},useHostTransitionStatus:yv,useFormState:aC,useActionState:aC,useOptimistic:function(r){var o=pi();o.memoizedState=o.baseState=r;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=c,o=_v.bind(null,Xe,!0,c),c.dispatch=o,[r,o]},useMemoCache:cv,useCacheRefresh:function(){return pi().memoizedState=C4.bind(null,Xe)},useEffectEvent:function(r){var o=pi(),c={impl:r};return o.memoizedState=c,function(){if((gt&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},DC={readContext:Gn,use:Kh,useCallback:yC,useContext:Gn,useEffect:pv,useImperativeHandle:vC,useInsertionEffect:pC,useLayoutEffect:mC,useMemo:_C,useReducer:Vh,useRef:dC,useState:function(){return Vh($s)},useDebugValue:mv,useDeferredValue:function(r,o){var c=ln();return bC(c,Nt.memoizedState,r,o)},useTransition:function(){var r=Vh($s)[0],o=ln().memoizedState;return[typeof r=="boolean"?r:Ou(r),o]},useSyncExternalStore:Zw,useId:CC,useHostTransitionStatus:yv,useFormState:lC,useActionState:lC,useOptimistic:function(r,o){var c=ln();return tC(c,Nt,r,o)},useMemoCache:cv,useCacheRefresh:kC,useEffectEvent:fC},E4={readContext:Gn,use:Kh,useCallback:yC,useContext:Gn,useEffect:pv,useImperativeHandle:vC,useInsertionEffect:pC,useLayoutEffect:mC,useMemo:_C,useReducer:dv,useRef:dC,useState:function(){return dv($s)},useDebugValue:mv,useDeferredValue:function(r,o){var c=ln();return Nt===null?gv(c,r,o):bC(c,Nt.memoizedState,r,o)},useTransition:function(){var r=dv($s)[0],o=ln().memoizedState;return[typeof r=="boolean"?r:Ou(r),o]},useSyncExternalStore:Zw,useId:CC,useHostTransitionStatus:yv,useFormState:uC,useActionState:uC,useOptimistic:function(r,o){var c=ln();return Nt!==null?tC(c,Nt,r,o):(c.baseState=r,[r,c.queue.dispatch])},useMemoCache:cv,useCacheRefresh:kC,useEffectEvent:fC};function bv(r,o,c,d){o=r.memoizedState,c=c(d,o),c=c==null?o:D({},o,c),r.memoizedState=c,r.lanes===0&&(r.updateQueue.baseState=c)}var xv={enqueueSetState:function(r,o,c){r=r._reactInternals;var d=Vi(),v=Eo(d);v.payload=o,c!=null&&(v.callback=c),o=No(r,v,d),o!==null&&(Oi(o,r,d),Nu(o,r,d))},enqueueReplaceState:function(r,o,c){r=r._reactInternals;var d=Vi(),v=Eo(d);v.tag=1,v.payload=o,c!=null&&(v.callback=c),o=No(r,v,d),o!==null&&(Oi(o,r,d),Nu(o,r,d))},enqueueForceUpdate:function(r,o){r=r._reactInternals;var c=Vi(),d=Eo(c);d.tag=2,o!=null&&(d.callback=o),o=No(r,d,c),o!==null&&(Oi(o,r,c),Nu(o,r,c))}};function AC(r,o,c,d,v,y,E){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,y,E):o.prototype&&o.prototype.isPureReactComponent?!_u(c,d)||!_u(v,y):!0}function OC(r,o,c,d){r=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(c,d),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(c,d),o.state!==r&&xv.enqueueReplaceState(o,o.state,null)}function Pa(r,o){var c=o;if("ref"in o){c={};for(var d in o)d!=="ref"&&(c[d]=o[d])}if(r=r.defaultProps){c===o&&(c=D({},c));for(var v in r)c[v]===void 0&&(c[v]=r[v])}return c}function jC(r){kh(r)}function zC(r){console.error(r)}function MC(r){kh(r)}function Qh(r,o){try{var c=r.onUncaughtError;c(o.value,{componentStack:o.stack})}catch(d){setTimeout(function(){throw d})}}function IC(r,o,c){try{var d=r.onCaughtError;d(c.value,{componentStack:c.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function Sv(r,o,c){return c=Eo(c),c.tag=3,c.payload={element:null},c.callback=function(){Qh(r,o)},c}function PC(r){return r=Eo(r),r.tag=3,r}function LC(r,o,c,d){var v=c.type.getDerivedStateFromError;if(typeof v=="function"){var y=d.value;r.payload=function(){return v(y)},r.callback=function(){IC(o,c,d)}}var E=c.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(r.callback=function(){IC(o,c,d),typeof v!="function"&&(Mo===null?Mo=new Set([this]):Mo.add(this));var O=d.stack;this.componentDidCatch(d.value,{componentStack:O!==null?O:""})})}function N4(r,o,c,d,v){if(c.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(o=c.alternate,o!==null&&Ta(o,c,v,!0),c=Zn.current,c!==null){switch(c.tag){case 31:case 13:case 19:return oi===null?bf():c.alternate===null&&tn===0&&(tn=3),c.flags&=-257,c.flags|=65536,c.lanes=v,d===Lh?c.flags|=16384:(o=c.updateQueue,o===null?c.updateQueue=new Set([d]):o.add(d),oy(r,d,v)),!1;case 22:return c.flags|=65536,d===Lh?c.flags|=16384:(o=c.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([d])},c.updateQueue=o):(c=o.retryQueue,c===null?o.retryQueue=new Set([d]):c.add(d)),oy(r,d,v)),!1}throw Error(i(435,c.tag))}return oy(r,d,v),bf(),!1}if(nt)return o=Zn.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=v,d!==Hg&&(r=Error(i(422),{cause:d}),Su(dr(r,c)))):(d!==Hg&&(o=Error(i(423),{cause:d}),Su(dr(o,c))),r=r.current.alternate,r.flags|=65536,v&=-v,r.lanes|=v,d=dr(d,c),v=Sv(r.stateNode,d,v),Qg(r,v),tn!==4&&(tn=2)),!1;var y=Error(i(520),{cause:d});if(y=dr(y,c),Uu===null?Uu=[y]:Uu.push(y),tn!==4&&(tn=2),o===null)return!0;d=dr(d,c),c=o;do{switch(c.tag){case 3:return c.flags|=65536,r=v&-v,c.lanes|=r,r=Sv(c.stateNode,d,r),Qg(c,r),!1;case 1:if(o=c.type,y=c.stateNode,(c.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(Mo===null||!Mo.has(y))))return c.flags|=65536,v&=-v,c.lanes|=v,v=PC(v),LC(v,r,c,d),Qg(c,v),!1;break;case 22:if(c.memoizedState!==null)return c.flags|=65536,!1}c=c.return}while(c!==null);return!1}var wv=Error(i(461)),mn=!1;function En(r,o,c,d){o.child=r===null?Hw(o,null,c,d):Ma(o,r.child,c,d)}function BC(r,o,c,d,v){c=c.render;var y=o.ref;if("ref"in d){var E={};for(var O in d)O!=="ref"&&(E[O]=d[O])}else E=d;return Da(o),d=sv(r,o,c,E,y,v),O=ov(),r!==null&&!mn?(av(r,o,v),qs(r,o,v)):(nt&&O&&Ah(o),o.flags|=1,En(r,o,d,v),o.child)}function FC(r,o,c,d,v){if(r===null){var y=c.type;return typeof y=="function"&&!Lg(y)&&y.defaultProps===void 0&&c.compare===null?(o.tag=15,o.type=y,UC(r,o,y,d,v)):(r=Th(c.type,null,d,o,o.mode,v),r.ref=o.ref,r.return=o,o.child=r)}if(y=r.child,!Av(r,v)){var E=y.memoizedProps;if(c=c.compare,c=c!==null?c:_u,c(E,d)&&r.ref===o.ref)return qs(r,o,v)}return o.flags|=1,r=Ls(y,d),r.ref=o.ref,r.return=o,o.child=r}function UC(r,o,c,d,v){if(r!==null){var y=r.memoizedProps;if(_u(y,d)&&r.ref===o.ref)if(mn=!1,o.pendingProps=d=y,Av(r,v))(r.flags&131072)!==0&&(mn=!0);else return o.lanes=r.lanes,qs(r,o,v)}return Cv(r,o,c,d,v)}function HC(r,o,c,d){var v=d.children,y=r!==null?r.memoizedState:null;if(r===null&&o.stateNode===null&&(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((o.flags&128)!==0){if(y=y!==null?y.baseLanes|c:c,r!==null){for(d=o.child=r.child,v=0;d!==null;)v=v|d.lanes|d.childLanes,d=d.sibling;d=v&~y}else d=0,o.child=null;return $C(r,o,y,c,d)}if((c&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},r!==null&&Ih(o,y!==null?y.cachePool:null),y!==null?Ww(o,y):ev(),Kw(o);else return d=o.lanes=536870912,$C(r,o,y!==null?y.baseLanes|c:c,c,d)}else y!==null?(Ih(o,y.cachePool),Ww(o,y),Do(),o.memoizedState=null):(r!==null&&Ih(o,null),ev(),Do());return En(r,o,v,c),o.child}function zu(r,o){return r!==null&&r.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function $C(r,o,c,d,v){var y=Gg();return y=y===null?null:{parent:fn._currentValue,pool:y},o.memoizedState={baseLanes:c,cachePool:y},r!==null&&Ih(o,null),ev(),Kw(o),r!==null&&Ta(r,o,d,!0),o.childLanes=v,null}function Jh(r,o){return o=ef({mode:o.mode,children:o.children},r.mode),o.ref=r.ref,r.child=o,o.return=r,o}function qC(r,o,c){return Ma(o,r.child,null,c),r=Jh(o,o.pendingProps),r.flags|=2,$i(o),o.memoizedState=null,r}function R4(r,o,c){var d=o.pendingProps,v=(o.flags&128)!==0;if(o.flags&=-129,r===null){if(nt){if(d.mode==="hidden")return r=Jh(o,d),o.lanes=536870912,r.memoizedState={baseLanes:0,cachePool:null},zu(null,r);if(nv(o),(r=zt)?(r=gE(r,pr),r=r!==null&&r.data==="&"?r:null,r!==null&&(o.memoizedState={dehydrated:r,treeContext:bo!==null?{id:Zr,overflow:Yr}:null,retryLane:536870912,hydrationErrors:null},c=Nw(r),c.return=o,o.child=c,Pn=o,zt=null)):r=null,r===null)throw So(o);return o.lanes=536870912,null}return Jh(o,d)}var y=r.memoizedState;if(y!==null){var E=y.dehydrated;if(nv(o),v)if(o.flags&256)o.flags&=-257,o=qC(r,o,c);else if(o.memoizedState!==null)o.child=r.child,o.flags|=128,o=null;else throw Error(i(558));else if(mn||Ta(r,o,c,!1),v=(c&r.childLanes)!==0,mn||v){if(Ro.current===null){if(d=At,d!==null&&(E=DS(d,c),E!==0&&E!==y.retryLane))throw y.retryLane=E,ka(r,E),Oi(d,r,E),wv;bf()}o=qC(r,o,c)}else r=y.treeContext,zt=gr(E.nextSibling),Pn=o,nt=!0,xo=null,pr=!1,r!==null&&Dw(o,r),o=Jh(o,d),o.flags|=134221824;return o}return r=Ls(r.child,{mode:d.mode,children:d.children}),r.ref=o.ref,o.child=r,r.return=o,r}function Kl(r,o){var c=o.ref;if(c===null)r!==null&&r.ref!==null&&(o.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(r===null||r.ref!==c)&&(o.flags|=4194816)}}function Cv(r,o,c,d,v){return Da(o),c=sv(r,o,c,d,void 0,v),d=ov(),r!==null&&!mn?(av(r,o,v),qs(r,o,v)):(nt&&d&&Ah(o),o.flags|=1,En(r,o,c,v),o.child)}function WC(r,o,c,d,v,y){return Da(o),o.updateQueue=null,c=Gw(o,d,c,v),Vw(r),d=ov(),r!==null&&!mn?(av(r,o,y),qs(r,o,y)):(nt&&d&&Ah(o),o.flags|=1,En(r,o,c,y),o.child)}function KC(r,o,c,d,v){if(Da(o),o.stateNode===null){var y=Il,E=c.contextType;typeof E=="object"&&E!==null&&(y=Gn(E)),y=new c(d,y),o.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=xv,o.stateNode=y,y._reactInternals=o,y=o.stateNode,y.props=d,y.state=o.memoizedState,y.refs={},Yg(o),E=c.contextType,y.context=typeof E=="object"&&E!==null?Gn(E):Il,y.state=o.memoizedState,E=c.getDerivedStateFromProps,typeof E=="function"&&(bv(o,c,E,d),y.state=o.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(E=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),E!==y.state&&xv.enqueueReplaceState(y,y.state,null),Tu(o,d,y,v),Ru(),y.state=o.memoizedState),typeof y.componentDidMount=="function"&&(o.flags|=4194308),d=!0}else if(r===null){y=o.stateNode;var O=o.memoizedProps,H=Pa(c,O);y.props=H;var Q=y.context,oe=c.contextType;E=Il,typeof oe=="object"&&oe!==null&&(E=Gn(oe));var ue=c.getDerivedStateFromProps;oe=typeof ue=="function"||typeof y.getSnapshotBeforeUpdate=="function",O=o.pendingProps!==O,oe||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(O||Q!==E)&&OC(o,y,d,E),ko=!1;var Y=o.memoizedState;y.state=Y,Tu(o,d,y,v),Ru(),Q=o.memoizedState,O||Y!==Q||ko?(typeof ue=="function"&&(bv(o,c,ue,d),Q=o.memoizedState),(H=ko||AC(o,c,H,d,Y,Q,E))?(oe||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(o.flags|=4194308)):(typeof y.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=d,o.memoizedState=Q),y.props=d,y.state=Q,y.context=E,d=H):(typeof y.componentDidMount=="function"&&(o.flags|=4194308),d=!1)}else{y=o.stateNode,Xg(r,o),E=o.memoizedProps,oe=Pa(c,E),y.props=oe,ue=o.pendingProps,Y=y.context,Q=c.contextType,H=Il,typeof Q=="object"&&Q!==null&&(H=Gn(Q)),O=c.getDerivedStateFromProps,(Q=typeof O=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(E!==ue||Y!==H)&&OC(o,y,d,H),ko=!1,Y=o.memoizedState,y.state=Y,Tu(o,d,y,v),Ru();var se=o.memoizedState;E!==ue||Y!==se||ko||r!==null&&r.dependencies!==null&&zh(r.dependencies)?(typeof O=="function"&&(bv(o,c,O,d),se=o.memoizedState),(oe=ko||AC(o,c,oe,d,Y,se,H)||r!==null&&r.dependencies!==null&&zh(r.dependencies))?(Q||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(d,se,H),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(d,se,H)),typeof y.componentDidUpdate=="function"&&(o.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof y.componentDidUpdate!="function"||E===r.memoizedProps&&Y===r.memoizedState||(o.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&Y===r.memoizedState||(o.flags|=1024),o.memoizedProps=d,o.memoizedState=se),y.props=d,y.state=se,y.context=H,d=oe):(typeof y.componentDidUpdate!="function"||E===r.memoizedProps&&Y===r.memoizedState||(o.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&Y===r.memoizedState||(o.flags|=1024),d=!1)}return y=d,Kl(r,o),d=(o.flags&128)!==0,y||d?(y=o.stateNode,c=d&&typeof c.getDerivedStateFromError!="function"?null:y.render(),o.flags|=1,r!==null&&d?(o.child=Ma(o,r.child,null,v),o.child=Ma(o,null,c,v)):En(r,o,c,v),o.memoizedState=y.state,r=o.child):r=qs(r,o,v),r}function VC(r,o,c,d){return Na(),o.flags|=256,En(r,o,c,d),o.child}var kv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ev(r){return{baseLanes:r,cachePool:Iw()}}function Nv(r,o,c){return r=r!==null?r.childLanes&~c:0,o&&(r|=Ki),r}function GC(r,o,c){var d=o.pendingProps,v=!1,y=(o.flags&128)!==0,E;if((E=y)||(E=r!==null&&r.memoizedState===null?!1:(Yn.current&2)!==0),E&&(v=!0,o.flags&=-129),E=(o.flags&32)!==0,o.flags&=-33,r===null){if(nt){if(v?To(o):Do(),(r=zt)?(r=gE(r,pr),r=r!==null&&r.data!=="&"?r:null,r!==null&&(o.memoizedState={dehydrated:r,treeContext:bo!==null?{id:Zr,overflow:Yr}:null,retryLane:536870912,hydrationErrors:null},c=Nw(r),c.return=o,o.child=c,Pn=o,zt=null)):r=null,r===null)throw So(o);return Ey(r)?o.lanes=32:o.lanes=536870912,null}return y=d.children,d=d.fallback,v?(Do(),v=o.mode,y=ef({mode:"hidden",children:y},v),d=Ea(d,v,c,null),y.return=o,d.return=o,y.sibling=d,o.child=y,d=o.child,d.memoizedState=Ev(c),d.childLanes=Nv(r,E,c),o.memoizedState=kv,zu(null,d)):(To(o),Rv(o,y))}var O=r.memoizedState;if(O!==null){var H=O.dehydrated;if(H!==null)return T4(r,o,y,E,d,H,O,c)}return v?(Do(),v=d.fallback,y=o.mode,O=r.child,H=O.sibling,d=Ls(O,{mode:"hidden",children:d.children}),d.subtreeFlags=O.subtreeFlags&1206910976,H!==null?v=Ls(H,v):(v=Ea(v,y,c,null),v.flags|=2),v.return=o,d.return=o,d.sibling=v,o.child=d,zu(null,d),d=o.child,v=r.child.memoizedState,v===null?v=Ev(c):(y=v.cachePool,y!==null?(O=fn._currentValue,y=y.parent!==O?{parent:O,pool:O}:y):y=Iw(),v={baseLanes:v.baseLanes|c,cachePool:y}),d.memoizedState=v,d.childLanes=Nv(r,E,c),o.memoizedState=kv,zu(r.child,d)):(To(o),c=r.child,r=c.sibling,c=Ls(c,{mode:"visible",children:d.children}),c.return=o,c.sibling=null,r!==null&&(E=o.deletions,E===null?(o.deletions=[r],o.flags|=16):E.push(r)),o.child=c,o.memoizedState=null,c)}function Rv(r,o){return o=ef({mode:"visible",children:o},r.mode),o.return=r,r.child=o}function ef(r,o){return r=Ri(22,r,null,o),r.lanes=0,r}function tf(r,o,c){return Ma(o,r.child,null,c),r=Rv(o,o.pendingProps.children),r.flags|=2,o.memoizedState=null,r}function T4(r,o,c,d,v,y,E,O){if(c)return o.flags&256?(To(o),o.flags&=-257,tf(r,o,O)):o.memoizedState!==null?(Do(),o.child=r.child,o.flags|=128,null):(Do(),y=v.fallback,E=o.mode,v=ef({mode:"visible",children:v.children},E),y=Ea(y,E,O,null),y.flags|=2,v.return=o,y.return=o,v.sibling=y,o.child=v,Ma(o,r.child,null,O),v=o.child,v.memoizedState=Ev(O),v.childLanes=Nv(r,d,O),o.memoizedState=kv,zu(null,v));if(To(o),Ey(y)){if(d=y.nextSibling&&y.nextSibling.dataset,d)var H=d.dgst;return d=H,d!==""&&(v=Error(i(419)),v.stack="",v.digest=d,Su({value:v,source:null,stack:null})),tf(r,o,O)}if(mn||Ta(r,o,O,!1),d=(O&r.childLanes)!==0,mn||d){if(Ro.current!==null)return tf(r,o,O);if(d=At,d!==null&&(v=DS(d,O),v!==0&&v!==E.retryLane))throw E.retryLane=v,ka(r,v),Oi(d,r,v),wv;return ky(y)||bf(),tf(r,o,O)}return ky(y)?(o.flags|=192,o.child=r.child,null):(r=E.treeContext,zt=gr(y.nextSibling),Pn=o,nt=!0,xo=null,pr=!1,r!==null&&Dw(o,r),o=Rv(o,v.children),o.flags|=134221824,o)}function ZC(r,o,c){r.lanes|=o;var d=r.alternate;d!==null&&(d.lanes|=o),jh(r.return,o,c)}function YC(r){for(var o=null;r!==null;){var c=r.alternate;c!==null&&Hh(c)===null&&(o=r),r=r.sibling}return o}function nf(r,o,c,d,v,y){var E=r.memoizedState;E===null?r.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:d,tail:c,tailMode:v,treeForkCount:y}:(E.isBackwards=o,E.rendering=null,E.renderingStartTime=0,E.last=d,E.tail=c,E.tailMode=v,E.treeForkCount=y)}function Tv(r){var o=r.child;for(r.child=null;o!==null;){var c=o.sibling;o.sibling=r.child,r.child=o,o=c}}function Dv(r,o,c){var d=o.pendingProps,v=d.revealOrder,y=d.tail;d=d.children;var E=Yn.current;if(o.flags&128)return Du(o,E),null;var O=(E&2)!==0;if(O?(E=E&1|2,o.flags|=128):E&=1,Du(o,E),v==="backwards"&&r!==null?(Tv(r),En(r,o,d,c),Tv(r)):En(r,o,d,c),d=nt?xu:0,!O&&r!==null&&(r.flags&128)!==0)e:for(r=o.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&ZC(r,c,o);else if(r.tag===19)ZC(r,c,o);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break e;for(;r.sibling===null;){if(r.return===null||r.return===o)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(v){case"backwards":c=YC(o.child),c===null?(v=o.child,o.child=null):(v=c.sibling,c.sibling=null,Tv(o)),nf(o,!0,v,null,y,d);break;case"unstable_legacy-backwards":for(c=null,v=o.child,o.child=null;v!==null;){if(r=v.alternate,r!==null&&Hh(r)===null){o.child=v;break}r=v.sibling,v.sibling=c,c=v,v=r}nf(o,!0,c,null,y,d);break;case"together":nf(o,!1,null,null,void 0,d);break;case"independent":o.memoizedState=null;break;default:c=YC(o.child),c===null?(v=o.child,o.child=null):(v=c.sibling,c.sibling=null),nf(o,!1,v,c,y,d)}return o.child}function XC(r,o,c){var d=o.pendingProps;return wo(o,o.type,d.value),En(r,o,d.children,c),o.child}function qs(r,o,c){if(r!==null&&(o.dependencies=r.dependencies),zo|=o.lanes,(c&o.childLanes)===0)if(r!==null){if(Ta(r,o,c,!1),(c&o.childLanes)===0)return null}else return null;if(r!==null&&o.child!==r.child)throw Error(i(153));if(o.child!==null){for(r=o.child,c=Ls(r,r.pendingProps),o.child=c,c.return=o;r.sibling!==null;)r=r.sibling,c=c.sibling=Ls(r,r.pendingProps),c.return=o;c.sibling=null}return o.child}function Av(r,o){return(r.lanes&o)!==0?!0:(r=r.dependencies,!!(r!==null&&zh(r)))}function D4(r,o,c){switch(o.tag){case 3:go(o,o.stateNode.containerInfo),wo(o,fn,r.memoizedState.cache),Na();break;case 27:case 5:Wr(o);break;case 4:go(o,o.stateNode.containerInfo);break;case 10:wo(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,nv(o),null;break;case 13:var d=o.memoizedState;if(d!==null){if(d.dehydrated!==null)return To(o),o.flags|=128,null;d=Ta(r,o,c,!1);var v=o.child.childLanes;return d||(c&v)!==0?GC(r,o,c):(To(o),r=qs(r,o,c),r!==null?r.sibling:null)}To(o);break;case 19:if(o.flags&128)return Dv(r,o,c);if(v=(r.flags&128)!==0,d=(c&o.childLanes)!==0,d||(Ta(r,o,c,!1),d=(c&o.childLanes)!==0),v){if(d)return Dv(r,o,c);o.flags|=128}if(v=o.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),Du(o,Yn.current),d)break;return null;case 22:return o.lanes=0,HC(r,o,c,o.pendingProps);case 24:wo(o,fn,r.memoizedState.cache)}return qs(r,o,c)}function QC(r,o,c){if(r!==null)if(r.memoizedProps!==o.pendingProps)mn=!0;else{if(!Av(r,c)&&(o.flags&128)===0)return mn=!1,D4(r,o,c);mn=(r.flags&131072)!==0}else mn=!1,nt&&(o.flags&1048576)!==0&&Tw(o,xu,o.index);switch(o.lanes=0,o.tag){case 16:e:{var d=o.pendingProps;if(r=ja(o.elementType),o.type=r,typeof r=="function")Lg(r)?(d=Pa(r,d),o.tag=1,o=KC(null,o,r,d,c)):(o.tag=0,o=Cv(null,o,r,d,c));else{if(r!=null){var v=r.$$typeof;if(v===P){o.tag=11,o=BC(null,o,r,d,c);break e}else if(v===ae){o.tag=14,o=FC(null,o,r,d,c);break e}else if(v===G){o.tag=10,o.type=r,o=XC(null,o,c);break e}}throw o=ve(r)||r,Error(i(306,o,""))}}return o;case 0:return Cv(r,o,o.type,o.pendingProps,c);case 1:return d=o.type,v=Pa(d,o.pendingProps),KC(r,o,d,v,c);case 3:e:{if(go(o,o.stateNode.containerInfo),r===null)throw Error(i(387));d=o.pendingProps;var y=o.memoizedState;v=y.element,Xg(r,o),Tu(o,d,null,c);var E=o.memoizedState;if(d=E.cache,wo(o,fn,d),d!==y.cache&&Wg(o,[fn],c,!0),Ru(),d=E.element,y.isDehydrated)if(y={element:d,isDehydrated:!1,cache:E.cache},o.updateQueue.baseState=y,o.memoizedState=y,o.flags&256){o=VC(r,o,d,c);break e}else if(d!==v){v=dr(Error(i(424)),o),Su(v),o=VC(r,o,d,c);break e}else for(r=o.stateNode.containerInfo,r.nodeType===9?r=r.body:r=r.nodeName==="HTML"?r.ownerDocument.body:r,zt=gr(r.firstChild),Pn=o,nt=!0,xo=null,pr=!0,c=Hw(o,null,d,c),o.child=c;c;)c.flags=c.flags&-3|134221824,c=c.sibling;else{if(Na(),d===v){o=qs(r,o,c);break e}En(r,o,d,c)}o=o.child}return o;case 26:return Kl(r,o),r===null?(c=wE(o.type,null,o.pendingProps,null))?o.memoizedState=c:nt||(o.stateNode=nE(o.type,o.pendingProps,Bt.current,o)):o.memoizedState=wE(o.type,r.memoizedProps,o.pendingProps,r.memoizedState),null;case 27:return Wr(o),r===null&&nt&&(d=o.stateNode=_E(o.type,o.pendingProps,Bt.current),Pn=o,pr=!0,v=zt,Lo(o.type)?(Ny=v,zt=gr(d.firstChild)):zt=v),En(r,o,o.pendingProps.children,c),Kl(r,o),r===null&&(o.flags|=4194304),o.child;case 5:return r===null&&nt&&((v=d=zt)&&(d=CL(d,o.type,o.pendingProps,pr),d!==null?(o.stateNode=d,Pn=o,zt=gr(d.firstChild),pr=!1,v=!0):v=!1),v||So(o)),Wr(o),v=o.type,y=o.pendingProps,E=r!==null?r.memoizedProps:null,d=y.children,yy(v,y)?d=null:E!==null&&yy(v,E)&&(o.flags|=32),o.memoizedState!==null&&(v=sv(r,o,_4,null,null,c),uc._currentValue=v),Kl(r,o),En(r,o,d,c),o.child;case 6:return r===null&&nt&&((r=c=zt)&&(c=kL(c,o.pendingProps,pr),c!==null?(o.stateNode=c,Pn=o,zt=null,r=!0):r=!1),r||So(o)),null;case 13:return GC(r,o,c);case 4:return go(o,o.stateNode.containerInfo),d=o.pendingProps,r===null?o.child=Ma(o,null,d,c):En(r,o,d,c),o.child;case 11:return BC(r,o,o.type,o.pendingProps,c);case 7:return d=o.pendingProps,Kl(r,o),En(r,o,d,c),o.child;case 8:return En(r,o,o.pendingProps.children,c),o.child;case 12:return En(r,o,o.pendingProps.children,c),o.child;case 10:return XC(r,o,c);case 9:return v=o.type._context,d=o.pendingProps.children,Da(o),v=Gn(v),d=d(v),o.flags|=1,En(r,o,d,c),o.child;case 14:return FC(r,o,o.type,o.pendingProps,c);case 15:return UC(r,o,o.type,o.pendingProps,c);case 19:return Dv(r,o,c);case 31:return R4(r,o,c);case 22:return HC(r,o,c,o.pendingProps);case 24:return Da(o),d=Gn(fn),r===null?(v=Gg(),v===null&&(v=At,y=Kg(),v.pooledCache=y,y.refCount++,y!==null&&(v.pooledCacheLanes|=c),v=y),o.memoizedState={parent:d,cache:v},Yg(o),wo(o,fn,v)):((r.lanes&c)!==0&&(Xg(r,o),Tu(o,null,null,c),Ru()),v=r.memoizedState,y=o.memoizedState,v.parent!==d?(v={parent:d,cache:d},o.memoizedState=v,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=v),wo(o,fn,d)):(d=y.cache,wo(o,fn,d),d!==v.cache&&Wg(o,[fn],c,!0))),En(r,o,o.pendingProps.children,c),o.child;case 30:return o.stateNode===null&&(o.stateNode={autoName:null,paired:null,clones:null,ref:null}),d=o.pendingProps,d.name!=null&&d.name!=="auto"?o.flags|=r===null?18882560:18874368:nt&&Ah(o),r!==null&&r.memoizedProps.name!==d.name?o.flags|=4194816:Kl(r,o),En(r,o,d.children,c),o.child;case 29:throw o.pendingProps}throw Error(i(156,o.tag))}function Ws(r){r.flags|=4}function Ov(r,o,c,d,v){var y;if((y=(r.mode&32)!==0)&&(y=c===null?NE(o,d):NE(o,d)&&(d.src!==c.src||d.srcSet!==c.srcSet)),y){if(r.flags|=16777216,(v&335544128)===v)if(r.stateNode.complete)r.flags|=8192;else if(jk())r.flags|=8192;else throw za=Lh,Zg}else r.flags&=-16777217}function JC(r,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!RE(o))if(jk())r.flags|=8192;else throw za=Lh,Zg}function rf(r,o){o!==null&&(r.flags|=4),r.flags&16384&&(o=r.tag!==22?NS():536870912,r.lanes|=o,Xl|=o)}function Mu(r,o){if(!nt)switch(r.tailMode){case"visible":break;case"collapsed":for(var c=r.tail,d=null;c!==null;)c.alternate!==null&&(d=c),c=c.sibling;d===null?o||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null;break;default:for(o=r.tail,c=null;o!==null;)o.alternate!==null&&(c=o),o=o.sibling;c===null?r.tail=null:c.sibling=null}}function Mt(r){var o=r.alternate!==null&&r.alternate.child===r.child,c=0,d=0;if(o)for(var v=r.child;v!==null;)c|=v.lanes|v.childLanes,d|=v.subtreeFlags&1206910976,d|=v.flags&1206910976,v.return=r,v=v.sibling;else for(v=r.child;v!==null;)c|=v.lanes|v.childLanes,d|=v.subtreeFlags,d|=v.flags,v.return=r,v=v.sibling;return r.subtreeFlags|=d,r.childLanes=c,o}function A4(r,o,c){var d=o.pendingProps;switch(Ug(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(o),null;case 1:return Mt(o),null;case 3:return c=o.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),o.memoizedState.cache!==d&&(o.flags|=2048),Us(fn),Dr(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(r===null||r.child===null)&&(Bl(o)?Ws(o):r===null||r.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,$g())),Mt(o),null;case 26:var v=o.type,y=o.memoizedState;return r===null?(Ws(o),y!==null?(Mt(o),JC(o,y)):(Mt(o),Ov(o,v,null,d,c))):y?y!==r.memoizedState?(Ws(o),Mt(o),JC(o,y)):(Mt(o),o.flags&=-16777217):(r=r.memoizedProps,r!==d&&Ws(o),Mt(o),Ov(o,v,r,d,c)),null;case 27:if(Kr(o),c=Bt.current,v=o.type,r!==null&&o.stateNode!=null)r.memoizedProps!==d&&Ws(o);else{if(!d){if(o.stateNode===null)throw Error(i(166));return Mt(o),o.subtreeFlags&=-33554433,null}r=Lt.current,Bl(o)?Aw(o):(r=_E(v,d,c),o.stateNode=r,Ws(o))}return Mt(o),o.subtreeFlags&=-33554433,null;case 5:if(Kr(o),v=o.type,r!==null&&o.stateNode!=null)r.memoizedProps!==d&&Ws(o);else{if(!d){if(o.stateNode===null)throw Error(i(166));return Mt(o),o.subtreeFlags&=-33554433,null}if(y=Lt.current,Bl(o))Aw(o);else{var E=Ku(Bt.current);switch(y){case 1:y=E.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:y=E.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":y=E.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":y=E.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":y=E.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof d.is=="string"?E.createElement("select",{is:d.is}):E.createElement("select"),d.multiple?y.multiple=!0:d.size&&(y.size=d.size);break;default:y=typeof d.is=="string"?E.createElement(v,{is:d.is}):E.createElement(v)}}y[Vn]=o,y[Ni]=d;e:for(E=o.child;E!==null;){if(E.tag===5||E.tag===6)y.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===o)break e;for(;E.sibling===null;){if(E.return===null||E.return===o)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}o.stateNode=y;e:switch(Qn(y,v,d),v){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Ws(o)}}return Mt(o),o.subtreeFlags&=-33554433,Ov(o,o.type,r===null?null:r.memoizedProps,o.pendingProps,c),null;case 6:if(r&&o.stateNode!=null)r.memoizedProps!==d&&Ws(o);else{if(typeof d!="string"&&o.stateNode===null)throw Error(i(166));if(r=Bt.current,Bl(o)){if(r=o.stateNode,c=o.memoizedProps,d=null,v=Pn,v!==null)switch(v.tag){case 27:case 5:d=v.memoizedProps}r[Vn]=o,r=!!(r.nodeValue===c||d!==null&&d.suppressHydrationWarning===!0||Qk(r.nodeValue,c)),r||So(o,!0)}else r=Ku(r).createTextNode(d),r[Vn]=o,o.stateNode=r}return Mt(o),null;case 31:if(c=o.memoizedState,r===null||r.memoizedState!==null){if(d=Bl(o),c!==null){if(r===null){if(!d)throw Error(i(318));if(r=o.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[Vn]=o}else Na(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Mt(o),r=!1}else c=$g(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return o.flags&256?($i(o),o):($i(o),null);if((o.flags&128)!==0)throw Error(i(558))}return Mt(o),null;case 13:if(d=o.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(v=Bl(o),d!==null&&d.dehydrated!==null){if(r===null){if(!v)throw Error(i(318));if(v=o.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(i(317));v[Vn]=o}else Na(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;Mt(o),v=!1}else v=$g(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=v),v=!0;if(!v)return o.flags&256?($i(o),o):($i(o),null)}return $i(o),(o.flags&128)!==0?(o.lanes=c,o):(c=d!==null,r=r!==null&&r.memoizedState!==null,c&&(d=o.child,v=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(v=d.alternate.memoizedState.cachePool.pool),y=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(y=d.memoizedState.cachePool.pool),y!==v&&(d.flags|=2048)),c!==r&&c&&(o.child.flags|=8192),rf(o,o.updateQueue),Mt(o),null);case 4:return Dr(),r===null&&fy(o.stateNode.containerInfo),o.flags|=67108864,Mt(o),null;case 10:return Us(o.type),Mt(o),null;case 19:if(iv(o),d=o.memoizedState,d===null)return Mt(o),null;if(v=(o.flags&128)!==0,y=d.rendering,y===null)if(v)Mu(d,!1);else{if(tn!==0||r!==null&&(r.flags&128)!==0)for(r=o.child;r!==null;){if(y=Hh(r),y!==null){for(o.flags|=128,Mu(d,!1),r=y.updateQueue,o.updateQueue=r,rf(o,r),o.subtreeFlags=0,r=c,c=o.child;c!==null;)Ew(c,r),c=c.sibling;return Du(o,Yn.current&1|2),nt&&Bs(o,d.treeForkCount),o.child}r=r.sibling}d.tail!==null&&_t()>gf&&(o.flags|=128,v=!0,Mu(d,!1),o.lanes=4194304)}else{if(!v)if(r=Hh(y),r!==null){if(o.flags|=128,v=!0,r=r.updateQueue,o.updateQueue=r,rf(o,r),Mu(d,!0),d.tail===null&&d.tailMode!=="collapsed"&&d.tailMode!=="visible"&&!y.alternate&&!nt)return Mt(o),null}else 2*_t()-d.renderingStartTime>gf&&c!==536870912&&(o.flags|=128,v=!0,Mu(d,!1),o.lanes=4194304);d.isBackwards?(y.sibling=o.child,o.child=y):(r=d.last,r!==null?r.sibling=y:o.child=y,d.last=y)}if(d.tail!==null){r=d.tail;e:{for(c=r;c!==null;){if(c.alternate!==null){c=!1;break e}c=c.sibling}c=!0}return d.rendering=r,d.tail=r.sibling,d.renderingStartTime=_t(),r.sibling=null,y=Yn.current,y=v?y&1|2:y&1,d.tailMode==="visible"||d.tailMode==="collapsed"||!c||nt?Du(o,y):(c=y,tt(Zn,o),tt(Yn,c),oi===null&&(oi=o)),nt&&Bs(o,d.treeForkCount),r}return Mt(o),null;case 22:case 23:return $i(o),tv(),d=o.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(o.flags|=8192):d&&(o.flags|=8192),d?(c&536870912)!==0&&(o.flags&128)===0&&(Mt(o),o.subtreeFlags&6&&(o.flags|=8192)):Mt(o),c=o.updateQueue,c!==null&&rf(o,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),d=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(d=o.memoizedState.cachePool.pool),d!==c&&(o.flags|=2048),r!==null&&Et(Oa),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),o.memoizedState.cache!==c&&(o.flags|=2048),Us(fn),Mt(o),null;case 25:return null;case 30:return o.flags|=33554432,Mt(o),null}throw Error(i(156,o.tag))}function O4(r,o){switch(Ug(o),o.tag){case 1:return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 3:return Us(fn),Dr(),r=o.flags,(r&65536)!==0&&(r&128)===0?(o.flags=r&-65537|128,o):null;case 26:case 27:case 5:return Kr(o),null;case 31:if(o.memoizedState!==null){if($i(o),o.alternate===null)throw Error(i(340));Na()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 13:if($i(o),r=o.memoizedState,r!==null&&r.dehydrated!==null){if(o.alternate===null)throw Error(i(340));Na()}return r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 19:return iv(o),r=o.flags,r&65536?(o.flags=r&-65537|128,r=o.memoizedState,r!==null&&(r.rendering=null,r.tail=null),o.flags|=4,o):null;case 4:return Dr(),null;case 10:return Us(o.type),null;case 22:case 23:return $i(o),tv(),r!==null&&Et(Oa),r=o.flags,r&65536?(o.flags=r&-65537|128,o):null;case 24:return Us(fn),null;case 25:return null;default:return null}}function ek(r,o){switch(Ug(o),o.tag){case 3:Us(fn),Dr();break;case 26:case 27:case 5:Kr(o);break;case 4:Dr();break;case 31:o.memoizedState!==null&&$i(o);break;case 13:$i(o);break;case 19:iv(o);break;case 10:Us(o.type);break;case 22:case 23:$i(o),tv(),r!==null&&Et(Oa);break;case 24:Us(fn)}}function Iu(r,o){try{var c=o.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var v=d.next;c=v;do{if((c.tag&r)===r){d=void 0;var y=c.create,E=c.inst;d=y(),E.destroy=d}c=c.next}while(c!==v)}}catch(O){Ct(o,o.return,O)}}function Ao(r,o,c){try{var d=o.updateQueue,v=d!==null?d.lastEffect:null;if(v!==null){var y=v.next;d=y;do{if((d.tag&r)===r){var E=d.inst,O=E.destroy;if(O!==void 0){E.destroy=void 0,v=o;var H=c,Q=O;try{Q()}catch(oe){Ct(v,H,oe)}}}d=d.next}while(d!==y)}}catch(oe){Ct(o,o.return,oe)}}function tk(r){var o=r.updateQueue;if(o!==null){var c=r.stateNode;try{qw(o,c)}catch(d){Ct(r,r.return,d)}}}function nk(r,o,c){c.props=Pa(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(d){Ct(r,o,d)}}function Xr(r,o){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:var v=r.stateNode,y=Is(r.memoizedProps,v);(v.ref===null||v.ref.name!==y)&&(v.ref=cE(y)),d=v.ref;break;case 7:if(r.stateNode===null){var E=new Gi(r);m(r.child,!1,SL,E,void 0,void 0),r.stateNode=E}d=r.stateNode;break;default:d=r.stateNode}typeof c=="function"?r.refCleanup=c(d):c.current=d}}catch(O){Ct(r,o,O)}}function Xn(r,o){var c=r.ref,d=r.refCleanup;if(c!==null)if(typeof d=="function")try{d()}catch(v){Ct(r,o,v)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(v){Ct(r,o,v)}else c.current=null}function sf(r,o){if((r.tag===5||r.tag===27||r.tag===6)&&r.alternate===null&&o!==null)for(var c=0;c<o.length;c++)mE(r.stateNode,o[c])}function ik(r){for(var o=r.return;o!==null&&(zv(o)&&mE(r.stateNode,o.stateNode),!jv(o));)o=o.return}function Pu(r){for(var o=r.return;o!==null&&(zv(o)&&wL(r.stateNode,o.stateNode),!jv(o));)o=o.return}function jv(r){return r.tag===5||r.tag===3||r.tag===27}function zv(r){return r&&r.tag===7&&r.stateNode!==null}function Mv(r){var o=r.type,c=r.memoizedProps,d=r.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":c.autoFocus&&d.focus();break e;case"img":c.src?d.src=c.src:c.srcSet&&(d.srcset=c.srcSet)}}catch(v){Ct(r,r.return,v)}}function Iv(r,o,c){try{var d=r.stateNode;rL(d,r.type,c,o),d[Ni]=o}catch(v){Ct(r,r.return,v)}}function rk(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Lo(r.type)||r.tag===4}function Pv(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||rk(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&Lo(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function Lv(r,o,c,d){var v=r.tag;if(v===5||v===6)v=r.stateNode,o?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(v,o):(o=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,o.appendChild(v),c=c._reactRootContainer,c!=null||o.onclick!==null||(o.onclick=Gr)),sf(r,d),pt=!0;else if(v!==4&&(v===27&&(sf(r,d),d=null,Lo(r.type)&&(c=r.stateNode,o=null)),r=r.child,r!==null))for(Lv(r,o,c,d),r=r.sibling;r!==null;)Lv(r,o,c,d),r=r.sibling}function of(r,o,c,d){var v=r.tag;if(v===5||v===6)v=r.stateNode,o?c.insertBefore(v,o):c.appendChild(v),sf(r,d),pt=!0;else if(v!==4&&(v===27&&(sf(r,d),d=null,Lo(r.type)&&(c=r.stateNode)),r=r.child,r!==null))for(of(r,o,c,d),r=r.sibling;r!==null;)of(r,o,c,d),r=r.sibling}function sk(r){var o=r.stateNode,c=r.memoizedProps;try{for(var d=r.type,v=o.attributes;v.length;)o.removeAttributeNode(v[0]);Qn(o,d,c),o[Vn]=r,o[Ni]=c}catch(y){Ct(r,r.return,y)}}var af=!1,qi=null;function ok(r){(r.tag===30||(r.subtreeFlags&33554432)!==0)&&(af=!0)}var Qr=null;function ak(){var r=Qr;return Qr=null,r}var Ti=0;function Vl(r,o,c,d,v){return Ti=0,lk(r.child,o,c,d,v)}function lk(r,o,c,d,v){for(var y=!1;r!==null;){if(r.tag===5){var E=r.stateNode;if(d!==null){var O=xy(E);d.push(O),O.view&&(y=!0)}else y||xy(E).view&&(y=!0);af=!0,aE(E,Ti===0?o:o+"_"+Ti,c),Ti++}else(r.tag!==22||r.memoizedState===null)&&(r.tag===30&&v||lk(r.child,o,c,d,v)&&(y=!0));r=r.sibling}return y}function Jr(r,o){for(;r!==null;)r.tag===5?lE(r.stateNode,r.memoizedProps):(r.tag!==22||r.memoizedState===null)&&(r.tag===30&&o||Jr(r.child,o)),r=r.sibling}function lf(r){if((r.subtreeFlags&18874368)!==0)for(r=r.child;r!==null;){if((r.tag!==22||r.memoizedState===null)&&(lf(r),r.tag===30&&(r.flags&18874368)!==0&&r.stateNode.paired)){var o=r.memoizedProps;if(o.name==null||o.name==="auto")throw Error(i(544));var c=o.name;o=Ps(o.default,o.share),o!=="none"&&(Vl(r,c,o,null,!1)||Jr(r.child,!1))}r=r.sibling}}function Bv(r,o){if(r.tag===30){var c=r.stateNode,d=r.memoizedProps,v=Is(d,c),y=Ps(d.default,c.paired?d.share:d.enter);y!=="none"?Vl(r,v,y,null,!1)?(lf(r),c.paired||o||tc(r,d.onEnter)):Jr(r.child,!1):lf(r)}else if((r.subtreeFlags&33554432)!==0)for(r=r.child;r!==null;)Bv(r,o),r=r.sibling;else lf(r)}function Fv(r){if(qi!==null&&qi.size!==0){var o=qi;if((r.subtreeFlags&18874368)!==0)for(r=r.child;r!==null;){if(r.tag!==22||r.memoizedState===null){if(r.tag===30&&(r.flags&18874368)!==0){var c=r.memoizedProps,d=c.name;if(d!=null&&d!=="auto"){var v=o.get(d);if(v!==void 0){var y=Ps(c.default,c.share);if(y!=="none"&&(Vl(r,d,y,null,!1)?(y=r.stateNode,v.paired=y,y.paired=v,tc(r,c.onShare)):Jr(r.child,!1)),o.delete(d),o.size===0)break}}}Fv(r)}r=r.sibling}}}function Uv(r){if(r.tag===30){var o=r.memoizedProps,c=Is(o,r.stateNode),d=qi!==null?qi.get(c):void 0,v=Ps(o.default,d!==void 0?o.share:o.exit);v!=="none"&&(Vl(r,c,v,null,!1)?d!==void 0?(v=r.stateNode,d.paired=v,v.paired=d,qi.delete(c),tc(r,o.onShare)):tc(r,o.onExit):Jr(r.child,!1)),qi!==null&&Fv(r)}else if((r.subtreeFlags&33554432)!==0)for(r=r.child;r!==null;)Uv(r),r=r.sibling;else qi!==null&&Fv(r)}function ck(r){for(r=r.child;r!==null;){if(r.tag===30){var o=r.memoizedProps,c=Is(o,r.stateNode);o=Ps(o.default,o.update),r.flags&=-5,o!=="none"&&Vl(r,c,o,r.memoizedState=[],!1)}else(r.subtreeFlags&33554432)!==0&&ck(r);r=r.sibling}}function Hv(r){if((r.subtreeFlags&18874368)!==0)for(r=r.child;r!==null;){if(r.tag!==22||r.memoizedState===null){if(r.tag===30&&(r.flags&18874368)!==0){var o=r.stateNode;o.paired!==null&&(o.paired=null,Jr(r.child,!1))}Hv(r)}r=r.sibling}}function cf(r){if(r.tag===30)r.stateNode.paired=null,Jr(r.child,!1),Hv(r);else if((r.subtreeFlags&33554432)!==0)for(r=r.child;r!==null;)cf(r),r=r.sibling;else Hv(r)}function uk(r){for(r=r.child;r!==null;)r.tag===30?Jr(r.child,!1):(r.subtreeFlags&33554432)!==0&&uk(r),r=r.sibling}function $v(r,o,c,d,v,y,E){for(var O=!1;o!==null;){if(o.tag===5){var H=o.stateNode;if(y!==null&&Ti<y.length){var Q=y[Ti],oe=xy(H);(Q.view||oe.view)&&(O=!0);var ue;if(ue=(r.flags&4)===0)if(oe.clip)ue=!0;else{ue=Q.rect;var Y=oe.rect;ue=ue.y!==Y.y||ue.x!==Y.x||ue.height!==Y.height||ue.width!==Y.width}ue&&(r.flags|=4),oe.abs?oe=!Q.abs:(Q=Q.rect,oe=oe.rect,oe=Q.height!==oe.height||Q.width!==oe.width),oe&&(r.flags|=32)}else r.flags|=32;(r.flags&4)!==0&&aE(H,Ti===0?c:c+"_"+Ti,v),O&&(r.flags&4)!==0||(Qr===null&&(Qr=[]),Qr.push(H,Ti===0?d:d+"_"+Ti,o.memoizedProps)),Ti++}else(o.tag!==22||o.memoizedState===null)&&(o.tag===30&&E?r.flags|=o.flags&32:$v(r,o.child,c,d,v,y,E)&&(O=!0));o=o.sibling}return O}function dk(r,o){for(r=r.child;r!==null;){if(r.tag===30){var c=r.memoizedProps,d=r.stateNode,v=Is(c,d),y=Ps(c.default,c.update),E;E=r.memoizedState,r.memoizedState=null,d=r;var O=r.child;Ti=0,v=$v(d,O,v,v,y,E,!1),(r.flags&4)!==0&&v&&tc(r,c.onUpdate)}else(r.subtreeFlags&33554432)!==0&&dk(r);r=r.sibling}}var Ln=!1,bt=!1,es=!1,qv=!1,hk=typeof WeakSet=="function"?WeakSet:Set,Bn=null,ts=!1,Lu=!1,uf=!1,Wv=!1;function j4(r,o,c){if(r=r.containerInfo,gy=dc,r=gw(r),Ag(r)){if("selectionStart"in r)var d={start:r.selectionStart,end:r.selectionEnd};else e:{d=(d=r.ownerDocument)&&d.defaultView||window;var v=d.getSelection&&d.getSelection();if(v&&v.rangeCount!==0){d=v.anchorNode;var y=v.anchorOffset,E=v.focusNode;v=v.focusOffset;try{d.nodeType,E.nodeType}catch{d=null;break e}var O=0,H=-1,Q=-1,oe=0,ue=0,Y=r,se=null;t:for(;;){for(var xe;Y!==d||y!==0&&Y.nodeType!==3||(H=O+y),Y!==E||v!==0&&Y.nodeType!==3||(Q=O+v),Y.nodeType===3&&(O+=Y.nodeValue.length),(xe=Y.firstChild)!==null;)se=Y,Y=xe;for(;;){if(Y===r)break t;if(se===d&&++oe===y&&(H=O),se===E&&++ue===v&&(Q=O),(xe=Y.nextSibling)!==null)break;Y=se,se=Y.parentNode}Y=xe}d=H===-1||Q===-1?null:{start:H,end:Q}}else d=null}d=d||{start:0,end:0}}else d=null;for(vy={focusedElem:r,selectionRange:d},dc=!1,c=(c&335544064)===c,Bn=o,o=c?9270:1024;Bn!==null;){if(r=Bn,c&&(d=r.deletions,d!==null))for(y=0;y<d.length;y++)c&&Uv(d[y]);if(r.alternate===null&&(r.flags&2)!==0)c&&ok(r),df(c);else{if(r.tag===22){if(d=r.alternate,r.memoizedState!==null){d!==null&&d.memoizedState===null&&c&&Uv(d),df(c);continue}else if(d!==null&&d.memoizedState!==null){c&&ok(r),df(c);continue}}d=r.child,(r.subtreeFlags&o)!==0&&d!==null?(d.return=r,Bn=d):(c&&ck(r),df(c))}}qi=null}function df(r){for(;Bn!==null;){var o=Bn,c=r,d=o.alternate,v=o.flags;switch(o.tag){case 0:case 11:case 15:break;case 1:if((v&1024)!==0&&d!==null){c=void 0,v=d.memoizedProps,d=d.memoizedState;var y=o.stateNode;try{var E=Pa(o.type,v);c=y.getSnapshotBeforeUpdate(E,d),y.__reactInternalSnapshotBeforeUpdate=c}catch(O){Ct(o,o.return,O)}}break;case 3:if((v&1024)!==0){if(d=o.stateNode.containerInfo,c=d.nodeType,c===9)Cy(d);else if(c===1)switch(d.nodeName){case"HEAD":case"HTML":case"BODY":Cy(d);break;default:d.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:c&&d!==null&&(c=Is(d.memoizedProps,d.stateNode),v=o.memoizedProps,v=Ps(v.default,v.update),v!=="none"&&Vl(d,c,v,d.memoizedState=[],!0));break;default:if((v&1024)!==0)throw Error(i(163))}if(d=o.sibling,d!==null){d.return=o.return,Bn=d;break}Bn=o.return}}function fk(r,o,c){var d=c.flags;switch(c.tag){case 0:case 11:case 15:ns(r,c),d&4&&Iu(5,c);break;case 1:if(ns(r,c),d&4)if(r=c.stateNode,o===null)try{r.componentDidMount()}catch(E){Ct(c,c.return,E)}else{var v=Pa(c.type,o.memoizedProps);o=o.memoizedState;try{r.componentDidUpdate(v,o,r.__reactInternalSnapshotBeforeUpdate)}catch(E){Ct(c,c.return,E)}}d&64&&tk(c),d&512&&Xr(c,c.return);break;case 3:if(ns(r,c),d&64&&(r=c.updateQueue,r!==null)){if(o=null,c.child!==null)switch(c.child.tag){case 27:case 5:o=c.child.stateNode;break;case 1:o=c.child.stateNode}try{qw(r,o)}catch(E){Ct(c,c.return,E)}}break;case 27:o===null&&d&4&&sk(c);case 26:case 5:ns(r,c),o===null&&d&4&&Mv(c),d&512&&Xr(c,c.return);break;case 12:ns(r,c);break;case 31:ns(r,c),d&4&&vk(r,c);break;case 13:ns(r,c),d&4&&yk(r,c),d&64&&(r=c.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(c=W4.bind(null,c),EL(r,c))));break;case 22:if(d=c.memoizedState!==null||Ln,!d){var y=o!==null&&o.memoizedState!==null||bt;o=Ln,v=bt,Ln=d,(bt=y)&&!v?(d=2,(c.subtreeFlags&8772)!==0&&(d|=1),zr(r,c,d)):ns(r,c),Ln=o,bt=v}break;case 30:ns(r,c),d&512&&Xr(c,c.return);break;case 7:d&512&&Xr(c,c.return);default:ns(r,c)}}function Kv(r,o){for(r=r.child;r!==null;)pk(r,o),r=r.sibling}function pk(r,o){switch(r.tag){case 5:case 26:try{var c=r.stateNode;if(o){var d=c.style;typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none"}else{var v=r.stateNode,y=r.memoizedProps.style,E=y!=null&&y.hasOwnProperty("display")?y.display:null;v.style.display=E==null||typeof E=="boolean"?"":(""+E).trim()}}catch(H){Ct(r,r.return,H)}Vv(r,o);break;case 6:try{r.stateNode.nodeValue=o?"":r.memoizedProps,pt=!0}catch(H){Ct(r,r.return,H)}break;case 18:try{var O=r.stateNode;o?oE(O,!0):oE(r.stateNode,!1)}catch(H){Ct(r,r.return,H)}break;case 22:case 23:r.memoizedState===null&&Kv(r,o);break;default:Kv(r,o)}}function Vv(r,o){if(r.subtreeFlags&67108864)for(r=r.child;r!==null;){e:{var c=r,d=o;switch(c.tag){case 4:pk(c,d);break e;case 22:c.memoizedState===null&&Vv(c,d);break e;default:Vv(c,d)}}r=r.sibling}}function mk(r){var o=r.alternate;o!==null&&(r.alternate=null,mk(o)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(o=r.stateNode,o!==null&&mh(o)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Ht=null,Di=!1;function Or(r,o,c){for(c=c.child;c!==null;)gk(r,o,c),c=c.sibling}function gk(r,o,c){if(Bi&&typeof Bi.onCommitFiberUnmount=="function")try{Bi.onCommitFiberUnmount(au,c)}catch{}switch(c.tag){case 26:bt||Xn(c,o),Or(r,o,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&!bt&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:bt||Xn(c,o),Pu(c);var d=Ht,v=Di;Lo(c.type)&&(Ht=c.stateNode,Di=!1),Or(r,o,c),bE(c.stateNode,c.type,c.memoizedProps),Ht=d,Di=v;break;case 5:bt||Xn(c,o),Pu(c);case 6:if(c.tag===6&&Pu(c),d=Ht,v=Di,Ht=null,Or(r,o,c),Ht=d,Di=v,Ht!==null)if(Di)try{(Ht.nodeType===9?Ht.body:Ht.nodeName==="HTML"?Ht.ownerDocument.body:Ht).removeChild(c.stateNode),pt=!0}catch(y){Ct(c,o,y)}else try{Ht.removeChild(c.stateNode),pt=!0}catch(y){Ct(c,o,y)}break;case 18:Ht!==null&&(Di?(r=Ht,sE(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,c.stateNode),hc(r)):sE(Ht,c.stateNode));break;case 4:d=Ht,v=Di,Ht=c.stateNode.containerInfo,Di=!0,Or(r,o,c),Ht=d,Di=v;break;case 0:case 11:case 14:case 15:Ao(2,c,o),bt||Ao(4,c,o),Or(r,o,c);break;case 1:bt||(Xn(c,o),d=c.stateNode,typeof d.componentWillUnmount=="function"&&nk(c,o,d)),Or(r,o,c);break;case 21:Or(r,o,c);break;case 22:bt=(d=bt)||c.memoizedState!==null,Or(r,o,c),bt=d;break;case 30:Xn(c,o),Or(r,o,c);break;case 7:bt||Xn(c,o),Or(r,o,c);break;default:Or(r,o,c)}}function vk(r,o){if(o.memoizedState===null&&(r=o.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{hc(r)}catch(c){Ct(o,o.return,c)}}}function yk(r,o){if(o.memoizedState===null&&(r=o.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{hc(r)}catch(c){Ct(o,o.return,c)}}function z4(r){switch(r.tag){case 31:case 13:case 19:var o=r.stateNode;return o===null&&(o=r.stateNode=new hk),o;case 22:return r=r.stateNode,o=r._retryCache,o===null&&(o=r._retryCache=new hk),o;default:throw Error(i(435,r.tag))}}function hf(r,o){var c=z4(r);o.forEach(function(d){if(!c.has(d)){c.add(d);var v=K4.bind(null,r,d);d.then(v,v)}})}function mi(r,o,c){var d=o.deletions;if(d!==null)for(var v=0;v<d.length;v++){var y=d[v],E=r,O=o,H=O;e:for(;H!==null;){switch(H.tag){case 27:if(Lo(H.type)){Ht=H.stateNode,Di=!1;break e}break;case 5:Ht=H.stateNode,Di=!1;break e;case 3:case 4:Ht=H.stateNode.containerInfo,Di=!0;break e}H=H.return}if(Ht===null)throw Error(i(160));gk(E,O,y),Ht=null,Di=!1,E=y.alternate,E!==null&&(E.return=null),y.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)_k(o,r,c),o=o.sibling}var jr=null;function _k(r,o,c){var d=r.alternate,v=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(v&4&&(d=r.updateQueue,d=d!==null?d.events:null,d!==null))for(var y=0;y<d.length;y++){var E=d[y];E.ref.impl=E.nextImpl}mi(o,r,c),gi(r),v&4&&(Ao(3,r,r.return),Iu(3,r),Ao(5,r,r.return));break;case 1:mi(o,r,c),gi(r),v&512&&(bt||d===null||Xn(d,d.return)),v&64&&Ln&&(r=r.updateQueue,r!==null&&(o=r.callbacks,o!==null&&(c=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=c===null?o:c.concat(o))));break;case 26:if(y=jr,mi(o,r,c),gi(r),v&512&&(bt||d===null||Xn(d,d.return)),v&4)if(v=d!==null?d.memoizedState:null,c=r.memoizedState,d===null)if(c===null)if(r.stateNode===null)if(Ln)r.stateNode=nE(r.type,r.memoizedProps,o.containerInfo,r);else{e:{o=r.type,c=r.memoizedProps,v=y.ownerDocument||y;t:switch(o){case"title":d=v.getElementsByTagName("title")[0],(!d||d[uu]||d[Vn]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=v.createElement(o),v.head.insertBefore(d,v.querySelector("head > title"))),Qn(d,o,c),d[Vn]=r,In(d),o=d;break e;case"link":if(y=EE("link","href",v).get(o+(c.href||""))){for(E=0;E<y.length;E++)if(d=y[E],d.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&d.getAttribute("rel")===(c.rel==null?null:c.rel)&&d.getAttribute("title")===(c.title==null?null:c.title)&&d.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){y.splice(E,1);break t}}d=v.createElement(o),Qn(d,o,c),v.head.appendChild(d);break;case"meta":if(y=EE("meta","content",v).get(o+(c.content||""))){for(E=0;E<y.length;E++)if(d=y[E],d.getAttribute("content")===(c.content==null?null:""+c.content)&&d.getAttribute("name")===(c.name==null?null:c.name)&&d.getAttribute("property")===(c.property==null?null:c.property)&&d.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&d.getAttribute("charset")===(c.charSet==null?null:c.charSet)){y.splice(E,1);break t}}d=v.createElement(o),Qn(d,o,c),v.head.appendChild(d);break;default:throw Error(i(468,o))}d[Vn]=r,In(d),o=d}r.stateNode=o}else Ln||Ay(y,r.type,r.stateNode);else r.stateNode=kE(y,c,r.memoizedProps);else v!==c?(v===null?(o=d.stateNode,o===null||bt||o.parentNode.removeChild(o)):v.count--,c===null?Ln||Ay(y,r.type,r.stateNode):kE(y,c,r.memoizedProps)):c===null&&r.stateNode!==null&&Iv(r,r.memoizedProps,d.memoizedProps);break;case 27:mi(o,r,c),gi(r),v&512&&(bt||d===null||Xn(d,d.return)),d!==null&&v&4&&Iv(r,r.memoizedProps,d.memoizedProps);break;case 5:if(y=es,es=!1,mi(o,r,c),es=y,gi(r),v&512&&(bt||d===null||Xn(d,d.return)),r.flags&32){o=r.stateNode;try{Tl(o,""),pt=!0}catch(oe){Ct(r,r.return,oe)}}v&4&&r.stateNode!=null&&(o=r.memoizedProps,Iv(r,o,d!==null?d.memoizedProps:o)),v&1024&&(qv=!0);break;case 6:if(mi(o,r,c),gi(r),v&4){if(r.stateNode===null)throw Error(i(162));o=r.memoizedProps,c=r.stateNode;try{c.nodeValue=o,pt=!0}catch(oe){Ct(r,r.return,oe)}}break;case 3:if(pt=!1,Nf=null,y=jr,jr=Vu(o.containerInfo),mi(o,r,c),jr=y,gi(r),v&4&&d!==null&&d.memoizedState.isDehydrated)try{hc(o.containerInfo)}catch(oe){Ct(r,r.return,oe)}qv&&(qv=!1,bk(r)),pt=!1;break;case 4:v=es,es=Ln,d=FS(),y=jr,jr=Vu(r.stateNode.containerInfo),mi(o,r,c),gi(r),jr=y,pt&&Lu&&(uf=!0),pt=d,es=v;break;case 12:mi(o,r,c),gi(r);break;case 31:mi(o,r,c),gi(r),v&4&&(o=r.updateQueue,o!==null&&(r.updateQueue=null,hf(r,o)));break;case 13:mi(o,r,c),gi(r),r.child.flags&8192&&r.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(mf=_t()),v&4&&(o=r.updateQueue,o!==null&&(r.updateQueue=null,hf(r,o)));break;case 22:y=r.memoizedState!==null,E=d!==null&&d.memoizedState!==null;var O=Ln,H=bt,Q=es;Ln=O||y,es=Q||y,bt=H||E,mi(o,r,c),bt=H,es=Q,Ln=O,gi(r),v&8192&&(o=r.stateNode,o._visibility=y?o._visibility&-2:o._visibility|1,!y||d===null||E||Ln||bt||(o=E||bt,c=Ln,d=bt,Ln=y||Ln,bt=o,Oo(r,2),Ln=c,bt=d),!y&&es||Kv(r,y)),v&4&&(o=r.updateQueue,o!==null&&(c=o.retryQueue,c!==null&&(o.retryQueue=null,hf(r,c))));break;case 19:mi(o,r,c),gi(r),v&4&&(o=r.updateQueue,o!==null&&(r.updateQueue=null,hf(r,o)));break;case 30:v&512&&(bt||d===null||Xn(d,d.return)),v=FS(),y=Lu,E=(c&335544064)===c,O=r.memoizedProps,Lu=E&&Ps(O.default,O.update)!=="none",mi(o,r,c),gi(r),E&&d!==null&&pt&&(r.flags|=4),Lu=y,pt=v;break;case 21:break;case 7:v&512&&(bt||d===null||Xn(d,d.return)),d&&d.stateNode!==null&&(d.stateNode._fragmentFiber=r);default:mi(o,r,c),gi(r)}}function gi(r){var o=r.flags;if(o&2){try{for(var c,d=r.return;d!==null;){if(rk(d)){c=d;break}d=d.return}d=null;for(var v=r.return;v!==null;){if(zv(v)){var y=v.stateNode;d===null?d=[y]:d.push(y)}if(jv(v))break;v=v.return}var E=d;if(c==null)throw Error(i(160));switch(c.tag){case 27:var O=c.stateNode,H=Pv(r);of(r,H,O,E);break;case 5:var Q=c.stateNode;c.flags&32&&(Tl(Q,""),c.flags&=-33);var oe=Pv(r);of(r,oe,Q,E);break;case 3:case 4:var ue=c.stateNode.containerInfo,Y=Pv(r);Lv(r,Y,ue,E);break;default:throw Error(i(161))}}catch(se){Ct(r,r.return,se)}r.flags&=-3}o&4096&&(r.flags&=-4097)}function bk(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var o=r;bk(o),o.tag===5&&o.flags&1024&&(o=o.stateNode,dc=!0,o.reset(),dc=!1),r=r.sibling}}function Gl(r,o){if(o.subtreeFlags&9270)for(o=o.child;o!==null;)xk(o,r),o=o.sibling;else dk(o)}function xk(r,o){var c=r.alternate;if(c===null)Bv(r,!1);else switch(r.tag){case 3:if(Wv=ts=!1,ak(),Gl(o,r),!ts&&!uf){if(r=Qr,r!==null)for(var d=0;d<r.length;d+=3){c=r[d];var v=r[d+1];lE(c,r[d+2]),c=c.ownerDocument.documentElement,c!==null&&c.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+v+")"})}r=o.containerInfo,r=r.nodeType===9?r.documentElement:r.ownerDocument.documentElement,r!==null&&r.style.viewTransitionName===""&&(r.style.viewTransitionName="none",r.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),r.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Wv=!0}Qr=null;break;case 5:Gl(o,r);break;case 4:d=ts,ts=!1,Gl(o,r),ts&&(uf=!0),ts=d;break;case 22:r.memoizedState===null&&(c.memoizedState!==null?Bv(r,!1):Gl(o,r));break;case 30:d=ts,v=ak(),ts=!1,Gl(o,r),ts&&(r.flags|=4);var y=r.memoizedProps,E=r.stateNode;o=Is(y,E),E=Is(c.memoizedProps,E);var O=Ps(y.default,y.update);O==="none"?o=!1:(y=c.memoizedState,c.memoizedState=null,c=r.child,Ti=0,o=$v(r,c,o,E,O,y,!0),Ti!==(y===null?0:y.length)&&(r.flags|=32)),(r.flags&4)!==0&&o?(tc(r,r.memoizedProps.onUpdate),Qr=v):v!==null&&(v.push.apply(v,Qr),Qr=v),ts=(r.flags&32)!==0?!0:d;break;default:Gl(o,r)}}function ns(r,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)fk(r,o.alternate,o),o=o.sibling}function Oo(r,o){for(r=r.child;r!==null;){var c=r,d=o;switch(c.tag){case 0:case 11:case 14:case 15:Ao(4,c,c.return),Oo(c,d);break;case 1:Xn(c,c.return);var v=c.stateNode;typeof v.componentWillUnmount=="function"&&nk(c,c.return,v),Oo(c,d);break;case 27:(d&2)!==0&&bE(c.stateNode,c.type,c.memoizedProps);case 5:Xn(c,c.return),c.tag!==5&&c.tag!==27||Pu(c),Oo(c,d);break;case 6:Pu(c);break;case 26:Xn(c,c.return),v=c.stateNode,c.memoizedState!==null||v===null||bt||v.parentNode.removeChild(v),Oo(c,d);break;case 22:c.memoizedState===null&&Oo(c,d);break;case 30:Xn(c,c.return),Oo(c,d);break;case 7:Xn(c,c.return);default:Oo(c,d)}r=r.sibling}}function zr(r,o,c){for(c=(o.subtreeFlags&8772)!==0?c:c&-2,o=o.child;o!==null;){var d=o.alternate,v=r,y=o,E=y.flags,O=(c&1)!==0;switch(y.tag){case 0:case 11:case 15:zr(v,y,c),Iu(4,y);break;case 1:if(zr(v,y,c),d=y,v=d.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(oe){Ct(d,d.return,oe)}if(d=y,v=d.updateQueue,v!==null){var H=d.stateNode;try{var Q=v.shared.hiddenCallbacks;if(Q!==null)for(v.shared.hiddenCallbacks=null,v=0;v<Q.length;v++)$w(Q[v],H)}catch(oe){Ct(d,d.return,oe)}}O&&E&64&&tk(y),Xr(y,y.return);break;case 27:(c&2)!==0&&sk(y);case 5:y.tag!==5&&y.tag!==27||ik(y),zr(v,y,c),O&&d===null&&E&4&&Mv(y),Xr(y,y.return);break;case 6:ik(y);break;case 26:H=y.stateNode,y.memoizedState!==null||H===null||Ln||Ay(Vu(H.ownerDocument),y.type,H),zr(v,y,c),O&&d===null&&E&4&&Mv(y),Xr(y,y.return);break;case 12:zr(v,y,c);break;case 31:zr(v,y,c),O&&E&4&&vk(v,y);break;case 13:zr(v,y,c),O&&E&4&&yk(v,y);break;case 22:y.memoizedState===null&&zr(v,y,c),Xr(y,y.return);break;case 30:zr(v,y,c),Xr(y,y.return);break;case 7:Xr(y,y.return);default:zr(v,y,c)}o=o.sibling}}function Gv(r,o){var c=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),r=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(r=o.memoizedState.cachePool.pool),r!==c&&(r!=null&&r.refCount++,c!=null&&wu(c))}function Zv(r,o){r=null,o.alternate!==null&&(r=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==r&&(o.refCount++,r!=null&&wu(r))}function mr(r,o,c,d){var v=(c&335544064)===c;if(o.subtreeFlags&(v?10262:10256))for(o=o.child;o!==null;)Sk(r,o,c,d),o=o.sibling;else v&&uk(o)}function Sk(r,o,c,d){var v=(c&335544064)===c;v&&o.alternate===null&&o.return!==null&&o.return.alternate!==null&&cf(o);var y=o.flags;switch(o.tag){case 0:case 11:case 15:mr(r,o,c,d),y&2048&&Iu(9,o);break;case 1:mr(r,o,c,d);break;case 3:mr(r,o,c,d),v&&Wv&&(r=r.containerInfo,r=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,r.style.viewTransitionName==="root"&&(r.style.viewTransitionName=""),r=r.ownerDocument.documentElement,r!==null&&r.style.viewTransitionName==="none"&&(r.style.viewTransitionName="")),y&2048&&(y=null,o.alternate!==null&&(y=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==y&&(o.refCount++,y!=null&&wu(y)));break;case 12:if(y&2048){mr(r,o,c,d),y=o.stateNode;try{var E=o.memoizedProps,O=E.id,H=E.onPostCommit;typeof H=="function"&&H(O,o.alternate===null?"mount":"update",y.passiveEffectDuration,-0)}catch(Q){Ct(o,o.return,Q)}}else mr(r,o,c,d);break;case 31:mr(r,o,c,d);break;case 13:mr(r,o,c,d);break;case 23:break;case 22:E=o.stateNode,O=o.alternate,o.memoizedState!==null?(v&&O!==null&&O.memoizedState===null&&cf(O),E._visibility&2?mr(r,o,c,d):Bu(r,o)):(v&&O!==null&&O.memoizedState!==null&&cf(o),E._visibility&2?mr(r,o,c,d):(E._visibility|=2,Zl(r,o,c,d,(o.subtreeFlags&10256)!==0||!1))),y&2048&&Gv(O,o);break;case 24:mr(r,o,c,d),y&2048&&Zv(o.alternate,o);break;case 30:v&&(y=o.alternate,y!==null&&(Jr(y.child,!0),Jr(o.child,!0))),mr(r,o,c,d);break;default:mr(r,o,c,d)}}function Zl(r,o,c,d,v){for(v=v&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var y=r,E=o,O=c,H=d,Q=E.flags;switch(E.tag){case 0:case 11:case 15:Zl(y,E,O,H,v),Iu(8,E);break;case 23:break;case 22:var oe=E.stateNode;E.memoizedState!==null?oe._visibility&2?Zl(y,E,O,H,v):Bu(y,E):(oe._visibility|=2,Zl(y,E,O,H,v)),v&&Q&2048&&Gv(E.alternate,E);break;case 24:Zl(y,E,O,H,v),v&&Q&2048&&Zv(E.alternate,E);break;default:Zl(y,E,O,H,v)}o=o.sibling}}function Bu(r,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var c=r,d=o,v=d.flags;switch(d.tag){case 22:Bu(c,d),v&2048&&Gv(d.alternate,d);break;case 24:Bu(c,d),v&2048&&Zv(d.alternate,d);break;default:Bu(c,d)}o=o.sibling}}var La=8192;function Ba(r,o,c){if(r.subtreeFlags&La)for(r=r.child;r!==null;)wk(r,o,c),r=r.sibling}function wk(r,o,c){switch(r.tag){case 26:Ba(r,o,c),r.flags&La&&(r.memoizedState!==null?FL(c,jr,r.memoizedState,r.memoizedProps):(r=r.stateNode,(o&335544128)===o&&DE(c,r)));break;case 5:Ba(r,o,c),r.flags&La&&(r=r.stateNode,(o&335544128)===o&&DE(c,r));break;case 3:case 4:var d=jr;jr=Vu(r.stateNode.containerInfo),Ba(r,o,c),jr=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=La,La=16777216,Ba(r,o,c),La=d):Ba(r,o,c));break;case 30:if((r.flags&La)!==0&&(d=r.memoizedProps.name,d!=null&&d!=="auto")){var v=r.stateNode;v.paired=null,qi===null&&(qi=new Map),qi.set(d,v)}Ba(r,o,c);break;default:Ba(r,o,c)}}function Ck(r){var o=r.alternate;if(o!==null&&(r=o.child,r!==null)){o.child=null;do o=r.sibling,r.sibling=null,r=o;while(r!==null)}}function Fu(r){var o=r.deletions;if((r.flags&16)!==0){if(o!==null)for(var c=0;c<o.length;c++){var d=o[c];Bn=d,Ek(d,r)}Ck(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)kk(r),r=r.sibling}function kk(r){switch(r.tag){case 0:case 11:case 15:Fu(r),r.flags&2048&&Ao(9,r,r.return);break;case 3:Fu(r);break;case 12:Fu(r);break;case 22:var o=r.stateNode;r.memoizedState!==null&&o._visibility&2&&(r.return===null||r.return.tag!==13)?(o._visibility&=-3,ff(r)):Fu(r);break;default:Fu(r)}}function ff(r){var o=r.deletions;if((r.flags&16)!==0){if(o!==null)for(var c=0;c<o.length;c++){var d=o[c];Bn=d,Ek(d,r)}Ck(r)}for(r=r.child;r!==null;){switch(o=r,o.tag){case 0:case 11:case 15:Ao(8,o,o.return),ff(o);break;case 22:c=o.stateNode,c._visibility&2&&(c._visibility&=-3,ff(o));break;default:ff(o)}r=r.sibling}}function Ek(r,o){for(;Bn!==null;){var c=Bn;switch(c.tag){case 0:case 11:case 15:Ao(8,c,o);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var d=c.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:wu(c.memoizedState.cache)}if(d=c.child,d!==null)d.return=c,Bn=d;else e:for(c=r;Bn!==null;){d=Bn;var v=d.sibling,y=d.return;if(mk(d),d===c){Bn=null;break e}if(v!==null){v.return=y,Bn=v;break e}Bn=y}}}var M4={getCacheForType:function(r){var o=Gn(fn),c=o.data.get(r);return c===void 0&&(c=r(),o.data.set(r,c)),c},cacheSignal:function(){return Gn(fn).controller.signal}},I4=typeof WeakMap=="function"?WeakMap:Map,gt=0,At=null,ct=null,dt=0,wt=0,Wi=null,jo=!1,Yl=!1,Yv=!1,Ks=0,tn=0,zo=0,Fa=0,pf=0,Ki=0,Xl=0,Uu=null,Ai=null,Xv=!1,mf=0,Nk=0,gf=1/0,vf=null,Mo=null,Zt=0,Mr=null,Ua=null,is=0,Qv=0,Jv=null,Rk=null,Ql=null,Jl=null,ec=null,Hu=0,yf=null;function Vi(){return(gt&2)!==0&&dt!==0?dt&-dt:re.T!==null?cy():AS()}function Tk(){if(Ki===0)if((dt&536870912)===0||nt){var r=dh;dh<<=1,(dh&3932160)===0&&(dh=262144),Ki=r}else Ki=536870912;return r=Zn.current,r!==null&&(r.flags|=32),Ki}function tc(r,o){if(o!=null){var c=r.stateNode,d=c.ref;d===null&&(d=c.ref=cE(Is(r.memoizedProps,c))),Jl===null&&(Jl=[]),Jl.push(o.bind(null,d))}}function Oi(r,o,c){(r===At&&(wt===2||wt===9)||r.cancelPendingCommit!==null)&&(nc(r,0),Io(r,dt,Ki,!1)),cu(r,c),((gt&2)===0||r!==At)&&(r===At&&((gt&2)===0&&(Fa|=c),tn===4&&Io(r,dt,Ki,!1)),rs(r))}function Dk(r,o,c){if((gt&6)!==0)throw Error(i(327));var d=!c&&(o&127)===0&&(o&r.expiredLanes)===0||lu(r,o),v=d?B4(r,o):ty(r,o,!0),y=d;do{if(v===0){Yl&&!d&&Io(r,o,0,!1);break}else{if(c=r.current.alternate,y&&!P4(c)){v=ty(r,o,!1),y=!1;continue}if(v===2){if(y=o,r.errorRecoveryDisabledLanes&y)var E=0;else E=r.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){o=E;e:{var O=r;v=Uu;var H=O.current.memoizedState.isDehydrated;if(H&&(nc(O,E).flags|=256),E=ty(O,E,!1),E!==2&&E!==6){if(Yv&&!H){O.errorRecoveryDisabledLanes|=y,Fa|=y,v=4;break e}y=Ai,Ai=v,y!==null&&(Ai===null?Ai=y:Ai.push.apply(Ai,y))}v=E}if(y=!1,v!==2)continue}}if(v===1){nc(r,0),Io(r,o,0,!0);break}e:{switch(d=r,y=v,y){case 0:case 1:throw Error(i(345));case 4:if((o&4194048)!==o&&(o&62914560)!==o)break;case 6:Io(d,o,Ki,!jo);break e;case 2:Ai=null;break;case 3:case 5:break;default:throw Error(i(329))}if((o&62914560)===o&&(v=mf+300-_t(),10<v)){if(Io(d,o,Ki,!jo),fh(d,0,!0)!==0)break e;is=o,d.timeoutHandle=by(Ak.bind(null,d,c,Ai,vf,Xv,o,Ki,Fa,Xl,jo,y,"Throttled",-0,0),v);break e}Ak(d,c,Ai,vf,Xv,o,Ki,Fa,Xl,jo,y,null,-0,0)}}break}while(!0);rs(r)}function Ak(r,o,c,d,v,y,E,O,H,Q,oe,ue,Y,se){r.timeoutHandle=-1;var xe=o.subtreeFlags,je=(y&335544064)===y;if(ue=null,(je||xe&8192||(xe&16785408)===16785408)&&(ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Gr},qi=null,wk(o,y,ue),je&&(xe=ue,je=r.containerInfo,je=(je.nodeType===9?je:je.ownerDocument).__reactViewTransition,je!=null&&(xe.count++,xe.waitingForViewTransition=!0,xe=Yu.bind(xe),je.finished.then(xe,xe))),xe=(y&62914560)===y?mf-_t():(y&4194048)===y?Nk-_t():0,xe=UL(ue,xe),xe!==null)){is=y,r.cancelPendingCommit=xe(Bk.bind(null,r,o,y,c,d,v,E,O,H,Q,oe,ue,null,Y,se)),Io(r,y,E,!Q);return}Bk(r,o,y,c,d,v,E,O,H,Q,oe,ue)}function P4(r){for(var o=r;;){var c=o.tag;if((c===0||c===11||c===15)&&o.flags&16384&&(c=o.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var d=0;d<c.length;d++){var v=c[d],y=v.getSnapshot;v=v.value;try{if(!Hi(y(),v))return!1}catch{return!1}}if(c=o.child,o.subtreeFlags&16384&&c!==null)c.return=o,o=c;else{if(o===r)break;for(;o.sibling===null;){if(o.return===null||o.return===r)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Io(r,o,c,d){o=ES(r,o),o&=~pf,o&=~Fa,r.suspendedLanes|=o,r.pingedLanes&=~o,d&&(r.warmLanes|=o),d=r.expirationTimes;for(var v=o;0<v;){var y=31-Fi(v),E=1<<y;d[y]=-1,v&=~E}c!==0&&RS(r,c,o)}function _f(){return(gt&6)===0?($u(0),!1):!0}function ey(){if(ct!==null){if(wt===0)var r=ct.return;else r=ct,Fs=Ra=null,lv(r),Hl=null,Eu=0,r=ct;for(;r!==null;)ek(r.alternate,r),r=r.return;ct=null}}function nc(r,o){var c=r.timeoutHandle;return c!==-1&&(r.timeoutHandle=-1,aL(c)),c=r.cancelPendingCommit,c!==null&&(r.cancelPendingCommit=null,c()),is=0,ey(),At=r,ct=c=Ls(r.current,null),dt=o,wt=0,Wi=null,jo=!1,Yl=lu(r,o),Yv=!1,Xl=Ki=pf=Fa=zo=tn=0,Ai=Uu=null,Xv=!1,Ks=ES(r,o),Eh(),c}function Ok(r,o){Xe=null,re.H=Xh,o===Ul||o===Ph?(o=Bw(),wt=3):o===Zg?(o=Bw(),wt=4):wt=o===wv?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,Wi=o,ct===null&&(tn=1,Qh(r,dr(o,r.current)))}function jk(){var r=Zn.current;return r===null?!0:(dt&4194048)===dt?oi===null:(dt&62914560)===dt||(dt&536870912)!==0?r===oi:!1}function zk(){var r=re.H;return re.H=Xh,r===null?Xh:r}function Mk(){var r=re.A;return re.A=M4,r}function bf(){tn=4,jo||(dt&4194048)!==dt&&Zn.current!==null||(Yl=!0),(zo&134217727)===0&&(Fa&134217727)===0||At===null||Io(At,dt,Ki,!1)}function ty(r,o,c){var d=gt;gt|=2;var v=zk(),y=Mk();(At!==r||dt!==o)&&(vf=null,nc(r,o)),o=!1;var E=tn;e:do try{if(wt!==0&&ct!==null){var O=ct,H=Wi;switch(wt){case 8:ey(),E=6;break e;case 3:case 2:case 9:case 6:Zn.current===null&&(o=!0);var Q=wt;if(wt=0,Wi=null,ic(r,O,H,Q),c&&Yl){E=0;break e}break;default:Q=wt,wt=0,Wi=null,ic(r,O,H,Q)}}L4(),E=tn;break}catch(oe){Ok(r,oe)}while(!0);return o&&r.shellSuspendCounter++,Fs=Ra=null,gt=d,re.H=v,re.A=y,ct===null&&(At=null,dt=0,Eh()),E}function L4(){for(;ct!==null;)Ik(ct)}function B4(r,o){var c=gt;gt|=2;var d=zk(),v=Mk();At!==r||dt!==o?(vf=null,gf=_t()+500,nc(r,o)):Yl=lu(r,o);e:do try{if(wt!==0&&ct!==null){o=ct;var y=Wi;t:switch(wt){case 1:wt=0,Wi=null,ic(r,o,y,1);break;case 2:case 9:if(Pw(y)){wt=0,Wi=null,Pk(o);break}o=function(){wt!==2&&wt!==9||At!==r||(wt=7),rs(r)},y.then(o,o);break e;case 3:wt=7;break e;case 4:wt=5;break e;case 7:Pw(y)?(wt=0,Wi=null,Pk(o)):(wt=0,Wi=null,ic(r,o,y,7));break;case 5:var E=null;switch(ct.tag){case 26:E=ct.memoizedState;case 5:case 27:var O=ct;if(E?RE(E):O.stateNode.complete){wt=0,Wi=null;var H=O.sibling;if(H!==null)ct=H;else{var Q=O.return;Q!==null?(ct=Q,xf(Q)):ct=null}break t}}wt=0,Wi=null,ic(r,o,y,5);break;case 6:wt=0,Wi=null,ic(r,o,y,6);break;case 8:ey(),tn=6;break e;default:throw Error(i(462))}}F4();break}catch(oe){Ok(r,oe)}while(!0);return Fs=Ra=null,re.H=d,re.A=v,gt=c,ct!==null?0:(At=null,dt=0,Eh(),tn)}function F4(){for(;ct!==null&&!Ei();)Ik(ct)}function Ik(r){var o=QC(r.alternate,r,Ks);r.memoizedProps=r.pendingProps,o===null?xf(r):ct=o}function Pk(r){var o=r,c=o.alternate;switch(o.tag){case 15:case 0:o=WC(c,o,o.pendingProps,o.type,void 0,dt);break;case 11:o=WC(c,o,o.pendingProps,o.type.render,o.ref,dt);break;case 5:lv(o);var d=o;d===Pn&&(nt?(Oh(d),d.tag===5&&d.stateNode!=null&&(zt=d.stateNode)):(Oh(d),nt=!0));default:ek(c,o),o=ct=Ew(o,Ks),o=QC(c,o,Ks)}r.memoizedProps=r.pendingProps,o===null?xf(r):ct=o}function ic(r,o,c,d){Fs=Ra=null,lv(o),Hl=null,Eu=0;var v=o.return;try{if(N4(r,v,o,c,dt)){tn=1,Qh(r,dr(c,r.current)),ct=null;return}}catch(y){if(v!==null)throw ct=v,y;tn=1,Qh(r,dr(c,r.current)),ct=null;return}o.flags&32768?(nt||d===1?r=!0:Yl||(dt&536870912)!==0?r=!1:(jo=r=!0,(d===2||d===9||d===3||d===6)&&(d=Zn.current,d!==null&&d.tag===13&&(d.flags|=16384))),Lk(o,r)):xf(o)}function xf(r){var o=r;do{if((o.flags&32768)!==0){Lk(o,jo);return}r=o.return;var c=A4(o.alternate,o,Ks);if(c!==null){ct=c;return}if(o=o.sibling,o!==null){ct=o;return}ct=o=r}while(o!==null);tn===0&&(tn=5)}function Lk(r,o){do{var c=O4(r.alternate,r);if(c!==null){c.flags&=32767,ct=c;return}if(c=r.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!o&&(r=r.sibling,r!==null)){ct=r;return}ct=r=c}while(r!==null);tn=6,ct=null}function Bk(r,o,c,d,v,y,E,O,H,Q,oe,ue){r.cancelPendingCommit=null;do Sf();while(Zt!==0);if((gt&6)!==0)throw Error(i(327));if(o!==null){if(o===r.current)throw Error(i(177));r===At&&(ct=At=null,dt=0),Ua=o,Mr=r,is=c,Jv=v,Rk=d,U4(r,o,c,E,O,H,ue)}}function U4(r,o,c,d,v,y,E){var O=o.lanes|o.childLanes;if(Qv=O,O|=Ig,fP(r,c,O,d,v,y),Jl=null,(c&335544064)===c?(ec=m4(r),d=10262):(ec=null,d=10256),(o.subtreeFlags&d)!==0||(o.flags&d)!==0?(r.callbackNode=null,r.callbackPriority=0,V4(ch,function(){return sy(),null})):(r.callbackNode=null,r.callbackPriority=0),af=!1,d=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||d){d=re.T,re.T=null,v=he.p,he.p=2,y=gt,gt|=4;try{j4(r,o,c)}finally{gt=y,he.p=v,re.T=d}}Zt=1,af?Ql=fL(E,r.containerInfo,ec,ny,iy,$4,ry,sy,H4):(ny(),iy(),ry())}function H4(r){if(Zt!==0){var o=Mr.onRecoverableError;o(r,{componentStack:null})}}function $4(){Zt===3&&(Zt=0,xk(Ua,Mr),Zt=4)}function ny(){if(Zt===1){Zt=0;var r=Mr,o=Ua,c=is,d=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||d){d=re.T,re.T=null;var v=he.p;he.p=2;var y=gt;gt|=4;try{Lu=uf=!1,_k(o,r,c),c=vy;var E=gw(r.containerInfo),O=c.focusedElem,H=c.selectionRange;if(E!==O&&O&&O.ownerDocument&&mw(O.ownerDocument.documentElement,O)){if(H!==null&&Ag(O)){var Q=H.start,oe=H.end;if(oe===void 0&&(oe=Q),"selectionStart"in O)O.selectionStart=Q,O.selectionEnd=Math.min(oe,O.value.length);else{var ue=O.ownerDocument||document,Y=ue&&ue.defaultView||window;if(Y.getSelection){var se=Y.getSelection(),xe=O.textContent.length,je=Math.min(H.start,xe),Qe=H.end===void 0?je:Math.min(H.end,xe);!se.extend&&je>Qe&&(E=Qe,Qe=je,je=E);var X=pw(O,je),q=pw(O,Qe);if(X&&q&&(se.rangeCount!==1||se.anchorNode!==X.node||se.anchorOffset!==X.offset||se.focusNode!==q.node||se.focusOffset!==q.offset)){var ie=ue.createRange();ie.setStart(X.node,X.offset),se.removeAllRanges(),je>Qe?(se.addRange(ie),se.extend(q.node,q.offset)):(ie.setEnd(q.node,q.offset),se.addRange(ie))}}}}for(ue=[],se=O;se=se.parentNode;)se.nodeType===1&&ue.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<ue.length;O++){var ce=ue[O];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}dc=!!gy,vy=gy=null}finally{gt=y,he.p=v,re.T=d}}r.current=o,Zt=2}}function iy(){if(Zt===2){Zt=0;var r=Mr,o=Ua,c=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||c){c=re.T,re.T=null;var d=he.p;he.p=2;var v=gt;gt|=4;try{fk(r,o.alternate,o)}finally{gt=v,he.p=d,re.T=c}}Zt=3}}function ry(){if(Zt===4||Zt===3){Zt=0;var r=Ql;Ql=null,Vr();var o=Mr,c=Ua,d=is,v=Rk,y=(d&335544064)===d?10262:10256;if((c.subtreeFlags&y)!==0||(c.flags&y)!==0?Zt=5:(Zt=0,Ua=Mr=null,Fk(o,o.pendingLanes)),y=o.pendingLanes,y===0&&(Mo=null),fg(d),c=c.stateNode,Bi&&typeof Bi.onCommitFiberRoot=="function")try{Bi.onCommitFiberRoot(au,c,void 0,(c.current.flags&128)===128)}catch{}if(v!==null){c=re.T,y=he.p,he.p=2,re.T=null;try{for(var E=o.onRecoverableError,O=0;O<v.length;O++){var H=v[O];E(H.value,{componentStack:H.stack})}}finally{re.T=c,he.p=y}}if(v=Jl,E=ec,ec=null,v!==null&&(Jl=null,E===null&&(E=[]),r!==null))for(H=0;H<v.length;H++)c=(0,v[H])(E),c!==void 0&&r.finished.finally(c);(is&3)!==0&&Sf(),rs(o),y=o.pendingLanes,(d&261930)!==0&&(y&42)!==0?o===yf?Hu++:(Hu=0,yf=o):(Hu=0,yf=null),$u(0)}}function Fk(r,o){(r.pooledCacheLanes&=o)===0&&(o=r.pooledCache,o!=null&&(r.pooledCache=null,wu(o)))}function Sf(){return Ql!==null&&(Ql.skipTransition(),Ql=null),ny(),iy(),ry(),sy()}function sy(){if(Zt!==5)return!1;var r=Mr,o=Qv;Qv=0;var c=fg(is),d=re.T,v=he.p;try{he.p=32>c?32:c,re.T=null,c=Jv,Jv=null;var y=Mr,E=is;if(Zt=0,Ua=Mr=null,is=0,(gt&6)!==0)throw Error(i(331));var O=gt;if(gt|=4,kk(y.current),Sk(y,y.current,E,c),gt=O,$u(0,!1),Bi&&typeof Bi.onPostCommitFiberRoot=="function")try{Bi.onPostCommitFiberRoot(au,y)}catch{}return!0}finally{he.p=v,re.T=d,Fk(r,o)}}function Uk(r,o,c){o=dr(c,o),o=Sv(r.stateNode,o,2),r=No(r,o,2),r!==null&&(cu(r,2),rs(r))}function Ct(r,o,c){if(r.tag===3)Uk(r,r,c);else for(;o!==null;){if(o.tag===3){Uk(o,r,c);break}else if(o.tag===1){var d=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(Mo===null||!Mo.has(d))){r=dr(c,r),c=PC(2),d=No(o,c,2),d!==null&&(LC(c,d,o,r),cu(d,2),rs(d));break}}o=o.return}}function oy(r,o,c){var d=r.pingCache;if(d===null){d=r.pingCache=new I4;var v=new Set;d.set(o,v)}else v=d.get(o),v===void 0&&(v=new Set,d.set(o,v));v.has(c)||(Yv=!0,v.add(c),r=q4.bind(null,r,o,c),o.then(r,r))}function q4(r,o,c){var d=r.pingCache;d!==null&&d.delete(o),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,At===r&&(dt&c)===c&&((tn===4||tn===3&&(dt&62914560)===dt&&300>_t()-mf)&&(gt&2)===0?nc(r,0):pf|=c,Xl===dt&&(Xl=0)),rs(r)}function Hk(r,o){o===0&&(o=NS()),r=ka(r,o),r!==null&&(cu(r,o),rs(r))}function W4(r){var o=r.memoizedState,c=0;o!==null&&(c=o.retryLane),Hk(r,c)}function K4(r,o){var c=0;switch(r.tag){case 31:case 13:var d=r.stateNode,v=r.memoizedState;v!==null&&(c=v.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(i(314))}d!==null&&d.delete(o),Hk(r,c)}function V4(r,o){return kn(r,o)}var rc=null,sc=null,ay=!1,wf=!1,ly=!1,Po=0;function rs(r){r!==sc&&r.next===null&&(sc===null?rc=sc=r:sc=sc.next=r),wf=!0,ay||(ay=!0,Z4())}function $u(r,o){if(!ly&&wf){ly=!0;do for(var c=!1,d=rc;d!==null;){if(r!==0){var v=d.pendingLanes;if(v===0)var y=0;else{var E=d.suspendedLanes,O=d.pingedLanes;y=(1<<31-Fi(42|r)+1)-1,y&=v&~(E&~O),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(c=!0,Kk(d,y))}else y=dt,y=fh(d,d===At?y:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(y&3)===0||lu(d,y)||(c=!0,Kk(d,y));d=d.next}while(c);ly=!1}}function G4(){$k()}function $k(){wf=ay=!1;var r=0;Po!==0&&oL()&&(r=Po);for(var o=_t(),c=null,d=rc;d!==null;){var v=d.next,y=qk(d,o);y===0?(d.next=null,c===null?rc=v:c.next=v,v===null&&(sc=c)):(c=d,(r!==0||(y&3)!==0)&&(wf=!0)),d=v}Zt!==0&&Zt!==5||$u(r),Po!==0&&(Po=0)}function qk(r,o){for(var c=r.suspendedLanes,d=r.pingedLanes,v=r.expirationTimes,y=r.pendingLanes&-62914561;0<y;){var E=31-Fi(y),O=1<<E,H=v[E];H===-1?((O&c)===0||(O&d)!==0)&&(v[E]=hP(O,o)):H<=o&&(r.expiredLanes|=O),y&=~O}if(o=At,c=dt,c=fh(r,r===o?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,c===0||r===o&&(wt===2||wt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&hn(d),r.callbackNode=null,r.callbackPriority=0;if((c&3)===0||lu(r,c)){if(o=c&-c,o===r.callbackPriority)return o;switch(d!==null&&hn(d),fg(c)){case 2:case 8:c=lr;break;case 32:c=ch;break;case 268435456:c=kS;break;default:c=ch}return d=Wk.bind(null,r),c=kn(c,d),r.callbackPriority=o,r.callbackNode=c,o}return d!==null&&d!==null&&hn(d),r.callbackPriority=2,r.callbackNode=null,2}function Wk(r,o){if(Zt!==0&&Zt!==5)return r.callbackNode=null,r.callbackPriority=0,null;var c=r.callbackNode;if(Sf()&&r.callbackNode!==c)return null;var d=dt;return d=fh(r,r===At?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(Dk(r,d,o),qk(r,_t()),r.callbackNode!=null&&r.callbackNode===c?Wk.bind(null,r):null)}function Kk(r,o){if(Sf())return null;Dk(r,o,!0)}function Z4(){lL(function(){(gt&6)!==0?kn(Os,G4):$k()})}function cy(){if(Po===0){var r=Aa;r===0&&(r=uh,uh<<=1,(uh&261888)===0&&(uh=256)),Po=r}return Po}function Vk(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:yh(r)}function Y4(r,o,c,d,v){if(o==="submit"&&c&&c.stateNode===v){var y=Vk((v[Ni]||null).action),E=d.submitter;E&&(o=(o=E[Ni]||null)?Vk(o.formAction):E.getAttribute("formAction"),o!==null&&(y=o,E=null));var O=new Sh("action","action",null,d,v);r.push({event:O,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Po!==0){var H=new FormData(v,E);vv(c,{pending:!0,data:H,method:v.method,action:y},null,H)}}else typeof y=="function"&&(O.preventDefault(),H=new FormData(v,E),vv(c,{pending:!0,data:H,method:v.method,action:y},y,H))},currentTarget:v}]})}}for(var uy=0;uy<Mg.length;uy++){var dy=Mg[uy],X4=dy.toLowerCase(),Q4=dy[0].toUpperCase()+dy.slice(1);Ar(X4,"on"+Q4)}Ar(_w,"onAnimationEnd"),Ar(bw,"onAnimationIteration"),Ar(xw,"onAnimationStart"),Ar("dblclick","onDoubleClick"),Ar("focusin","onFocus"),Ar("focusout","onBlur"),Ar(a4,"onTransitionRun"),Ar(l4,"onTransitionStart"),Ar(c4,"onTransitionCancel"),Ar(Sw,"onTransitionEnd"),Nl("onMouseEnter",["mouseout","mouseover"]),Nl("onMouseLeave",["mouseout","mouseover"]),Nl("onPointerEnter",["pointerout","pointerover"]),Nl("onPointerLeave",["pointerout","pointerover"]),Sa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Sa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Sa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Sa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var qu="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(" "),J4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(qu));function Gk(r,o){o=(o&4)!==0;for(var c=0;c<r.length;c++){var d=r[c],v=d.event;d=d.listeners;e:{var y=void 0;if(o)for(var E=d.length-1;0<=E;E--){var O=d[E],H=O.instance,Q=O.currentTarget;if(O=O.listener,H!==y&&v.isPropagationStopped())break e;y=O,v.currentTarget=Q;try{y(v)}catch(oe){kh(oe)}v.currentTarget=null,y=H}else for(E=0;E<d.length;E++){if(O=d[E],H=O.instance,Q=O.currentTarget,O=O.listener,H!==y&&v.isPropagationStopped())break e;y=O,v.currentTarget=Q;try{y(v)}catch(oe){kh(oe)}v.currentTarget=null,y=H}}}}function ut(r,o){var c=o[jS];c===void 0&&(c=o[jS]=new Set);var d=r+"__bubble";c.has(d)||(Zk(o,r,2,!1),c.add(d))}function hy(r,o,c){var d=0;o&&(d|=4),Zk(c,r,d,o)}var Cf="_reactListening"+Math.random().toString(36).slice(2);function fy(r){if(!r[Cf]){r[Cf]=!0,IS.forEach(function(c){c!=="selectionchange"&&(J4.has(c)||hy(c,!1,r),hy(c,!0,r))});var o=r.nodeType===9?r:r.ownerDocument;o===null||o[Cf]||(o[Cf]=!0,hy("selectionchange",!1,o))}}function Zk(r,o,c,d){switch(LE(o)){case 2:var v=WL;break;case 8:v=KL;break;default:v=jy}c=v.bind(null,o,c,r),v=void 0,!xg||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(v=!0),d?v!==void 0?r.addEventListener(o,c,{capture:!0,passive:v}):r.addEventListener(o,c,!0):v!==void 0?r.addEventListener(o,c,{passive:v}):r.addEventListener(o,c,!1)}function py(r,o,c,d,v){var y=d;if((o&1)===0&&(o&2)===0&&d!==null)e:for(;;){if(d===null)return;var E=d.tag;if(E===3||E===4){var O=d.stateNode.containerInfo;if(O===v)break;if(E===4)for(E=d.return;E!==null;){var H=E.tag;if((H===3||H===4)&&E.stateNode.containerInfo===v)return;E=E.return}for(;O!==null;){if(E=xa(O),E===null)return;if(H=E.tag,H===5||H===6||H===26||H===27){d=y=E;continue e}O=O.parentNode}}d=d.return}ZS(function(){var Q=y,oe=_g(c),ue=[];e:{var Y=ww.get(r);if(Y!==void 0){var se=Sh,xe=r;switch(r){case"keypress":if(bh(c)===0)break e;case"keydown":case"keyup":se=PP;break;case"focusin":xe="focus",se=kg;break;case"focusout":xe="blur",se=kg;break;case"beforeblur":case"afterblur":se=kg;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=QS;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=kP;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=HP;break;case _w:case bw:case xw:se=RP;break;case Sw:se=qP;break;case"scroll":case"scrollend":se=wP;break;case"wheel":se=KP;break;case"copy":case"cut":case"paste":se=DP;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=ew;break;case"submit":se=FP;break;case"toggle":case"beforetoggle":se=GP}var je=(o&4)!==0,Qe=!je&&(r==="scroll"||r==="scrollend"),X=je?Y!==null?Y+"Capture":null:Y;je=[];for(var q=Q,ie;q!==null;){var ce=q;if(ie=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||ie===null||X===null||(ce=hu(q,X),ce!=null&&je.push(Wu(q,ce,ie))),Qe)break;q=q.return}0<je.length&&(Y=new se(Y,xe,null,c,oe),ue.push({event:Y,listeners:je}))}}if((o&7)===0){e:{if(se=r==="mouseover"||r==="pointerover",Y=r==="mouseout"||r==="pointerout",se&&c!==yg&&(xe=c.relatedTarget||c.fromElement)&&(xa(xe)||xe[Cl]))break e;(Y||se)&&(xe=oe.window===oe?oe:(se=oe.ownerDocument)?se.defaultView||se.parentWindow:window,Y?(se=c.relatedTarget||c.toElement,Y=Q,se=se?xa(se):null,se!==null&&(Qe=a(se),je=se.tag,se!==Qe||je!==5&&je!==27&&je!==6)&&(se=null)):(Y=null,se=Q),Y!==se&&(je=QS,ce="onMouseLeave",X="onMouseEnter",q="mouse",(r==="pointerout"||r==="pointerover")&&(je=ew,ce="onPointerLeave",X="onPointerEnter",q="pointer"),Qe=Y==null?xe:du(Y),ie=se==null?xe:du(se),xe=new je(ce,q+"leave",Y,c,oe),xe.target=Qe,xe.relatedTarget=ie,ce=null,xa(oe)===Q&&(je=new je(X,q+"enter",se,c,oe),je.target=ie,je.relatedTarget=Qe,ce=je),Qe=ce,je=Y&&se?T(Y,se,eL):null,Y!==null&&Yk(ue,xe,Y,je,!1),se!==null&&Qe!==null&&Yk(ue,Qe,se,je,!0)))}e:{if(Y=Q?du(Q):window,se=Y.nodeName&&Y.nodeName.toLowerCase(),se==="select"||se==="input"&&Y.type==="file")var Ne=lw;else if(ow(Y))if(cw)Ne=r4;else{Ne=n4;var ht=t4}else se=Y.nodeName,!se||se.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?Q&&vg(Q.elementType)&&(Ne=lw):Ne=i4;if(Ne&&(Ne=Ne(r,Q))){aw(ue,Ne,c,oe);break e}ht&&ht(r,Y,Q)}switch(ht=Q?du(Q):window,r){case"focusin":(ow(ht)||ht.contentEditable==="true")&&(jl=ht,Og=Q,bu=null);break;case"focusout":bu=Og=jl=null;break;case"mousedown":jg=!0;break;case"contextmenu":case"mouseup":case"dragend":jg=!1,vw(ue,c,oe);break;case"selectionchange":if(o4)break;case"keydown":case"keyup":vw(ue,c,oe)}var Me;if(Ng)e:{switch(r){case"compositionstart":var Ue="onCompositionStart";break e;case"compositionend":Ue="onCompositionEnd";break e;case"compositionupdate":Ue="onCompositionUpdate";break e}Ue=void 0}else Ol?rw(r,c)&&(Ue="onCompositionEnd"):r==="keydown"&&c.keyCode===229&&(Ue="onCompositionStart");Ue&&(tw&&c.locale!=="ko"&&(Ol||Ue!=="onCompositionStart"?Ue==="onCompositionEnd"&&Ol&&(Me=YS()):(yo=oe,Sg="value"in yo?yo.value:yo.textContent,Ol=!0)),ht=kf(Q,Ue),0<ht.length&&(Ue=new JS(Ue,r,null,c,oe),ue.push({event:Ue,listeners:ht}),Me?Ue.data=Me:(Me=sw(c),Me!==null&&(Ue.data=Me)))),(Me=YP?XP(r,c):QP(r,c))&&(Ue=kf(Q,"onBeforeInput"),0<Ue.length&&(ht=new JS("onBeforeInput","beforeinput",null,c,oe),ue.push({event:ht,listeners:Ue}),ht.data=Me)),Y4(ue,r,Q,c,oe)}Gk(ue,o)})}function Wu(r,o,c){return{instance:r,listener:o,currentTarget:c}}function kf(r,o){for(var c=o+"Capture",d=[];r!==null;){var v=r,y=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||y===null||(v=hu(r,c),v!=null&&d.unshift(Wu(r,v,y)),v=hu(r,o),v!=null&&d.push(Wu(r,v,y))),r.tag===3)return d;r=r.return}return[]}function eL(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function Yk(r,o,c,d,v){for(var y=o._reactName,E=[];c!==null&&c!==d;){var O=c,H=O.alternate,Q=O.stateNode;if(O=O.tag,H!==null&&H===d)break;O!==5&&O!==26&&O!==27||Q===null||(H=Q,v?(Q=hu(c,y),Q!=null&&E.unshift(Wu(c,Q,H))):v||(Q=hu(c,y),Q!=null&&E.push(Wu(c,Q,H)))),c=c.return}E.length!==0&&r.push({event:o,listeners:E})}var tL=/\r\n?/g,nL=/\u0000|\uFFFD/g;function Xk(r){return(typeof r=="string"?r:""+r).replace(tL,`
50
- `).replace(nL,"")}function Qk(r,o){return o=Xk(o),Xk(r)===o}function kt(r,o,c,d,v,y){switch(c){case"children":if(typeof d=="string")o==="body"||o==="textarea"&&d===""||Tl(r,d);else if(typeof d=="number"||typeof d=="bigint")o!=="body"&&Tl(r,""+d);else return;break;case"className":vh(r,"class",d);break;case"tabIndex":vh(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":vh(r,c,d);break;case"style":VS(r,d,y);return;case"data":if(o!=="object"){vh(r,"data",d);break}case"src":case"href":if(d===""&&(o!=="a"||c!=="href")){r.removeAttribute(c);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=yh(d),r.setAttribute(c,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(c,"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 y=="function"&&(c==="formAction"?(o!=="input"&&kt(r,o,"name",v.name,v,null),kt(r,o,"formEncType",v.formEncType,v,null),kt(r,o,"formMethod",v.formMethod,v,null),kt(r,o,"formTarget",v.formTarget,v,null)):(kt(r,o,"encType",v.encType,v,null),kt(r,o,"method",v.method,v,null),kt(r,o,"target",v.target,v,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(c);break}d=yh(d),r.setAttribute(c,d);break;case"onClick":d!=null&&(r.onclick=Gr);return;case"onScroll":d!=null&&ut("scroll",r);return;case"onScrollEnd":d!=null&&ut("scrollend",r);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(v.children!=null)throw Error(i(60));y?.__html!==c&&(r.innerHTML=c)}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}c=yh(d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,d):r.removeAttribute(c);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,""):r.removeAttribute(c);break;case"capture":case"download":d===!0?r.setAttribute(c,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(c,d):r.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(c,d):r.removeAttribute(c);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(c):r.setAttribute(c,d);break;case"popover":ut("beforetoggle",r),ut("toggle",r),gh(r,"popover",d);break;case"xlinkActuate":zs(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":zs(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":zs(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":zs(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":zs(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":zs(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":zs(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":zs(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":zs(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":gh(r,"is",d);break;case"innerText":case"textContent":return;default:if(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")c=xP.get(c)||c,gh(r,c,d);else return}pt=!0}function my(r,o,c,d,v,y){switch(c){case"style":VS(r,d,y);return;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(i(61));if(c=d.__html,c!=null){if(v.children!=null)throw Error(i(60));y?.__html!==c&&(r.innerHTML=c)}}break;case"children":if(typeof d=="string")Tl(r,d);else if(typeof d=="number"||typeof d=="bigint")Tl(r,""+d);else return;break;case"onScroll":d!=null&&ut("scroll",r);return;case"onScrollEnd":d!=null&&ut("scrollend",r);return;case"onClick":d!=null&&(r.onclick=Gr);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!PS.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(v=c.endsWith("Capture"),y=c.slice(2,v?c.length-7:void 0),o=r[Ni]||null,o=o!=null?o[c]:null,typeof o=="function"&&r.removeEventListener(y,o,v),typeof d=="function")){typeof o!="function"&&o!==null&&(c in r?r[c]=null:r.hasAttribute(c)&&r.removeAttribute(c)),r.addEventListener(y,d,v);break e}pt=!0,c in r?r[c]=d:d===!0?r.setAttribute(c,""):gh(r,c,d)}return}pt=!0}function Qn(r,o,c){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ut("error",r),ut("load",r);var d=!1,v=!1,y;for(y in c)if(c.hasOwnProperty(y)){var E=c[y];if(E!=null)switch(y){case"src":d=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,o));default:kt(r,o,y,E,c,null)}}v&&kt(r,o,"srcSet",c.srcSet,c,null),d&&kt(r,o,"src",c.src,c,null);return;case"input":ut("invalid",r);var O=y=E=v=null,H=null,Q=null;for(d in c)if(c.hasOwnProperty(d)){var oe=c[d];if(oe!=null)switch(d){case"name":v=oe;break;case"type":E=oe;break;case"checked":H=oe;break;case"defaultChecked":Q=oe;break;case"value":y=oe;break;case"defaultValue":O=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,o));break;default:kt(r,o,d,oe,c,null)}}$S(r,y,O,H,Q,E,v,!1);return;case"select":ut("invalid",r),d=E=y=null;for(v in c)if(c.hasOwnProperty(v)&&(O=c[v],O!=null))switch(v){case"value":y=O;break;case"defaultValue":E=O;break;case"multiple":d=O;default:kt(r,o,v,O,c,null)}o=y,c=E,r.multiple=!!d,o!=null?Rl(r,!!d,o,!1):c!=null&&Rl(r,!!d,c,!0);return;case"textarea":ut("invalid",r),y=v=d=null;for(E in c)if(c.hasOwnProperty(E)&&(O=c[E],O!=null))switch(E){case"value":d=O;break;case"defaultValue":v=O;break;case"children":y=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(i(91));break;default:kt(r,o,E,O,c,null)}WS(r,d,v,y);return;case"option":for(H in c)c.hasOwnProperty(H)&&(d=c[H],d!=null)&&(H==="selected"?r.selected=d&&typeof d!="function"&&typeof d!="symbol":kt(r,o,H,d,c,null));return;case"dialog":ut("beforetoggle",r),ut("toggle",r),ut("cancel",r),ut("close",r);break;case"iframe":case"object":ut("load",r);break;case"video":case"audio":for(d=0;d<qu.length;d++)ut(qu[d],r);break;case"image":ut("error",r),ut("load",r);break;case"details":ut("toggle",r);break;case"embed":case"source":case"link":ut("error",r),ut("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Q in c)if(c.hasOwnProperty(Q)&&(d=c[Q],d!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,o));default:kt(r,o,Q,d,c,null)}return;default:if(vg(o)){for(oe in c)c.hasOwnProperty(oe)&&(d=c[oe],d!==void 0&&my(r,o,oe,d,c,void 0));return}}for(O in c)c.hasOwnProperty(O)&&(d=c[O],d!=null&&kt(r,o,O,d,c,null))}var iL={};function rL(r,o,c,d){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,y=null,E=null,O=null,H=null,Q=null,oe=null;for(se in c){var ue=c[se];if(c.hasOwnProperty(se)&&ue!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":H=ue;default:d.hasOwnProperty(se)||kt(r,o,se,null,d,ue)}}for(var Y in d){var se=d[Y];if(ue=c[Y],d.hasOwnProperty(Y)&&(se!=null||ue!=null))switch(Y){case"type":se!==ue&&(pt=!0),y=se;break;case"name":se!==ue&&(pt=!0),v=se;break;case"checked":se!==ue&&(pt=!0),Q=se;break;case"defaultChecked":se!==ue&&(pt=!0),oe=se;break;case"value":se!==ue&&(pt=!0),E=se;break;case"defaultValue":se!==ue&&(pt=!0),O=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(i(137,o));break;default:se!==ue&&kt(r,o,Y,se,d,ue)}}mg(r,E,O,H,Q,oe,y,v);return;case"select":se=E=O=Y=null;for(y in c)if(H=c[y],c.hasOwnProperty(y)&&H!=null)switch(y){case"value":break;case"multiple":se=H;default:d.hasOwnProperty(y)||kt(r,o,y,null,d,H)}for(v in d)if(y=d[v],H=c[v],d.hasOwnProperty(v)&&(y!=null||H!=null))switch(v){case"value":y!==H&&(pt=!0),Y=y;break;case"defaultValue":y!==H&&(pt=!0),O=y;break;case"multiple":y!==H&&(pt=!0),E=y;default:y!==H&&kt(r,o,v,y,d,H)}o=O,c=E,d=se,Y!=null?Rl(r,!!c,Y,!1):!!d!=!!c&&(o!=null?Rl(r,!!c,o,!0):Rl(r,!!c,c?[]:"",!1));return;case"textarea":se=Y=null;for(O in c)if(v=c[O],c.hasOwnProperty(O)&&v!=null&&!d.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:kt(r,o,O,null,d,v)}for(E in d)if(v=d[E],y=c[E],d.hasOwnProperty(E)&&(v!=null||y!=null))switch(E){case"value":v!==y&&(pt=!0),Y=v;break;case"defaultValue":v!==y&&(pt=!0),se=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(i(91));break;default:v!==y&&kt(r,o,E,v,d,y)}qS(r,Y,se);return;case"option":for(var xe in c)Y=c[xe],c.hasOwnProperty(xe)&&Y!=null&&!d.hasOwnProperty(xe)&&(xe==="selected"?r.selected=!1:kt(r,o,xe,null,d,Y));for(H in d)Y=d[H],se=c[H],d.hasOwnProperty(H)&&Y!==se&&(Y!=null||se!=null)&&(H==="selected"?(Y!==se&&(pt=!0),r.selected=Y&&typeof Y!="function"&&typeof Y!="symbol"):kt(r,o,H,Y,d,se));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 je in c)Y=c[je],c.hasOwnProperty(je)&&Y!=null&&!d.hasOwnProperty(je)&&kt(r,o,je,null,d,Y);for(Q in d)if(Y=d[Q],se=c[Q],d.hasOwnProperty(Q)&&Y!==se&&(Y!=null||se!=null))switch(Q){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(i(137,o));break;default:kt(r,o,Q,Y,d,se)}return;default:if(vg(o)){for(var Qe in c)Y=c[Qe],c.hasOwnProperty(Qe)&&Y!==void 0&&!d.hasOwnProperty(Qe)&&my(r,o,Qe,void 0,d,Y);for(oe in d)Y=d[oe],se=c[oe],!d.hasOwnProperty(oe)||Y===se||Y===void 0&&se===void 0||my(r,o,oe,Y,d,se);return}}for(var X in c)Y=c[X],c.hasOwnProperty(X)&&Y!=null&&!d.hasOwnProperty(X)&&kt(r,o,X,null,d,Y);for(ue in d)Y=d[ue],se=c[ue],!d.hasOwnProperty(ue)||Y===se||Y==null&&se==null||kt(r,o,ue,Y,d,se)}function Jk(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function sL(){if(typeof performance.getEntriesByType=="function"){for(var r=0,o=0,c=performance.getEntriesByType("resource"),d=0;d<c.length;d++){var v=c[d],y=v.transferSize,E=v.initiatorType,O=v.duration;if(y&&O&&Jk(E)){for(E=0,O=v.responseEnd,d+=1;d<c.length;d++){var H=c[d],Q=H.startTime;if(Q>O)break;var oe=H.transferSize,ue=H.initiatorType;oe&&Jk(ue)&&(H=H.responseEnd,E+=oe*(H<O?1:(O-Q)/(H-Q)))}if(--d,o+=8*(y+E)/(v.duration/1e3),r++,10<r)break}}if(0<r)return o/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var gy=null,vy=null;function Ku(r){return r.nodeType===9?r:r.ownerDocument}function eE(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function tE(r,o){if(r===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&o==="foreignObject"?0:r}function nE(r,o,c,d){return c=Ku(c).createElement(r),c[Vn]=d,c[Ni]=o,Qn(c,r,o),In(c),c}function yy(r,o){return r==="textarea"||r==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.children=="bigint"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var _y=null;function oL(){var r=window.event;return r&&r.type==="popstate"?r===_y?!1:(_y=r,!0):(_y=null,!1)}var by=typeof setTimeout=="function"?setTimeout:void 0,aL=typeof clearTimeout=="function"?clearTimeout:void 0,iE=typeof Promise=="function"?Promise:void 0,rE=typeof requestAnimationFrame=="function"?requestAnimationFrame:by,lL=typeof queueMicrotask=="function"?queueMicrotask:typeof iE<"u"?function(r){return iE.resolve(null).then(r).catch(cL)}:by;function cL(r){setTimeout(function(){throw r})}function Lo(r){return r==="head"}function sE(r,o){var c=o,d=0;do{var v=c.nextSibling;if(r.removeChild(c),v&&v.nodeType===8)if(c=v.data,c==="/$"||c==="/&"){if(d===0){r.removeChild(v),hc(o);return}d--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")d++;else if(c==="html")Ry(r.ownerDocument.documentElement);else if(c==="head"){c=r.ownerDocument.head,Ry(c);for(var y=c.firstChild;y;){var E=y.nextSibling,O=y.nodeName;y[uu]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&y.rel.toLowerCase()==="stylesheet"||c.removeChild(y),y=E}}else c==="body"&&Ry(r.ownerDocument.body);c=v}while(c);hc(o)}function oE(r,o){var c=r;r=0;do{var d=c.nextSibling;if(c.nodeType===1?o?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(o?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),d&&d.nodeType===8)if(c=d.data,c==="/$"){if(r===0)break;r--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||r++;c=d}while(c)}function aE(r,o,c){if(o=CSS.escape(o)!==o?"r-"+btoa(o).replace(/=/g,""):o,r.style.viewTransitionName=o,c!=null&&(r.style.viewTransitionClass=c),c=getComputedStyle(r),c.display==="inline"){if(o=r.getClientRects(),o.length===1)var d=1;else for(var v=d=0;v<o.length;v++){var y=o[v];0<y.width&&0<y.height&&d++}d===1&&(r=r.style,r.display=o.length===1?"inline-block":"block",r.marginTop="-"+c.paddingTop,r.marginBottom="-"+c.paddingBottom)}}function lE(r,o){r=r.style,o=o.style;var c=o!=null?o.hasOwnProperty("viewTransitionName")?o.viewTransitionName:o.hasOwnProperty("view-transition-name")?o["view-transition-name"]:null:null;r.viewTransitionName=c==null||typeof c=="boolean"?"":(""+c).trim(),c=o!=null?o.hasOwnProperty("viewTransitionClass")?o.viewTransitionClass:o.hasOwnProperty("view-transition-class")?o["view-transition-class"]:null:null,r.viewTransitionClass=c==null||typeof c=="boolean"?"":(""+c).trim(),r.display==="inline-block"&&(o==null?r.display=r.margin="":(c=o.display,r.display=c==null||typeof c=="boolean"?"":c,c=o.margin,c!=null?r.margin=c:(c=o.hasOwnProperty("marginTop")?o.marginTop:o["margin-top"],r.marginTop=c==null||typeof c=="boolean"?"":c,o=o.hasOwnProperty("marginBottom")?o.marginBottom:o["margin-bottom"],r.marginBottom=o==null||typeof o=="boolean"?"":o)))}function uL(r,o,c){return c=c.ownerDocument.defaultView,{rect:r,abs:o.position==="absolute"||o.position==="fixed",clip:o.clipPath!=="none"||o.overflow!=="visible"||o.filter!=="none"||o.mask!=="none"||o.mask!=="none"||o.borderRadius!=="0px",view:0<=r.bottom&&0<=r.right&&r.top<=c.innerHeight&&r.left<=c.innerWidth}}function xy(r){var o=r.getBoundingClientRect(),c=getComputedStyle(r);return uL(o,c,r)}function dL(r){return r.documentElement.clientHeight}function hL(r){this.addEventListener("load",r),this.addEventListener("error",r)}function fL(r,o,c,d,v,y,E,O,H){var Q=o.nodeType===9?o:o.ownerDocument;try{var oe=Q.startViewTransition({update:function(){var Y=Q.defaultView,se=Y.navigation&&Y.navigation.transition,xe=Q.fonts.status;d();var je=[];if(xe==="loaded"&&(dL(Q),Q.fonts.status==="loading"&&je.push(Q.fonts.ready)),xe=je.length,r!==null)for(var Qe=r.suspenseyImages,X=0,q=0;q<Qe.length;q++){var ie=Qe[q];if(!ie.complete){var ce=ie.getBoundingClientRect();if(0<ce.bottom&&0<ce.right&&ce.top<Y.innerHeight&&ce.left<Y.innerWidth){if(X+=TE(ie),X>Rf){je.length=xe;break}ie=new Promise(hL.bind(ie)),je.push(ie)}}}if(0<je.length)return Y=Promise.race([Promise.all(je),new Promise(function(Ne){return setTimeout(Ne,500)})]).then(v,v),(se?Promise.allSettled([se.finished,Y]):Y).then(y,y);if(v(),se)return se.finished.then(y,y);y()},types:c});Q.__reactViewTransition=oe;var ue=[];return oe.ready.then(function(){for(var Y=Q.documentElement.getAnimations({subtree:!0}),se=0;se<Y.length;se++){var xe=Y[se],je=xe.effect,Qe=je.pseudoElement;if(Qe!=null&&Qe.startsWith("::view-transition")){ue.push(xe),xe=je.getKeyframes();for(var X=Qe=void 0,q=!0,ie=0;ie<xe.length;ie++){var ce=xe[ie],Ne=ce.width;if(Qe===void 0)Qe=Ne;else if(Qe!==Ne){q=!1;break}if(Ne=ce.height,X===void 0)X=Ne;else if(X!==Ne){q=!1;break}delete ce.width,delete ce.height,ce.transform==="none"&&delete ce.transform}q&&Qe!==void 0&&X!==void 0&&(je.setKeyframes(xe),q=getComputedStyle(je.target,je.pseudoElement),q.width!==Qe||q.height!==X)&&(q=xe[0],q.width=Qe,q.height=X,q=xe[xe.length-1],q.width=Qe,q.height=X,je.setKeyframes(xe))}}E()},function(Y){Q.__reactViewTransition===oe&&(Q.__reactViewTransition=null);try{typeof Y=="object"&&Y!==null&&Y.name==="InvalidStateError"&&(Y.message==="View transition was skipped because document visibility state is hidden."||Y.message==="Skipping view transition because document visibility state has become hidden."||Y.message==="Skipping view transition because viewport size changed."||Y.message==="Transition was aborted because of invalid state")&&(Y=null),Y!==null&&H(Y)}finally{d(),v(),E()}}),oe.finished.finally(function(){for(var Y=0;Y<ue.length;Y++)ue[Y].cancel();Q.__reactViewTransition===oe&&(Q.__reactViewTransition=null),O()}),oe}catch{return d(),v(),E(),null}}function Ha(r,o){this._scope=document.documentElement,this._selector="::view-transition-"+r+"("+o+")"}Ha.prototype.animate=function(r,o){return o=typeof o=="number"?{duration:o}:D({},o),o.pseudoElement=this._selector,this._scope.animate(r,o)},Ha.prototype.getAnimations=function(){for(var r=this._scope,o=this._selector,c=r.getAnimations({subtree:!0}),d=[],v=0;v<c.length;v++){var y=c[v].effect;y!==null&&y.target===r&&y.pseudoElement===o&&d.push(c[v])}return d},Ha.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function cE(r){return{name:r,group:new Ha("group",r),imagePair:new Ha("image-pair",r),old:new Ha("old",r),new:new Ha("new",r)}}function Gi(r){this._fragmentFiber=r,this._observers=this._eventListeners=null}Gi.prototype.addEventListener=function(r,o,c){var d=null,v=null;if(!(c!=null&&typeof c!="boolean"&&(d=c.signal||null,d!==null&&d.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var y=this._eventListeners;if(dE(y,r,o,c)===-1){var E=this,O=o;c!=null&&typeof c!="boolean"&&c.once===!0&&(O=function(H){E.removeEventListener(r,o,c),typeof o=="function"?o.call(this,H):o.handleEvent(H)}),d!==null&&(v=E.removeEventListener.bind(E,r,o,c),d.addEventListener("abort",v,{once:!0}),v=d.removeEventListener.bind(d,"abort",v)),d=oc(c),y.push({type:r,listener:o,optionsOrUseCapture:c,attachedListener:O,cleanup:v}),m(this._fragmentFiber.child,!1,pL,r,O,d)}this._eventListeners=y}};function pL(r,o,c,d){return C(r).addEventListener(o,c,d),!1}Gi.prototype.removeEventListener=function(r,o,c){var d=this._eventListeners;if(d!==null&&(o=dE(d,r,o,c),o!==-1)){var v=d[o];c=v.attachedListener;var y=v.cleanup;v=oc(v.optionsOrUseCapture),m(this._fragmentFiber.child,!1,mL,r,c,v),d.splice(o,1),y!==null&&y()}};function mL(r,o,c,d){return C(r).removeEventListener(o,c,d),!1}function oc(r){return r!=null&&typeof r!="boolean"&&(r.once===!0||r.signal instanceof AbortSignal)?{capture:r.capture,passive:r.passive}:r}function uE(r){return r==null?"c=0":typeof r=="boolean"?"c="+(r?"1":"0"):"c="+(r.capture?"1":"0")}function dE(r,o,c,d){if(r.length===0)return-1;d=uE(d);for(var v=0;v<r.length;v++){var y=r[v];if(y.type===o&&y.listener===c&&uE(y.optionsOrUseCapture)===d)return v}return-1}Gi.prototype.dispatchEvent=function(r){var o=_(this._fragmentFiber);if(o===null)return!0;o=C(o);var c=this._eventListeners;if(c!==null&&0<c.length||!r.bubbles){var d=o.nodeType===9?o.createComment(""):document.createTextNode("");if(c)for(var v=0;v<c.length;v++){var y=c[v];d.addEventListener(y.type,y.attachedListener,oc(y.optionsOrUseCapture))}if(o.appendChild(d),r=d.dispatchEvent(r),c)for(v=0;v<c.length;v++)y=c[v],d.removeEventListener(y.type,y.attachedListener,oc(y.optionsOrUseCapture));return o.removeChild(d),r}return o.dispatchEvent(r)},Gi.prototype.focus=function(r){m(this._fragmentFiber.child,!0,hE,r,void 0,void 0)};function hE(r,o){return r.tag===6?!1:(r=C(r),NL(r,o))}Gi.prototype.focusLast=function(r){var o=[];m(this._fragmentFiber.child,!0,Sy,o,void 0,void 0);for(var c=o.length-1;0<=c&&!hE(o[c],r);c--);};function Sy(r,o){return o.push(r),!1}Gi.prototype.blur=function(){var r=_(this._fragmentFiber);r!==null&&(r=C(r),r=Ku(r).activeElement,r!==null&&m(this._fragmentFiber.child,!1,gL,r,void 0,void 0))};function gL(r,o){return r.tag===6?!1:(r=C(r),r===o||r.contains(o)?(o.blur(),!0):!1)}Gi.prototype.observeUsing=function(r){this._observers===null&&(this._observers=new Set),this._observers.add(r),m(this._fragmentFiber.child,!1,vL,r,void 0,void 0)};function vL(r,o){return r.tag===6||(r=C(r),o.observe(r)),!1}Gi.prototype.unobserveUsing=function(r){var o=this._observers;if(o!==null&&o.has(r)){o.delete(r),m(this._fragmentFiber.child,!1,yL,r,void 0,void 0);for(var c=o=0;c<Ir.length;c++){var d=Ir[c];d.fragmentInstance===this&&d.observer===r?r.unobserve(d.instance):Ir[o++]=d}Ir.length=o}};function yL(r,o){return r.tag===6||(r=C(r),o.unobserve(r)),!1}var Ir=[],wy=!1;function _L(r,o,c){Ir.push({fragmentInstance:r,observer:o,instance:c}),wy||(wy=!0,RL(function(){wy=!1;var d=Ir;Ir=[];for(var v=0;v<d.length;v++){var y=d[v];y.observer.unobserve(y.instance)}}))}Gi.prototype.getClientRects=function(){var r=[];return m(this._fragmentFiber.child,!1,bL,r,void 0,void 0),r};function bL(r,o){if(r.tag===6){r=r.stateNode;var c=r.ownerDocument.createRange();c.selectNodeContents(r),o.push.apply(o,c.getClientRects())}else r=C(r),o.push.apply(o,r.getClientRects());return!1}Gi.prototype.getRootNode=function(r){var o=_(this._fragmentFiber);return o===null?this:C(o).getRootNode(r)},Gi.prototype.compareDocumentPosition=function(r){var o=_(this._fragmentFiber);if(o===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var c=[];m(this._fragmentFiber.child,!1,Sy,c,void 0,void 0);var d=C(o);if(c.length===0){if(c=d,b(this._fragmentFiber)){e:{for(o=this._fragmentFiber.return;o!==null;){if(o.tag===4){o=o.stateNode.containerInfo;break e}if(o.tag===3||o.tag===5||o.tag===27)break;o=o.return}o=null}o!=null&&(c=o)}o=this._fragmentFiber;var v=d=c.compareDocumentPosition(r);return c===r?v=Node.DOCUMENT_POSITION_CONTAINS:d&Node.DOCUMENT_POSITION_CONTAINED_BY&&(c=x(o)[1],c===null?v=Node.DOCUMENT_POSITION_PRECEDING:(r=C(c).compareDocumentPosition(r),v=r===0||r&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),v|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}o=C(c[0]),v=C(c[c.length-1]);var y=b(this._fragmentFiber)?o.parentElement:d;if(y==null)return Node.DOCUMENT_POSITION_DISCONNECTED;d=y.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_CONTAINED_BY,y=y.compareDocumentPosition(v)&Node.DOCUMENT_POSITION_CONTAINED_BY;var E=o.compareDocumentPosition(r),O=v.compareDocumentPosition(r),H=E&Node.DOCUMENT_POSITION_CONTAINED_BY||O&Node.DOCUMENT_POSITION_CONTAINED_BY;return O=d&&y&&E&Node.DOCUMENT_POSITION_FOLLOWING&&O&Node.DOCUMENT_POSITION_PRECEDING,o=d&&o===r||y&&v===r||H||O?Node.DOCUMENT_POSITION_CONTAINED_BY:!d&&o===r||!y&&v===r?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:E,o&Node.DOCUMENT_POSITION_DISCONNECTED||o&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||xL(o,this._fragmentFiber,c[0],c[c.length-1],r)?o:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function xL(r,o,c,d,v){var y=xa(v);if(r&Node.DOCUMENT_POSITION_CONTAINED_BY){if(c=!!y)e:{for(;y!==null;){if(y.tag===7&&(y===o||y.alternate===o)){c=!0;break e}y=y.return}c=!1}return c}if(r&Node.DOCUMENT_POSITION_CONTAINS){if(y===null)return y=v.ownerDocument,v===y||v===y.documentElement||v===y.body;e:{for(y=o,o=_(o);y!==null;){if(!(y.tag!==5&&y.tag!==3&&y.tag!==27||y!==o&&y.alternate!==o)){y=!0;break e}y=y.return}y=!1}return y}return r&Node.DOCUMENT_POSITION_PRECEDING?((o=!!y)&&!(o=y===c)&&(o=T(c,y,I),o===null?o=!1:(m(o,!0,N,y,c),y=k,k=null,o=y!==null)),o):r&Node.DOCUMENT_POSITION_FOLLOWING?((o=!!y)&&!(o=y===d)&&(o=T(d,y,I),o===null?o=!1:(m(o,!0,A,y,d),y=k,R=k=null,o=y!==null)),o):!1}function fE(r,o){var c=r.ownerDocument.createRange();c.selectNodeContents(r),r=c.getBoundingClientRect(),window.scrollTo(window.scrollX+r.left,o?window.scrollY+r.top:window.scrollY+r.bottom-window.innerHeight)}Gi.prototype.scrollIntoView=function(r){if(typeof r=="object")throw Error(i(566));var o=[];m(this._fragmentFiber.child,!1,Sy,o,void 0,void 0);var c=r!==!1;if(o.length===0){var d=x(this._fragmentFiber);if(d=c?d[1]||d[0]||_(this._fragmentFiber):d[0]||d[1],d===null)return;if(d.tag===6){r=C(d),fE(r,c);return}if(d=C(d),d.nodeType!==9){if(d.nodeType===11){c="host"in d?d.host:null,c!==null&&c.scrollIntoView(r);return}d.scrollIntoView(r)}}for(d=c?o.length-1:0;d!==(c?-1:o.length);){var v=o[d];v.tag===6?(v=C(v),fE(v,c)):C(v).scrollIntoView(r),d+=c?-1:1}};function SL(r,o){return r=C(r),pE(r,o),!1}function pE(r,o){r.reactFragments==null&&(r.reactFragments=new Set),r.reactFragments.add(o)}function mE(r,o){var c=o._eventListeners;if(c!==null)for(var d=0;d<c.length;d++){var v=c[d];r.addEventListener(v.type,v.attachedListener,oc(v.optionsOrUseCapture))}r.nodeType!==3&&(c=o._observers,c!==null&&c.forEach(function(y){for(var E=0,O=0;O<Ir.length;O++){var H=Ir[O];(H.fragmentInstance!==o||H.observer!==y||H.instance!==r)&&(Ir[E++]=H)}Ir.length=E,y.observe(r)}),pE(r,o))}function wL(r,o){var c=o._eventListeners;if(c!==null)for(var d=0;d<c.length;d++){var v=c[d];r.removeEventListener(v.type,v.attachedListener,oc(v.optionsOrUseCapture))}r.nodeType!==3&&(c=o._observers,c!==null&&c.forEach(function(y){typeof y.rootMargin=="string"?_L(o,y,r):y.unobserve(r)}),r.reactFragments!=null&&r.reactFragments.delete(o))}function Cy(r){var o=r.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var c=o;switch(o=o.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":Cy(c),mh(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}r.removeChild(c)}}function CL(r,o,c,d){for(;r.nodeType===1;){var v=c;if(r.nodeName.toLowerCase()!==o.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[uu])switch(o){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(y=r.getAttribute("rel"),y==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(y!==v.rel||r.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||r.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||r.getAttribute("title")!==(v.title==null?null:v.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(y=r.getAttribute("src"),(y!==(v.src==null?null:v.src)||r.getAttribute("type")!==(v.type==null?null:v.type)||r.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&y&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(o==="input"&&r.type==="hidden"){var y=v.name==null?null:""+v.name;if(v.type==="hidden"&&r.getAttribute("name")===y)return r}else return r;if(r=gr(r.nextSibling),r===null)break}return null}function kL(r,o,c){if(o==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!c||(r=gr(r.nextSibling),r===null))return null;return r}function gE(r,o){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!o||(r=gr(r.nextSibling),r===null))return null;return r}function ky(r){return r.data==="$?"||r.data==="$~"}function Ey(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function EL(r,o){var c=r.ownerDocument;if(r.data==="$~")r._reactRetry=o;else if(r.data!=="$?"||c.readyState!=="loading")o();else{var d=function(){o(),c.removeEventListener("DOMContentLoaded",d)};c.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function gr(r){for(;r!=null;r=r.nextSibling){var o=r.nodeType;if(o===1||o===3)break;if(o===8){if(o=r.data,o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"||o==="F!"||o==="F")break;if(o==="/$"||o==="/&")return null}}return r}var Ny=null;function vE(r){r=r.nextSibling;for(var o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="/$"||c==="/&"){if(o===0)return gr(r.nextSibling);o--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||o++}r=r.nextSibling}return null}function yE(r){r=r.previousSibling;for(var o=0;r;){if(r.nodeType===8){var c=r.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(o===0)return r;o--}else c!=="/$"&&c!=="/&"||o++}r=r.previousSibling}return null}function NL(r,o){function c(){d=!0}if(r.ownerDocument.activeElement===r)return!0;var d=!1;try{r.ownerDocument.addEventListener("focus",c,!0),(r.focus||HTMLElement.prototype.focus).call(r,o)}finally{r.ownerDocument.removeEventListener("focus",c,!0)}return d}function RL(r){rE(function(){rE(function(o){return r(o)})})}function _E(r,o,c){switch(o=Ku(c),r){case"html":if(r=o.documentElement,!r)throw Error(i(452));return r;case"head":if(r=o.head,!r)throw Error(i(453));return r;case"body":if(r=o.body,!r)throw Error(i(454));return r;default:throw Error(i(451))}}function bE(r,o,c){for(var d in c){var v=c[d];c.hasOwnProperty(d)&&v!=null&&kt(r,o,d,null,iL,v)}c.dangerouslySetInnerHTML!=null&&(r.textContent=""),r.onclick===Gr&&(r.onclick=null),mh(r)}function Ry(r){for(var o=r.attributes;o.length;)r.removeAttributeNode(o[0]);mh(r)}var vr=new Map,xE=new Set;function Vu(r){if(typeof r.getRootNode=="function"){var o=r.getRootNode();if(o.nodeType===9||o.nodeType===11)return o}return r.nodeType===9?r:r.ownerDocument}var Vs=he.d;he.d={f:TL,r:DL,D:AL,C:OL,L:jL,m:zL,X:IL,S:ML,M:PL};function TL(){var r=Vs.f(),o=_f();return r||o}function DL(r){var o=kl(r);o!==null&&o.tag===5&&o.type==="form"?wC(o):Vs.r(r)}var ac=typeof document>"u"?null:document;function SE(r,o,c){var d=ac;if(d&&typeof o=="string"&&o){var v=cr(o);v='link[rel="'+r+'"][href="'+v+'"]',typeof c=="string"&&(v+='[crossorigin="'+c+'"]'),xE.has(v)||(xE.add(v),r={rel:r,crossOrigin:c,href:o},d.querySelector(v)===null&&(o=d.createElement("link"),Qn(o,"link",r),In(o),d.head.appendChild(o)))}}function AL(r){Vs.D(r),SE("dns-prefetch",r,null)}function OL(r,o){Vs.C(r,o),SE("preconnect",r,o)}function jL(r,o,c){Vs.L(r,o,c);var d=ac;if(d&&r&&o){var v='link[rel="preload"][as="'+cr(o)+'"]';o==="image"&&c&&c.imageSrcSet?(v+='[imagesrcset="'+cr(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(v+='[imagesizes="'+cr(c.imageSizes)+'"]')):v+='[href="'+cr(r)+'"]';var y=v;switch(o){case"style":y=lc(r);break;case"script":y=cc(r)}if(!(vr.has(y)||(r=D({rel:"preload",href:o==="image"&&c&&c.imageSrcSet?void 0:r,as:o},c),vr.set(y,r),d.querySelector(v)!==null||o==="style"&&d.querySelector(Gu(y))||o==="script"&&d.querySelector(Zu(y))))){var E=d.createElement("link");Qn(E,"link",r),o==="style"&&(E[ph]=!0,E.onload=E.onerror=function(){MS(E)}),In(E),d.head.appendChild(E)}}}function zL(r,o){Vs.m(r,o);var c=ac;if(c&&r){var d=o&&typeof o.as=="string"?o.as:"script",v='link[rel="modulepreload"][as="'+cr(d)+'"][href="'+cr(r)+'"]',y=v;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=cc(r)}if(!vr.has(y)&&(r=D({rel:"modulepreload",href:r},o),vr.set(y,r),c.querySelector(v)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Zu(y)))return}d=c.createElement("link"),Qn(d,"link",r),In(d),c.head.appendChild(d)}}}function ML(r,o,c){Vs.S(r,o,c);var d=ac;if(d&&r){var v=El(d).hoistableStyles,y=lc(r);o=o||"default";var E=v.get(y);if(!E){var O={loading:0,preload:null};if(E=d.querySelector(Gu(y)))O.loading=5;else{r=D({rel:"stylesheet",href:r,"data-precedence":o},c),(c=vr.get(y))&&Ty(r,c);var H=E=d.createElement("link");In(H),Qn(H,"link",r),H._p=new Promise(function(Q,oe){H.onload=Q,H.onerror=oe}),H.addEventListener("load",function(){O.loading|=1}),H.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Ef(E,o,d)}E={type:"stylesheet",instance:E,count:1,state:O},v.set(y,E)}}}function IL(r,o){Vs.X(r,o);var c=ac;if(c&&r){var d=El(c).hoistableScripts,v=cc(r),y=d.get(v);y||(y=c.querySelector(Zu(v)),y||(r=D({src:r,async:!0},o),(o=vr.get(v))&&Dy(r,o),y=c.createElement("script"),In(y),Qn(y,"link",r),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(v,y))}}function PL(r,o){Vs.M(r,o);var c=ac;if(c&&r){var d=El(c).hoistableScripts,v=cc(r),y=d.get(v);y||(y=c.querySelector(Zu(v)),y||(r=D({src:r,async:!0,type:"module"},o),(o=vr.get(v))&&Dy(r,o),y=c.createElement("script"),In(y),Qn(y,"link",r),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(v,y))}}function wE(r,o,c,d){var v=(v=Bt.current)?Vu(v):null;if(!v)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(c=lc(c.href),o=El(v).hoistableStyles,d=o.get(c),d||(d={type:"style",instance:null,count:0,state:null},o.set(c,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=lc(c.href);var y=El(v).hoistableStyles,E=y.get(r);if(E||(v=v.ownerDocument||v,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(r,E),(y=v.querySelector(Gu(r)))?y._p||(E.instance=y,E.state.loading=5):(y=vr.get(r),y||(y={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},vr.set(r,y)),LL(v,r,y,E.state))),o&&d===null)throw Error(i(528,""));return E}if(o&&d!==null)throw Error(i(529,""));return null;case"script":return o=c.async,c=c.src,typeof c=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(c=cc(c),o=El(v).hoistableScripts,d=o.get(c),d||(d={type:"script",instance:null,count:0,state:null},o.set(c,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function lc(r){return'href="'+cr(r)+'"'}function Gu(r){return'link[rel="stylesheet"]['+r+"]"}function CE(r){return D({},r,{"data-precedence":r.precedence,precedence:null})}function LL(r,o,c,d){if(o=r.querySelector('link[rel="preload"][as="style"]['+o+"]")){if(o[ph]!==!0){d.loading=1;return}}else o=r.createElement("link"),o[ph]=!0,o.onload=o.onerror=MS.bind(null,o),Qn(o,"link",c),In(o),r.head.appendChild(o);d.preload=o,o.addEventListener("load",function(){return d.loading|=1}),o.addEventListener("error",function(){return d.loading|=2})}function cc(r){return'[src="'+cr(r)+'"]'}function Zu(r){return"script[async]"+r}function kE(r,o,c){if(o.count++,o.instance===null)switch(o.type){case"style":var d=r.querySelector('style[data-href~="'+cr(c.href)+'"]');if(d)return o.instance=d,In(d),d;var v=D({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),In(d),Qn(d,"style",v),Ef(d,c.precedence,r),o.instance=d;case"stylesheet":v=lc(c.href);var y=r.querySelector(Gu(v));if(y)return o.state.loading|=4,o.instance=y,In(y),y;d=CE(c),(v=vr.get(v))&&Ty(d,v),y=(r.ownerDocument||r).createElement("link"),In(y);var E=y;return E._p=new Promise(function(O,H){E.onload=O,E.onerror=H}),Qn(y,"link",d),o.state.loading|=4,Ef(y,c.precedence,r),o.instance=y;case"script":return y=cc(c.src),(v=r.querySelector(Zu(y)))?(o.instance=v,In(v),v):(d=c,(v=vr.get(y))&&(d=D({},c),Dy(d,v)),r=r.ownerDocument||r,v=r.createElement("script"),In(v),Qn(v,"link",d),r.head.appendChild(v),o.instance=v);case"void":return null;default:throw Error(i(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(d=o.instance,o.state.loading|=4,Ef(d,c.precedence,r));return o.instance}function Ef(r,o,c){for(var d=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=d.length?d[d.length-1]:null,y=v,E=0;E<d.length;E++){var O=d[E];if(O.dataset.precedence===o)y=O;else if(y!==v)break}y?y.parentNode.insertBefore(r,y.nextSibling):(o=c.nodeType===9?c.head:c,o.insertBefore(r,o.firstChild))}function Ty(r,o){r.crossOrigin==null&&(r.crossOrigin=o.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=o.referrerPolicy),r.title==null&&(r.title=o.title)}function Dy(r,o){r.crossOrigin==null&&(r.crossOrigin=o.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=o.referrerPolicy),r.integrity==null&&(r.integrity=o.integrity)}var Nf=null;function EE(r,o,c){if(Nf===null){var d=new Map,v=Nf=new Map;v.set(c,d)}else v=Nf,d=v.get(c),d||(d=new Map,v.set(c,d));if(d.has(r))return d;for(d.set(r,null),c=c.getElementsByTagName(r),v=0;v<c.length;v++){var y=c[v];if(!(y[uu]||y[Vn]||r==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var E=y.getAttribute(o)||"";E=r+E;var O=d.get(E);O?O.push(y):d.set(E,[y])}}return d}function Ay(r,o,c){r=r.ownerDocument||r,r.head.insertBefore(c,o==="title"?r.querySelector("head > title"):null)}function BL(r,o,c){if(c===1||o.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;return o.rel==="stylesheet"?(r=o.disabled,typeof o.precedence=="string"&&r==null):!0;case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function NE(r,o){return r==="img"&&o.src!=null&&o.src!==""&&o.onLoad==null&&o.loading!=="lazy"}function RE(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function TE(r){return(r.width||100)*(r.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function DE(r,o){typeof o.decode=="function"&&(r.imgCount++,o.complete||(r.imgBytes+=TE(o),r.suspenseyImages.push(o)),r=HL.bind(r),o.decode().then(r,r))}function FL(r,o,c,d){if(c.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var v=lc(d.href),y=o.querySelector(Gu(v));if(y){o=y._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(r.count++,r=Yu.bind(r),o.then(r,r)),c.state.loading|=4,c.instance=y,In(y);return}y=o.ownerDocument||o,d=CE(d),(v=vr.get(v))&&Ty(d,v),y=y.createElement("link"),In(y);var E=y;E._p=new Promise(function(O,H){E.onload=O,E.onerror=H}),Qn(y,"link",d),c.instance=y}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,o),(o=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=Yu.bind(r),o.addEventListener("load",c),o.addEventListener("error",c))}}var Rf=0;function UL(r,o){return r.stylesheets&&r.count===0&&Df(r,r.stylesheets),0<r.count||0<r.imgCount?function(c){var d=setTimeout(function(){if(r.stylesheets&&Df(r,r.stylesheets),r.unsuspend){var y=r.unsuspend;r.unsuspend=null,y()}},6e4+o);0<r.imgBytes&&Rf===0&&(Rf=62500*sL());var v=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Df(r,r.stylesheets),r.unsuspend)){var y=r.unsuspend;r.unsuspend=null,y()}},(r.imgBytes>Rf?50:800)+o);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(v)}}:null}function AE(r){if(r.count===0&&(r.imgCount===0||!r.waitingForImages)){if(r.stylesheets)Df(r,r.stylesheets);else if(r.unsuspend){var o=r.unsuspend;r.unsuspend=null,o()}}}function Yu(){this.count--,AE(this)}function HL(){this.imgCount--,AE(this)}var Tf=null;function Df(r,o){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Tf=new Map,o.forEach($L,r),Tf=null,Yu.call(r))}function $L(r,o){if(!(o.state.loading&4)){var c=Tf.get(r);if(c)var d=c.get(null);else{c=new Map,Tf.set(r,c);for(var v=r.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<v.length;y++){var E=v[y];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(c.set(E.dataset.precedence,E),d=E)}d&&c.set(null,d)}v=o.instance,E=v.getAttribute("data-precedence"),y=c.get(E)||d,y===d&&c.set(null,v),c.set(E,v),this.count++,d=Yu.bind(this),v.addEventListener("load",d),v.addEventListener("error",d),y?y.parentNode.insertBefore(v,y.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(v,r.firstChild)),o.state.loading|=4}}var uc={$$typeof:G,Provider:null,Consumer:null,_currentValue:J,_currentValue2:J,_threadCount:0};function qL(r,o,c,d,v,y,E,O,H){this.tag=1,this.containerInfo=r,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=dg(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=dg(0),this.hiddenUpdates=dg(null),this.identifierPrefix=d,this.onUncaughtError=v,this.onCaughtError=y,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=H,this.transitionTypes=null,this.incompleteTransitions=new Map}function OE(r,o,c,d,v,y,E,O,H,Q,oe,ue){return r=new qL(r,o,c,E,H,Q,oe,ue,O),o=1,y===!0&&(o|=24),y=Ri(3,null,null,o),r.current=y,y.stateNode=r,o=Kg(),o.refCount++,r.pooledCache=o,o.refCount++,y.memoizedState={element:d,isDehydrated:c,cache:o},Yg(y),r}function jE(r){return r?(r=Il,r):Il}function zE(r,o,c,d,v,y){v=jE(v),d.context===null?d.context=v:d.pendingContext=v,d=Eo(o),d.payload={element:c},y=y===void 0?null:y,y!==null&&(d.callback=y),c=No(r,d,o),c!==null&&(Oi(c,r,o),Nu(c,r,o))}function ME(r,o){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var c=r.retryLane;r.retryLane=c!==0&&c<o?c:o}}function Oy(r,o){ME(r,o),(r=r.alternate)&&ME(r,o)}function IE(r){if(r.tag===13||r.tag===31){var o=ka(r,67108864);o!==null&&Oi(o,r,67108864),Oy(r,67108864)}}function PE(r){if(r.tag===13||r.tag===31){var o=Vi();o=hg(o);var c=ka(r,o);c!==null&&Oi(c,r,o),Oy(r,o)}}var dc=!0;function WL(r,o,c,d){var v=re.T;re.T=null;var y=he.p;try{he.p=2,jy(r,o,c,d)}finally{he.p=y,re.T=v}}function KL(r,o,c,d){var v=re.T;re.T=null;var y=he.p;try{he.p=8,jy(r,o,c,d)}finally{he.p=y,re.T=v}}function jy(r,o,c,d){if(dc){var v=zy(d);if(v===null)py(r,o,d,Af,c),BE(r,d);else if(GL(v,r,o,c,d))d.stopPropagation();else if(BE(r,d),o&4&&-1<VL.indexOf(r)){for(;v!==null;){var y=kl(v);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var E=ba(y.pendingLanes);if(E!==0){var O=y;for(O.pendingLanes|=2,O.entangledLanes|=2;E;){var H=1<<31-Fi(E);O.entanglements[1]|=H,E&=~H}rs(y),(gt&6)===0&&(gf=_t()+500,$u(0))}}break;case 31:case 13:O=ka(y,2),O!==null&&Oi(O,y,2),_f(),Oy(y,2)}if(y=zy(d),y===null&&py(r,o,d,Af,c),y===v)break;v=y}v!==null&&d.stopPropagation()}else py(r,o,d,null,c)}}function zy(r){return r=_g(r),My(r)}var Af=null;function My(r){if(Af=null,r=xa(r),r!==null){var o=a(r);if(o===null)r=null;else{var c=o.tag;if(c===13){if(r=l(o),r!==null)return r;r=null}else if(c===31){if(r=u(o),r!==null)return r;r=null}else if(c===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;r=null}else o!==r&&(r=null)}}return Af=r,null}function LE(r){switch(r){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Mn()){case Os:return 2;case lr:return 8;case ch:case oP:return 32;case kS:return 268435456;default:return 32}default:return 32}}var Iy=!1,Bo=null,Fo=null,Uo=null,Xu=new Map,Qu=new Map,Ho=[],VL="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 BE(r,o){switch(r){case"focusin":case"focusout":Bo=null;break;case"dragenter":case"dragleave":Fo=null;break;case"mouseover":case"mouseout":Uo=null;break;case"pointerover":case"pointerout":Xu.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qu.delete(o.pointerId)}}function Ju(r,o,c,d,v,y){return r===null||r.nativeEvent!==y?(r={blockedOn:o,domEventName:c,eventSystemFlags:d,nativeEvent:y,targetContainers:[v]},o!==null&&(o=kl(o),o!==null&&IE(o)),r):(r.eventSystemFlags|=d,o=r.targetContainers,v!==null&&o.indexOf(v)===-1&&o.push(v),r)}function GL(r,o,c,d,v){switch(o){case"focusin":return Bo=Ju(Bo,r,o,c,d,v),!0;case"dragenter":return Fo=Ju(Fo,r,o,c,d,v),!0;case"mouseover":return Uo=Ju(Uo,r,o,c,d,v),!0;case"pointerover":var y=v.pointerId;return Xu.set(y,Ju(Xu.get(y)||null,r,o,c,d,v)),!0;case"gotpointercapture":return y=v.pointerId,Qu.set(y,Ju(Qu.get(y)||null,r,o,c,d,v)),!0}return!1}function FE(r){var o=xa(r.target);if(o!==null){var c=a(o);if(c!==null){if(o=c.tag,o===13){if(o=l(c),o!==null){r.blockedOn=o,OS(r.priority,function(){PE(c)});return}}else if(o===31){if(o=u(c),o!==null){r.blockedOn=o,OS(r.priority,function(){PE(c)});return}}else if(o===3&&c.stateNode.current.memoizedState.isDehydrated){r.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Of(r){if(r.blockedOn!==null)return!1;for(var o=r.targetContainers;0<o.length;){var c=zy(r.nativeEvent);if(c===null){c=r.nativeEvent;var d=new c.constructor(c.type,c);yg=d,c.target.dispatchEvent(d),yg=null}else return o=kl(c),o!==null&&IE(o),r.blockedOn=c,!1;o.shift()}return!0}function UE(r,o,c){Of(r)&&c.delete(o)}function ZL(){Iy=!1,Bo!==null&&Of(Bo)&&(Bo=null),Fo!==null&&Of(Fo)&&(Fo=null),Uo!==null&&Of(Uo)&&(Uo=null),Xu.forEach(UE),Qu.forEach(UE)}function jf(r,o){r.blockedOn===o&&(r.blockedOn=null,Iy||(Iy=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,ZL)))}var zf=null;function HE(r){zf!==r&&(zf=r,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){zf===r&&(zf=null);for(var o=0;o<r.length;o+=3){var c=r[o],d=r[o+1],v=r[o+2];if(typeof d!="function"){if(My(d||c)===null)continue;break}var y=kl(c);y!==null&&(r.splice(o,3),o-=3,vv(y,{pending:!0,data:v,method:c.method,action:d},d,v))}}))}function hc(r){function o(H){return jf(H,r)}Bo!==null&&jf(Bo,r),Fo!==null&&jf(Fo,r),Uo!==null&&jf(Uo,r),Xu.forEach(o),Qu.forEach(o);for(var c=0;c<Ho.length;c++){var d=Ho[c];d.blockedOn===r&&(d.blockedOn=null)}for(;0<Ho.length&&(c=Ho[0],c.blockedOn===null);)FE(c),c.blockedOn===null&&Ho.shift();if(c=(r.ownerDocument||r).$$reactFormReplay,c!=null)for(d=0;d<c.length;d+=3){var v=c[d],y=c[d+1],E=v[Ni]||null;if(typeof y=="function")E||HE(c);else if(E){var O=null;if(y&&y.hasAttribute("formAction")){if(v=y,E=y[Ni]||null)O=E.formAction;else if(My(v)!==null)continue}else O=E.action;typeof O=="function"?c[d+1]=O:(c.splice(d,3),d-=3),HE(c)}}}function $E(){function r(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(E){return v=E})},focusReset:"manual",scroll:"manual"})}function o(){v!==null&&(v(),v=null),d||setTimeout(c,20)}function c(){if(!d&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,v=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",o),navigation.addEventListener("navigateerror",o),setTimeout(c,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",o),navigation.removeEventListener("navigateerror",o),v!==null&&(v(),v=null)}}}function Py(r){this._internalRoot=r}Mf.prototype.render=Py.prototype.render=function(r){var o=this._internalRoot;if(o===null)throw Error(i(409));var c=o.current,d=Vi();zE(c,d,r,o,null,null)},Mf.prototype.unmount=Py.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var o=r.containerInfo;zE(r.current,2,null,r,null,null),_f(),o[Cl]=null}};function Mf(r){this._internalRoot=r}Mf.prototype.unstable_scheduleHydration=function(r){if(r){var o=AS();r={blockedOn:null,target:r,priority:o};for(var c=0;c<Ho.length&&o!==0&&o<Ho[c].priority;c++);Ho.splice(c,0,r),c===0&&FE(r)}};var qE=t.version;if(qE!=="19.3.1")throw Error(i(527,qE,"19.3.1"));he.findDOMNode=function(r){var o=r._reactInternals;if(o===void 0)throw typeof r.render=="function"?Error(i(188)):(r=Object.keys(r).join(","),Error(i(268,r)));return r=h(o),r=r!==null?g(r):null,r=r===null?null:r.stateNode,r};var YL={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:re,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var If=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!If.isDisabled&&If.supportsFiber)try{au=If.inject(YL),Bi=If}catch{}}return nd.createRoot=function(r,o){if(!s(r))throw Error(i(299));var c=!1,d="",v=jC,y=zC,E=MC;return o!=null&&(o.unstable_strictMode===!0&&(c=!0),o.identifierPrefix!==void 0&&(d=o.identifierPrefix),o.onUncaughtError!==void 0&&(v=o.onUncaughtError),o.onCaughtError!==void 0&&(y=o.onCaughtError),o.onRecoverableError!==void 0&&(E=o.onRecoverableError)),o=OE(r,1,!1,null,null,c,d,null,v,y,E,$E),r[Cl]=o.current,fy(r),new Py(o)},nd.hydrateRoot=function(r,o,c){if(!s(r))throw Error(i(299));var d=!1,v="",y=jC,E=zC,O=MC,H=null;return c!=null&&(c.unstable_strictMode===!0&&(d=!0),c.identifierPrefix!==void 0&&(v=c.identifierPrefix),c.onUncaughtError!==void 0&&(y=c.onUncaughtError),c.onCaughtError!==void 0&&(E=c.onCaughtError),c.onRecoverableError!==void 0&&(O=c.onRecoverableError),c.formState!==void 0&&(H=c.formState)),o=OE(r,1,!0,o,c??null,d,v,H,y,E,O,$E),o.context=jE(null),c=o.current,d=Vi(),d=hg(d),v=Eo(d),v.callback=null,No(c,v,d),c=d,o.current.lanes=c,cu(o,c),rs(o),r[Cl]=o.current,fy(r),new Mf(o)},nd.version="19.3.1",nd}var W2;function y7(){if(W2)return e_.exports;W2=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(),e_.exports=v7(),e_.exports}var _7=y7();var G0=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,JO=/^[\\/]{2}/;function b7(e,t){return t+e.replace(/\\/g,"/")}var K2="popstate";function V2(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function x7(e={}){function t(i,s){let a=s.state?.masked,{pathname:l,search:u,hash:f}=a||i.location;return zb("",{pathname:l,search:u,hash:f},s.state&&s.state.usr||null,s.state&&s.state.key||"default",a?{pathname:i.location.pathname,search:i.location.search,hash:i.location.hash}:void 0)}function n(i,s){return typeof s=="string"?s:dl(s)}return w7(t,n,null,e)}function Wt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Er(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function S7(){return Math.random().toString(36).substring(2,10)}function G2(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function zb(e,t,n=null,i,s){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Zc(t):t,state:n,key:t&&t.key||i||S7(),mask:s}}function dl({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Zc(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let i=e.indexOf("?");i>=0&&(t.search=e.substring(i),e=e.substring(0,i)),e&&(t.pathname=e)}return t}function w7(e,t,n,i={}){let{window:s=document.defaultView,v5Compat:a=!1}=i,l=s.history,u="POP",f=null,h=g();h==null&&(h=0,l.replaceState({...l.state,idx:h},""));function g(){return(l.state||{idx:null}).idx}function m(){u="POP";let C=g(),k=C==null?null:C-h;h=C,f&&f({action:u,location:S.location,delta:k})}function _(C,k){u="PUSH";let R=V2(C)?C:zb(S.location,C,k);h=g()+1;let N=G2(R,h),A=S.createHref(R.mask||R);try{l.pushState(N,"",A)}catch(I){if(I instanceof DOMException&&I.name==="DataCloneError")throw I;s.location.assign(A)}a&&f&&f({action:u,location:S.location,delta:1})}function b(C,k){u="REPLACE";let R=V2(C)?C:zb(S.location,C,k);h=g();let N=G2(R,h),A=S.createHref(R.mask||R);l.replaceState(N,"",A),a&&f&&f({action:u,location:S.location,delta:0})}function x(C){return C7(s,C)}let S={get action(){return u},get location(){return e(s,l)},listen(C){if(f)throw new Error("A history only accepts one active listener");return s.addEventListener(K2,m),f=C,()=>{s.removeEventListener(K2,m),f=null}},createHref(C){return t(s,C)},createURL:x,encodeLocation(C){let k=x(C);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:_,replace:b,go(C){return l.go(C)}};return S}function C7(e,t,n=!1){let i="http://localhost";e&&(i=e.location.origin!=="null"?e.location.origin:e.location.href),Wt(i,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:dl(t);return s=s.replace(/ $/,"%20"),!n&&JO.test(s)&&(s=i+s),new URL(s,i)}function ej(e,t,n="/"){return k7(e,t,n,!1)}function k7(e,t,n,i,s){let a=typeof t=="string"?Zc(t):t,l=oo(a.pathname||"/",n);if(l==null)return null;let u=E7(e),f=null,h=P7(l);for(let g=0;f==null&&g<u.length;++g)f=I7(u[g],h,i);return f}function E7(e){let t=tj(e);return N7(t),t}function tj(e,t=[],n=[],i="",s=!1){let a=(l,u,f=s,h)=>{let g={relativePath:h===void 0?l.path||"":h,caseSensitive:l.caseSensitive===!0,childrenIndex:u,route:l};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(i)&&f)return;Wt(g.relativePath.startsWith(i),`Absolute route path "${g.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(i.length)}let m=Lr([i,g.relativePath]),_=n.concat(g);l.children&&l.children.length>0&&(Wt(l.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),tj(l.children,t,_,m,f)),!(l.path==null&&!l.index)&&t.push({path:m,score:z7(m,l.index),routesMeta:_.map((b,x)=>{let[S,C]=rj(b.relativePath,b.caseSensitive,x===_.length-1);return{...b,matcher:S,compiledParams:C}})})};return e.forEach((l,u)=>{if(l.path===""||!l.path?.includes("?"))a(l,u);else for(let f of nj(l.path))a(l,u,!0,f)}),t}function nj(e){let t=e.split("/");if(t.length===0)return[];let[n,...i]=t,s=n.endsWith("?"),a=n.replace(/\?$/,"");if(i.length===0)return s?[a,""]:[a];let l=nj(i.join("/")),u=[];return u.push(...l.map(f=>f===""?a:[a,f].join("/"))),s&&u.push(...l),u.map(f=>e.startsWith("/")&&f===""?"/":f)}function N7(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:M7(t.routesMeta.map(i=>i.childrenIndex),n.routesMeta.map(i=>i.childrenIndex)))}var R7=/^:[\w-]+$/,T7=3,D7=2,A7=1,O7=10,j7=-2,Z2=e=>e==="*";function z7(e,t){let n=e.split("/"),i=n.length;return n.some(Z2)&&(i+=j7),t&&(i+=D7),n.filter(s=>!Z2(s)).reduce((s,a)=>s+(R7.test(a)?T7:a===""?A7:O7),i)}function M7(e,t){return e.length===t.length&&e.slice(0,-1).every((i,s)=>i===t[s])?e[e.length-1]-t[t.length-1]:0}function I7(e,t,n=!1){let{routesMeta:i}=e,s={},a="/",l=[];for(let u=0;u<i.length;++u){let f=i[u],h=u===i.length-1,g=a==="/"?t:t.slice(a.length)||"/",m={path:f.relativePath,caseSensitive:f.caseSensitive,end:h},_=f.matcher&&f.compiledParams?ij(m,g,f.matcher,f.compiledParams):Xp(m,g),b=f.route;if(!_&&h&&n&&!i[i.length-1].route.index&&(_=Xp({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},g)),!_)return null;Object.assign(s,_.params),l.push({params:s,pathname:Lr([a,_.pathname]),pathnameBase:F7(Lr([a,_.pathnameBase])),route:b}),_.pathnameBase!=="/"&&(a=Lr([a,_.pathnameBase]))}return l}function Xp(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,i]=rj(e.path,e.caseSensitive,e.end);return ij(e,t,n,i)}function ij(e,t,n,i){let s=t.match(n);if(!s)return null;let a=s[0],l=Mc(a,1),u=s.slice(1);return{params:i.reduce((h,{paramName:g,isOptional:m},_)=>{if(g==="*"){let x=u[_]||"";l=Mc(a.slice(0,a.length-x.length),1)}const b=u[_];return m&&!b?h[g]=void 0:h[g]=(b||"").replace(/%2F/g,"/"),h},{}),pathname:a,pathnameBase:l,pattern:e}}function rj(e,t=!1,n=!0){Er(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let i=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,u,f,h,g)=>{if(i.push({paramName:u,isOptional:f!=null}),f){let m=g.charAt(h+l.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(i.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),i]}function P7(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Er(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function oo(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,i=e.charAt(n);return i&&i!=="/"?null:e.slice(n)||"/"}function L7(e,t="/"){let{pathname:n,search:i="",hash:s=""}=typeof e=="string"?Zc(e):e,a;return n?(n=sj(n),n.startsWith("/")||n.startsWith("\\")?a=Y2(n.substring(1),"/"):a=Y2(n,t)):a=t,{pathname:a,search:U7(i),hash:H7(s)}}function Y2(e,t){let n=Mc(t).split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function i_(e,t,n,i){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(i)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function B7(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Z0(e){let t=B7(e);return t.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase)}function jm(e,t,n,i=!1){let s;typeof e=="string"?s=Zc(e):(s={...e},Wt(!s.pathname||!s.pathname.includes("?"),i_("?","pathname","search",s)),Wt(!s.pathname||!s.pathname.includes("#"),i_("#","pathname","hash",s)),Wt(!s.search||!s.search.includes("#"),i_("#","search","hash",s)));let a=e===""||s.pathname==="",l=a?"/":s.pathname,u;if(l==null)u=n;else{let m=t.length-1;if(!i&&l.startsWith("..")){let _=l.split("/");for(;_[0]==="..";)_.shift(),m-=1;s.pathname=_.join("/")}u=m>=0?t[m]:"/"}let f=L7(s,u),h=l&&l!=="/"&&l.endsWith("/"),g=(a||l===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(h||g)&&(f.pathname+="/"),f}var sj=e=>e.replace(/[\\/]{2,}/g,"/"),Lr=e=>sj(e.join("/"));function Mc(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var F7=e=>Mc(e).replace(/^\/*/,"/"),U7=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,H7=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,$7=class{constructor(e,t,n,i=!1){this.status=e,this.statusText=t||"",this.internal=i,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function q7(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function W7(e){let t=e.map(n=>n.route.path).filter(Boolean);return Lr(t)||"/"}var oj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function aj(e,t){let n=e;if(typeof n!="string"||!G0.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let i=n,s=!1;if(oj)try{let a=new URL(window.location.href),l=JO.test(n)?new URL(b7(n,a.protocol)):new URL(n),u=oo(l.pathname,t);l.origin===a.origin&&u!=null?n=u+l.search+l.hash:s=!0}catch{Er(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:i,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var X2=new URL("http://localhost");function Y0(e){if(e.createURL)return e.createURL("/");try{return new URL(e.createHref("/"),X2)}catch{return X2}}function r_(e,t){return e.origin===t.origin&&(e.origin!=="null"||e.protocol===t.protocol&&e.host===t.host)}function K7(e,t){if(e.startsWith("//"))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===""||e.slice(n.length).startsWith("//"):!1}function X0(e,t,n,i){let s=null;try{s=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),l=s!=null&&!r_(s,n),u=!r_(a,n);if(i==="reject"){if(l||u)throw new Error("External navigation is not allowed")}else if(u&&(s==null||!K7(e,s)||!r_(s,a)))throw new Error("External navigation is not allowed")}var lj=["POST","PUT","PATCH","DELETE"];new Set(lj);var V7=["GET",...lj];new Set(V7);var G7=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function Z7(e){try{return G7.includes(new URL(e).protocol)}catch{return!1}}var Yc=w.createContext(null);Yc.displayName="DataRouter";var zm=w.createContext(null);zm.displayName="DataRouterState";var cj=w.createContext(!1);function Y7(){return w.useContext(cj)}var uj=w.createContext({isTransitioning:!1});uj.displayName="ViewTransition";var X7=w.createContext(new Map);X7.displayName="Fetchers";var Q7=w.createContext(null);Q7.displayName="Await";var ar=w.createContext(null);ar.displayName="Navigation";var Xd=w.createContext(null);Xd.displayName="Location";var Ts=w.createContext({outlet:null,matches:[],isDataRoute:!1});Ts.displayName="Route";var Q0=w.createContext(null);Q0.displayName="RouteError";var dj="REACT_ROUTER_ERROR",J7="REDIRECT",eH="ROUTE_ERROR_RESPONSE";function tH(e){if(e.startsWith(`${dj}:${J7}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function nH(e){if(e.startsWith(`${dj}:${eH}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new $7(t.status,t.statusText,t.data)}catch{}}function iH(e,{relative:t}={}){Wt(Xc(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:i}=w.useContext(ar),{hash:s,pathname:a,search:l}=Qd(e,{relative:t}),u=a;return n!=="/"&&(u=a==="/"?n:Lr([n,a])),i.createHref({pathname:u,search:l,hash:s})}function Xc(){return w.useContext(Xd)!=null}function Nr(){return Wt(Xc(),"useLocation() may be used only in the context of a <Router> component."),w.useContext(Xd).location}var hj="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function fj(e){w.useContext(ar).static||w.useLayoutEffect(e)}function Mm(){let{isDataRoute:e}=w.useContext(Ts);return e?gH():rH()}function rH(){Wt(Xc(),"useNavigate() may be used only in the context of a <Router> component.");let e=w.useContext(Yc),{basename:t,navigator:n}=w.useContext(ar),{matches:i}=w.useContext(Ts),{pathname:s}=Nr(),a=JSON.stringify(Z0(i)),l=w.useRef(!1);return fj(()=>{l.current=!0}),w.useCallback((f,h={})=>{if(Er(l.current,hj),!l.current)return;if(typeof f=="number"){n.go(f);return}let g=jm(f,JSON.parse(a),s,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:Lr([t,g.pathname])),X0(typeof f=="string"?f:dl(f),n.createHref(g),Y0(n),"reject"),(h.replace?n.replace:n.push)(g,h.state,h)},[t,n,a,s,e])}w.createContext(null);function Qd(e,{relative:t}={}){let{matches:n}=w.useContext(Ts),{pathname:i}=Nr(),s=JSON.stringify(Z0(n));return w.useMemo(()=>jm(e,JSON.parse(s),i,t==="path"),[e,s,i,t])}function sH(e,t){return pj(e,t)}function pj(e,t,n){Wt(Xc(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:i}=w.useContext(ar),{matches:s}=w.useContext(Ts),a=s[s.length-1],l=a?a.params:{},u=a?a.pathname:"/",f=a?a.pathnameBase:"/",h=a&&a.route;{let C=h&&h.path||"";gj(u,!h||C.endsWith("*")||C.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${C}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
51
-
52
- Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let g=Nr(),m;if(t){let C=typeof t=="string"?Zc(t):t;Wt(f==="/"||C.pathname?.startsWith(f),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${f}" but pathname "${C.pathname}" was given in the \`location\` prop.`),m=C}else m=g;let _=m.pathname||"/",b=_;if(f!=="/"){let C=f.replace(/^\//,"").split("/");b="/"+_.replace(/^\//,"").split("/").slice(C.length).join("/")}let x=n&&n.state.matches.length?n.state.matches.map(C=>Object.assign(C,{route:n.manifest[C.route.id]||C.route})):ej(e,{pathname:b});Er(h||x!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),Er(x==null||x[x.length-1].route.element!==void 0||x[x.length-1].route.Component!==void 0||x[x.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let S=uH(x&&x.map(C=>Object.assign({},C,{params:Object.assign({},l,C.params),pathname:Lr([f,i.encodeLocation?i.encodeLocation(C.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?f:Lr([f,i.encodeLocation?i.encodeLocation(C.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),s,n);return t&&S?w.createElement(Xd.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...m},navigationType:"POP"}},S):S}function oH(){let e=mH(),t=q7(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:i},a={padding:"2px 4px",backgroundColor:i},l=null;return console.error("Error handled by React Router default ErrorBoundary:",e),l=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:a},"ErrorBoundary")," or"," ",w.createElement("code",{style:a},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},t),n?w.createElement("pre",{style:s},n):null,l)}var aH=w.createElement(oH,null),mj=class extends w.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const n=nH(e.digest);n&&(e=n)}let t=e!==void 0?w.createElement(Ts.Provider,{value:this.props.routeContext},w.createElement(Q0.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?w.createElement(lH,{error:e},t):t}};mj.contextType=cj;var s_=new WeakMap;function lH({children:e,error:t}){let{basename:n,navigator:i}=w.useContext(ar);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let s=tH(t.digest);if(s){let a=s_.get(t);if(a)throw a;let l=aj(s.location,n),u=l.absoluteURL||l.to;if(X0(s.location,u,Y0(i),"allow-explicit"),Z7(u))throw new Error("Invalid redirect location");if(oj&&!s_.get(t))if(l.isExternal||s.reloadDocument)window.location.href=u;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(l.to,{replace:s.replace}));throw s_.set(t,f),f}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}function cH({routeContext:e,match:t,children:n}){let i=w.useContext(Yc);return i&&i.static&&i.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=t.route.id),w.createElement(Ts.Provider,{value:e},n)}function uH(e,t=[],n){let i=n?.state;if(e==null){if(!i)return null;if(i.errors)e=i.matches;else if(t.length===0&&!i.initialized&&i.matches.length>0)e=i.matches;else return null}let s=e,a=i?.errors;if(a!=null){let g=s.findIndex(m=>m.route.id&&a?.[m.route.id]!==void 0);Wt(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),s=s.slice(0,Math.min(s.length,g+1))}let l=!1,u=-1;if(n&&i){l=i.renderFallback;for(let g=0;g<s.length;g++){let m=s[g];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(u=g),m.route.id){let{loaderData:_,errors:b}=i,x=m.route.loader&&!_.hasOwnProperty(m.route.id)&&(!b||b[m.route.id]===void 0);if(m.route.lazy||x){n.isStatic&&(l=!0),u>=0?s=s.slice(0,u+1):s=[s[0]];break}}}}let f=n?.onError,h=i&&f?(g,m)=>{f(g,{location:i.location,params:i.matches?.[0]?.params??{},pattern:W7(i.matches),errorInfo:m})}:void 0;return s.reduceRight((g,m,_)=>{let b,x=!1,S=null,C=null;i&&(b=a&&m.route.id?a[m.route.id]:void 0,S=m.route.errorElement||aH,l&&(u<0&&_===0?(gj("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),x=!0,C=null):u===_&&(x=!0,C=m.route.hydrateFallbackElement||null)));let k=t.concat(s.slice(0,_+1)),R=()=>{let N;return b?N=S:x?N=C:m.route.Component?N=w.createElement(m.route.Component,null):m.route.element?N=m.route.element:N=g,w.createElement(cH,{match:m,routeContext:{outlet:g,matches:k,isDataRoute:i!=null},children:N})};return i&&(m.route.ErrorBoundary||m.route.errorElement||_===0)?w.createElement(mj,{location:i.location,revalidation:i.revalidation,component:S,error:b,children:R(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:h}):R()},null)}function J0(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function dH(e){let t=w.useContext(Yc);return Wt(t,J0(e)),t}function hH(e){let t=w.useContext(zm);return Wt(t,J0(e)),t}function fH(e){let t=w.useContext(Ts);return Wt(t,J0(e)),t}function e1(e){let t=fH(e),n=t.matches[t.matches.length-1];return Wt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function pH(){return e1("useRouteId")}function mH(){let e=w.useContext(Q0),t=hH("useRouteError"),n=e1("useRouteError");return e!==void 0?e:t.errors?.[n]}function gH(){let{router:e}=dH("useNavigate"),t=e1("useNavigate"),n=w.useRef(!1);return fj(()=>{n.current=!0}),w.useCallback(async(s,a={})=>{Er(n.current,hj),n.current&&(typeof s=="number"?await e.navigate(s):await e.navigate(s,{fromRouteId:t,...a}))},[e,t])}var Q2={};function gj(e,t,n){!t&&!Q2[e]&&(Q2[e]=!0,Er(!1,n))}w.memo(vH);function vH({routes:e,manifest:t,future:n,state:i,isStatic:s,onError:a}){return pj(e,void 0,{manifest:t,state:i,isStatic:s,onError:a})}function Im({to:e,replace:t,state:n,relative:i}){Wt(Xc(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s,navigator:a}=w.useContext(ar);Er(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:l}=w.useContext(Ts),{pathname:u}=Nr(),f=Mm(),h=jm(e,Z0(l),u,i==="path");X0(typeof e=="string"?e:dl(e),a.createHref(h),Y0(a),"reject");let g=JSON.stringify(h);return w.useEffect(()=>{f(JSON.parse(g),{replace:t,state:n,relative:i})},[f,g,i,t,n]),null}function yd(e){Wt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function yH({basename:e="/",children:t=null,location:n,navigationType:i="POP",navigator:s,static:a=!1,useTransitions:l}){Wt(!Xc(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let u=e.replace(/^\/*/,"/"),f=w.useMemo(()=>({basename:u,navigator:s,static:a,useTransitions:l,future:{}}),[u,s,a,l]);typeof n=="string"&&(n=Zc(n));let{pathname:h="/",search:g="",hash:m="",state:_=null,key:b="default",mask:x}=n,S=w.useMemo(()=>{let C=oo(h,u);return C==null?null:{location:{pathname:C,search:g,hash:m,state:_,key:b,mask:x},navigationType:i}},[u,h,g,m,_,b,i,x]);return Er(S!=null,`<Router basename="${u}"> is not able to match the URL "${h}${g}${m}" because it does not start with the basename, so the <Router> won't render anything.`),S==null?null:w.createElement(ar.Provider,{value:f},w.createElement(Xd.Provider,{children:t,value:S}))}function _H({children:e,location:t}){return sH(Mb(e),t)}function Mb(e,t=[]){let n=[];return w.Children.forEach(e,(i,s)=>{if(!w.isValidElement(i))return;let a=[...t,s];if(i.type===w.Fragment){n.push.apply(n,Mb(i.props.children,a));return}Wt(i.type===yd,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Wt(!i.props.index||!i.props.children,"An index route cannot have child routes.");let l={id:i.props.id||a.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,middleware:i.props.middleware,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(l.children=Mb(i.props.children,a)),n.push(l)}),n}var Rp="get",Tp="application/x-www-form-urlencoded";function Pm(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function bH(e){return Pm(e)&&e.tagName.toLowerCase()==="button"}function xH(e){return Pm(e)&&e.tagName.toLowerCase()==="form"}function SH(e){return Pm(e)&&e.tagName.toLowerCase()==="input"}function wH(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function CH(e,t){return e.button===0&&(!t||t==="_self")&&!wH(e)}function Ib(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let i=e[n];return t.concat(Array.isArray(i)?i.map(s=>[n,s]):[[n,i]])},[]))}function kH(e,t){let n=Ib(e);return t&&t.forEach((i,s)=>{n.has(s)||t.getAll(s).forEach(a=>{n.append(s,a)})}),n}var Vf=null;function EH(){if(Vf===null)try{new FormData(document.createElement("form"),0),Vf=!1}catch{Vf=!0}return Vf}var NH=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function o_(e){return e!=null&&!NH.has(e)?(Er(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Tp}"`),null):e}function RH(e,t){let n,i,s,a,l;if(xH(e)){let u=e.getAttribute("action");i=u?oo(u,t):null,n=e.getAttribute("method")||Rp,s=o_(e.getAttribute("enctype"))||Tp,a=new FormData(e)}else if(bH(e)||SH(e)&&(e.type==="submit"||e.type==="image")){let u=e.form;if(u==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||u.getAttribute("action");if(i=f?oo(f,t):null,n=e.getAttribute("formmethod")||u.getAttribute("method")||Rp,s=o_(e.getAttribute("formenctype"))||o_(u.getAttribute("enctype"))||Tp,a=new FormData(u,e),!EH()){let{name:h,type:g,value:m}=e;if(g==="image"){let _=h?`${h}.`:"";a.append(`${_}x`,"0"),a.append(`${_}y`,"0")}else h&&a.append(h,m)}}else{if(Pm(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Rp,i=null,s=Tp,l=e}return a&&s==="text/plain"&&(l=a,a=void 0),{action:i,method:n.toLowerCase(),encType:s,formData:a,body:l}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function t1(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function vj(e,t,n,i){let s=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${i}`:s.pathname=`${s.pathname}.${i}`:s.pathname==="/"?s.pathname=`_root.${i}`:t&&oo(s.pathname,t)==="/"?s.pathname=`${Mc(t)}/_root.${i}`:s.pathname=`${Mc(s.pathname)}.${i}`,s}async function TH(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function DH(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function AH(e,t,n){let i=await Promise.all(e.map(async s=>{let a=t.routes[s.route.id];if(a){let l=await TH(a,n);return l.links?l.links():[]}return[]}));return MH(i.flat(1).filter(DH).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function J2(e,t,n,i,s,a){let l=(f,h)=>n[h]?f.route.id!==n[h].route.id:!0,u=(f,h)=>n[h].pathname!==f.pathname||n[h].route.path?.endsWith("*")&&n[h].params["*"]!==f.params["*"];return a==="assets"?t.filter((f,h)=>l(f,h)||u(f,h)):a==="data"?t.filter((f,h)=>{let g=i.routes[f.route.id];if(!g||!g.hasLoader)return!1;if(l(f,h)||u(f,h))return!0;if(f.route.shouldRevalidate){let m=f.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function OH(e,t,{includeHydrateFallback:n}={}){return jH(e.map(i=>{let s=t.routes[i.route.id];if(!s)return[];let a=[s.module];return s.clientActionModule&&(a=a.concat(s.clientActionModule)),s.clientLoaderModule&&(a=a.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(a=a.concat(s.hydrateFallbackModule)),s.imports&&(a=a.concat(s.imports)),a}).flat(1))}function jH(e){return[...new Set(e)]}function zH(e){let t={},n=Object.keys(e).sort();for(let i of n)t[i]=e[i];return t}function MH(e,t){let n=new Set;return new Set(t),e.reduce((i,s)=>{let a=JSON.stringify(zH(s));return n.has(a)||(n.add(a),i.push({key:a,link:s})),i},[])}function n1(){let e=w.useContext(Yc);return t1(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function IH(){let e=w.useContext(zm);return t1(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var i1=w.createContext(void 0);i1.displayName="FrameworkContext";function Lm(){let e=w.useContext(i1);return t1(e,"You must render this element inside a <HydratedRouter> element"),e}function PH(e,t){let n=w.useContext(i1),[i,s]=w.useState(!1),[a,l]=w.useState(!1),{onFocus:u,onBlur:f,onMouseEnter:h,onMouseLeave:g,onTouchStart:m}=t,_=w.useRef(null);w.useEffect(()=>{if(e==="render"&&l(!0),e==="viewport"){let S=k=>{k.forEach(R=>{l(R.isIntersecting)})},C=new IntersectionObserver(S,{threshold:.5});return _.current&&C.observe(_.current),()=>{C.disconnect()}}},[e]),w.useEffect(()=>{if(i){let S=setTimeout(()=>{l(!0)},100);return()=>{clearTimeout(S)}}},[i]);let b=()=>{s(!0)},x=()=>{s(!1),l(!1)};return n?e!=="intent"?[a,_,{}]:[a,_,{onFocus:id(u,b),onBlur:id(f,x),onMouseEnter:id(h,b),onMouseLeave:id(g,x),onTouchStart:id(m,b)}]:[!1,_,{}]}function id(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function LH({page:e,...t}){let n=Y7(),{nonce:i}=Lm(),{router:s}=n1(),a=w.useMemo(()=>ej(s.routes,e,s.basename),[s.routes,e,s.basename]);return a?(t.nonce==null&&i&&(t={...t,nonce:i}),n?w.createElement(FH,{page:e,matches:a,...t}):w.createElement(UH,{page:e,matches:a,...t})):null}function BH(e){let{manifest:t,routeModules:n}=Lm(),[i,s]=w.useState([]);return w.useEffect(()=>{let a=!1;return AH(e,t,n).then(l=>{a||s(l)}),()=>{a=!0}},[e,t,n]),i}function FH({page:e,matches:t,...n}){let i=Nr(),{future:s}=Lm(),{basename:a}=n1(),l=w.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let u=vj(e,a,s.v8_trailingSlashAwareDataRequests,"rsc"),f=!1,h=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?f=!0:h.push(g.route.id);return f&&h.length>0&&u.searchParams.set("_routes",h.join(",")),[u.pathname+u.search]},[a,s.v8_trailingSlashAwareDataRequests,e,i,t]);return w.createElement(w.Fragment,null,l.map(u=>w.createElement("link",{key:u,rel:"prefetch",as:"fetch",href:u,...n})))}function UH({page:e,matches:t,...n}){let i=Nr(),{future:s,manifest:a,routeModules:l}=Lm(),{basename:u}=n1(),{loaderData:f,matches:h}=IH(),g=w.useMemo(()=>J2(e,t,h,a,i,"data"),[e,t,h,a,i]),m=w.useMemo(()=>J2(e,t,h,a,i,"assets"),[e,t,h,a,i]),_=w.useMemo(()=>{if(e===i.pathname+i.search+i.hash)return[];let S=new Set,C=!1;if(t.forEach(R=>{let N=a.routes[R.route.id];!N||!N.hasLoader||(!g.some(A=>A.route.id===R.route.id)&&R.route.id in f&&l[R.route.id]?.shouldRevalidate||N.hasClientLoader?C=!0:S.add(R.route.id))}),S.size===0)return[];let k=vj(e,u,s.v8_trailingSlashAwareDataRequests,"data");return C&&S.size>0&&k.searchParams.set("_routes",t.filter(R=>S.has(R.route.id)).map(R=>R.route.id).join(",")),[k.pathname+k.search]},[u,s.v8_trailingSlashAwareDataRequests,f,i,a,g,t,e,l]),b=w.useMemo(()=>OH(m,a),[m,a]),x=BH(m);return w.createElement(w.Fragment,null,_.map(S=>w.createElement("link",{key:S,rel:"prefetch",as:"fetch",href:S,...n})),b.map(S=>w.createElement("link",{key:S,rel:"modulepreload",href:S,...n})),x.map(({key:S,link:C})=>w.createElement("link",{key:S,nonce:n.nonce,...C,crossOrigin:C.crossOrigin??n.crossOrigin})))}function HH(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var $H=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{$H&&(window.__reactRouterVersion="7.18.5")}catch{}function qH({basename:e,children:t,useTransitions:n,window:i}){let s=w.useRef();s.current==null&&(s.current=x7({window:i,v5Compat:!0}));let a=s.current,[l,u]=w.useState({action:a.action,location:a.location}),f=w.useCallback(h=>{n===!1?u(h):w.startTransition(()=>u(h))},[n]);return w.useLayoutEffect(()=>a.listen(f),[a,f]),w.createElement(yH,{basename:e,children:t,location:l.location,navigationType:l.action,navigator:a,useTransitions:n})}var Bm=w.forwardRef(function({onClick:t,discover:n="render",prefetch:i="none",relative:s,reloadDocument:a,replace:l,mask:u,state:f,target:h,to:g,preventScrollReset:m,viewTransition:_,defaultShouldRevalidate:b,...x},S){let{basename:C,navigator:k,useTransitions:R}=w.useContext(ar),N=typeof g=="string"&&G0.test(g),A=aj(g,C);g=A.to;let I=iH(g,{relative:s}),T=Nr(),D=null;if(u){let G=jm(u,[],T.mask?T.mask.pathname:"/",!0);C!=="/"&&(G.pathname=G.pathname==="/"?C:Lr([C,G.pathname])),D=k.createHref(G)}let[L,ee,U]=PH(i,x),F=GH(g,{replace:l,mask:u,state:f,target:h,preventScrollReset:m,relative:s,viewTransition:_,defaultShouldRevalidate:b,useTransitions:R});function B(G){t&&t(G),G.defaultPrevented||F(G)}let W=!(A.isExternal||a),te=w.createElement("a",{...x,...U,href:(W?D:void 0)||A.absoluteURL||I,onClick:W?B:t,ref:HH(S,ee),target:h,"data-discover":!N&&n==="render"?"true":void 0});return L&&!N?w.createElement(w.Fragment,null,te,w.createElement(LH,{page:I})):te});Bm.displayName="Link";var WH=w.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:i="",end:s=!1,style:a,to:l,viewTransition:u,children:f,...h},g){let m=Qd(l,{relative:h.relative}),_=Nr(),b=w.useContext(zm),{navigator:x,basename:S}=w.useContext(ar),C=b!=null&&e$(m)&&u===!0,k=x.encodeLocation?x.encodeLocation(m).pathname:m.pathname,R=_.pathname,N=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(R=R.toLowerCase(),N=N?N.toLowerCase():null,k=k.toLowerCase()),N&&S&&(N=oo(N,S)||N);const A=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let I=R===k||!s&&R.startsWith(k)&&R.charAt(A)==="/",T=N!=null&&(N===k||!s&&N.startsWith(k)&&N.charAt(k.length)==="/"),D={isActive:I,isPending:T,isTransitioning:C},L=I?t:void 0,ee;typeof i=="function"?ee=i(D):ee=[i,I?"active":null,T?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let U=typeof a=="function"?a(D):a;return w.createElement(Bm,{...h,"aria-current":L,className:ee,ref:g,style:U,to:l,viewTransition:u},typeof f=="function"?f(D):f)});WH.displayName="NavLink";var KH=w.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:i,replace:s,state:a,method:l=Rp,action:u,onSubmit:f,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:_,...b},x)=>{let{useTransitions:S}=w.useContext(ar),C=QH(),k=JH(u,{relative:h}),R=l.toLowerCase()==="get"?"get":"post",N=typeof u=="string"&&G0.test(u),A=I=>{if(f&&f(I),I.defaultPrevented)return;I.preventDefault();let T=I.nativeEvent.submitter,D=T?.getAttribute("formmethod")||l,L=()=>C(T||I.currentTarget,{fetcherKey:t,method:D,navigate:n,replace:s,state:a,relative:h,preventScrollReset:g,viewTransition:m,defaultShouldRevalidate:_});S&&n!==!1?w.startTransition(()=>L()):L()};return w.createElement("form",{ref:x,method:R,action:k,onSubmit:i?f:A,...b,"data-discover":!N&&e==="render"?"true":void 0})});KH.displayName="Form";function VH(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yj(e){let t=w.useContext(Yc);return Wt(t,VH(e)),t}function GH(e,{target:t,replace:n,mask:i,state:s,preventScrollReset:a,relative:l,viewTransition:u,defaultShouldRevalidate:f,useTransitions:h}={}){let g=Mm(),m=Nr(),_=Qd(e,{relative:l});return w.useCallback(b=>{if(CH(b,t)){b.preventDefault();let x=n!==void 0?n:dl(m)===dl(_),S=()=>g(e,{replace:x,mask:i,state:s,preventScrollReset:a,relative:l,viewTransition:u,defaultShouldRevalidate:f});h?w.startTransition(()=>S()):S()}},[m,g,_,n,i,s,t,e,a,l,u,f,h])}function ZH(e){Er(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=w.useRef(Ib(e)),n=w.useRef(!1),i=Nr(),s=w.useMemo(()=>kH(i.search,n.current?null:t.current),[i.search]),a=Mm(),l=w.useCallback((u,f)=>{const h=Ib(typeof u=="function"?u(new URLSearchParams(s)):u);n.current=!0,a("?"+h,f)},[a,s]);return[s,l]}var YH=0,XH=()=>`__${String(++YH)}__`;function QH(){let{router:e}=yj("useSubmit"),{basename:t}=w.useContext(ar),n=pH(),i=e.fetch,s=e.navigate;return w.useCallback(async(a,l={})=>{let{action:u,method:f,encType:h,formData:g,body:m}=RH(a,t);if(l.navigate===!1){let _=l.fetcherKey||XH();await i(_,n,l.action||u,{defaultShouldRevalidate:l.defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:g,body:m,formMethod:l.method||f,formEncType:l.encType||h,flushSync:l.flushSync})}else await s(l.action||u,{defaultShouldRevalidate:l.defaultShouldRevalidate,preventScrollReset:l.preventScrollReset,formData:g,body:m,formMethod:l.method||f,formEncType:l.encType||h,replace:l.replace,state:l.state,fromRouteId:n,flushSync:l.flushSync,viewTransition:l.viewTransition})},[i,s,t,n])}function JH(e,{relative:t}={}){let{basename:n}=w.useContext(ar),i=w.useContext(Ts);Wt(i,"useFormAction must be used inside a RouteContext");let[s]=i.matches.slice(-1),a={...Qd(e||".",{relative:t})},l=Nr();if(e==null){a.search=l.search;let u=new URLSearchParams(a.search),f=u.getAll("index");if(f.some(g=>g==="")){u.delete("index"),f.filter(m=>m).forEach(m=>u.append("index",m));let g=u.toString();a.search=g?`?${g}`:""}}return(!e||e===".")&&s.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(a.pathname=a.pathname==="/"?n:Lr([n,a.pathname])),dl(a)}function e$(e,{relative:t}={}){let n=w.useContext(uj);Wt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=yj("useViewTransitionState"),s=Qd(e,{relative:t});if(!n.isTransitioning)return!1;let a=oo(n.currentLocation.pathname,i)||n.currentLocation.pathname,l=oo(n.nextLocation.pathname,i)||n.nextLocation.pathname;return Xp(s.pathname,l)!=null||Xp(s.pathname,a)!=null}const t$=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function n$(e,t,n=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:t$(e),size:24,node:t,...n.length>0?{aliases:n}:{}}}const i$=e=>{let t="",n=!1;for(const i of e){if(i==="-"||i==="_"||i<=" "){n=t.length>0;continue}t.length===0?t+=i.toLowerCase():t+=n?i.toUpperCase():i,n=!1}return t};const r$=e=>{const t=i$(e);return t.charAt(0).toUpperCase()+t.slice(1)};const Pb=(...e)=>e.filter((t,n,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===n).join(" ").trim();const Wa={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function a_(e){return e!=null}function s$(e,t={}){const n=t.attributeNames??{},i=_=>n[_]??_,s=e.size??e.width??Wa.width,a=e.size??e.height??Wa.height,l=e.aliases?.filter(_=>typeof _=="string"&&_.trim()!=="").map(_=>`lucide-${_}`)??[],u=[...e.name?[`lucide-${e.name}`]:[],...l],f=t.className?.split(" ").filter(Boolean)??[],h=t.includeDefaultClasses===!1?Pb(...f):Pb("lucide",...u,...f),g=t.absoluteStrokeWidth?Number(t.strokeWidth??Wa["stroke-width"])*Number(e.size??e.width??Wa.width)/Number(t.size??t.width??Wa.width):t.strokeWidth??Wa["stroke-width"];return["svg",{...Object.entries(Wa).reduce((_,[b,x])=>(_[i(b)]=x,_),{}),..."color"in t&&t.color&&{[i("stroke")]:t.color},..."size"in t&&a_(t.size)&&{[i("width")]:t.size,[i("height")]:t.size},..."width"in t&&a_(t.width)&&{[i("width")]:t.width},..."height"in t&&a_(t.height)&&{[i("height")]:t.height},[i("stroke-width")]:g,...h&&{[i("class")]:h},[i("viewBox")]:`0 0 ${s} ${a}`,...t.hasA11yProp===!1?{[i("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(_=>{const[b,x,S]=_,C=t.nonScalingStroke?{[i("vector-effect")]:"non-scaling-stroke",...x}:x;return S?[b,C,S]:[b,C]})]}function o$(e,t={}){return s$(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}const a$=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},l$=w.createContext({}),c$=()=>w.useContext(l$),u$=w.forwardRef(({color:e,size:t,width:n,height:i,strokeWidth:s,absoluteStrokeWidth:a,nonScalingStroke:l,className:u="",children:f,iconNode:h=[],icon:g={node:h,aliases:[],size:24},...m},_)=>{const{size:b=24,strokeWidth:x=2,absoluteStrokeWidth:S=!1,nonScalingStroke:C=!1,color:k="currentColor",className:R=""}=c$()??{},N=!!f||a$(m),[A,I,T=[]]=o$(g,{color:e??k,width:n??t??b,height:i??t??b,strokeWidth:s??x,absoluteStrokeWidth:a??S,nonScalingStroke:l??C,className:Pb(R,u),hasA11yProp:N,attributes:m});return w.createElement(A,{ref:_,...I},[...T.map(([D,L])=>w.createElement(D,L)),...Array.isArray(f)?f:[f]])});function Oe(e,t=[],n=[]){const i=typeof e=="string"?n$(e,t,n):e,s=w.forwardRef(({className:a,...l},u)=>w.createElement(u$,{ref:u,icon:i,className:a,...l}));return i.name&&(s.displayName=r$(i.name)),s}const _j={name:"activity",size:24,node:[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]};_j.node;const d$=Oe(_j);const bj={name:"archive",size:24,node:[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]};bj.node;const h$=Oe(bj);const xj={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};xj.node;const Sj=Oe(xj);const wj={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};wj.node;const aa=Oe(wj);const Cj={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};Cj.node;const kj=Oe(Cj);const Ej={name:"arrow-up-right",size:24,node:[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]};Ej.node;const r1=Oe(Ej);const Nj={name:"arrow-up",size:24,node:[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]};Nj.node;const Rj=Oe(Nj);const Tj={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]};Tj.node;const f$=Oe(Tj);const Dj={name:"bug",size:24,node:[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]};Dj.node;const p$=Oe(Dj);const Aj={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};Aj.node;const Ic=Oe(Aj);const Oj={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};Oj.node;const Fm=Oe(Oj);const jj={name:"chevron-left",size:24,node:[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]};jj.node;const Qp=Oe(jj);const zj={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};zj.node;const Hr=Oe(zj);const Mj={name:"chevron-up",size:24,node:[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]};Mj.node;const m$=Oe(Mj);const Ij={name:"circle",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]};Ij.node;const g$=Oe(Ij);const Pj={name:"clock-3",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6h4",key:"135r8i"}]]};Pj.node;const v$=Oe(Pj);const Lj={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};Lj.node;const eN=Oe(Lj);const Bj={name:"code-xml",size:24,node:[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],aliases:["code-2"]};Bj.node;const y$=Oe(Bj);const Fj={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};Fj.node;const _$=Oe(Fj);const Uj={name:"earth",size:24,node:[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aliases:["globe-2"]};Uj.node;const Jd=Oe(Uj);const Hj={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};Hj.node;const $j=Oe(Hj);const qj={name:"external-link",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]};qj.node;const Wj=Oe(qj);const Kj={name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]};Kj.node;const b$=Oe(Kj);const Vj={name:"eye",size:24,node:[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};Vj.node;const x$=Oe(Vj);const Gj={name:"file-code-corner",size:24,node:[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],aliases:["file-code-2"]};Gj.node;const s1=Oe(Gj);const Zj={name:"file-text",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]};Zj.node;const Yj=Oe(Zj);const Xj={name:"files",size:24,node:[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]};Xj.node;const S$=Oe(Xj);const Qj={name:"folder-plus",size:24,node:[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};Qj.node;const Jj=Oe(Qj);const ez={name:"folder-search",size:24,node:[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]};ez.node;const w$=Oe(ez);const tz={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};tz.node;const Um=Oe(tz);const nz={name:"git-branch",size:24,node:[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]};nz.node;const iz=Oe(nz);const rz={name:"git-compare",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]};rz.node;const o1=Oe(rz);const sz={name:"house",size:24,node:[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],aliases:["home"]};sz.node;const C$=Oe(sz);const oz={name:"key-round",size:24,node:[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]};oz.node;const k$=Oe(oz);const az={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};az.node;const Ss=Oe(az);const lz={name:"log-out",size:24,node:[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]};lz.node;const E$=Oe(lz);const cz={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};cz.node;const N$=Oe(cz);const uz={name:"minimize-2",size:24,node:[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]};uz.node;const R$=Oe(uz);const dz={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};dz.node;const hz=Oe(dz);const fz={name:"monitor",size:24,node:[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]};fz.node;const tN=Oe(fz);const pz={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};pz.node;const nN=Oe(pz);const mz={name:"panel-left",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],aliases:["sidebar"]};mz.node;const T$=Oe(mz);const gz={name:"panel-right",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]};gz.node;const D$=Oe(gz);const vz={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};vz.node;const A$=Oe(vz);const yz={name:"pin-off",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]};yz.node;const O$=Oe(yz);const _z={name:"pin",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]};_z.node;const j$=Oe(_z);const bz={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};bz.node;const xz=Oe(bz);const Sz={name:"plus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]};Sz.node;const $r=Oe(Sz);const wz={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};wz.node;const xl=Oe(wz);const Cz={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};Cz.node;const z$=Oe(Cz);const kz={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};kz.node;const M$=Oe(kz);const Ez={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};Ez.node;const Pc=Oe(Ez);const Nz={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};Nz.node;const I$=Oe(Nz);const Rz={name:"shield-alert",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]};Rz.node;const iN=Oe(Rz);const Tz={name:"shield-check",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};Tz.node;const Hm=Oe(Tz);const Dz={name:"shield",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]};Dz.node;const P$=Oe(Dz);const Az={name:"sparkles",size:24,node:[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],aliases:["stars"]};Az.node;const L$=Oe(Az);const Oz={name:"square-terminal",size:24,node:[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],aliases:["terminal-square"]};Oz.node;const Lc=Oe(Oz);const jz={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};jz.node;const a1=Oe(jz);const zz={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};zz.node;const rN=Oe(zz);const Mz={name:"terminal",size:24,node:[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]};Mz.node;const B$=Oe(Mz);const Iz={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};Iz.node;const $m=Oe(Iz);const Pz={name:"undo-2",size:24,node:[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]};Pz.node;const F$=Oe(Pz);const Lz={name:"wand-sparkles",size:24,node:[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],aliases:["wand-2"]};Lz.node;const U$=Oe(Lz);const Bz={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};Bz.node;const pa=Oe(Bz);const Fz={name:"zap",size:24,node:[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]]};Fz.node;const H$=Oe(Fz),Bc=!1;function Lb(e){const t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,s])=>t.indexOf(+i)===-1).map(([i,s])=>s)}function sN(e,t="|"){return e.map(n=>Wz(n)).join(t)}function Bb(e,t){return typeof t=="bigint"?t.toString():t}class $${constructor(t){this._getter=t,this._value=void 0}get value(){const t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}}function qm(e){return new $$(e)}function q$(e){return e==null}function l1(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function W$(e,t){const n=e/t,i=Math.round(n),s=4*Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-i)<s?0:n-i}function ma(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function c1(e){const t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ao(e){return c1(e._zod.def)??e._zod.def.shape}function Uz(e,t,n){Object.defineProperty(e,t,{get(){const i=n();return ma(this,t,i),i},enumerable:!0,configurable:!0})}function Hz(e,t,n){t in e?ma(e,t,n):e[t]=n}function hl(e,t,n,i){const s=ao(t);for(const a of n){const l=Object.getOwnPropertyDescriptor(s,a);l.enumerable&&(l.get?Uz(e,a,()=>{const u=t._zod.def.shape[a];return i?i(u,a):u}):Hz(e,a,i?i(l.value,a):l.value))}}function K$(e,t){for(const n of Reflect.ownKeys(t)){const i=Object.getOwnPropertyDescriptor(t,n);i.enumerable&&(i.get?Uz(e,n,()=>t[n]):Hz(e,n,i.value))}}function ir(...e){const t={};for(const n of e){const i=Object.getOwnPropertyDescriptors(n);Object.assign(t,i)}return Object.defineProperties({},t)}function V$(e){return JSON.stringify(e)}function G$(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const $z="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Fd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const Z$=qm(()=>{if(ws.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Ud(e){if(Fd(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Fd(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function qz(e){return Ud(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Y$=new Set(["string","number","symbol"]);function Fc(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ga(e,t,n){const i=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(i._zod.parent=e),i}function ze(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Wz(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function X$(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}const Kz={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Q$={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function J$(e,t){const n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const a={};return hl(a,e,Wm(e,t)),ga(e,ir(n,{shape:a,checks:[]}))}function Wm(e,t){const n=ao(e),i=[];for(const s of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,s)?.enumerable)throw new Error(`Unrecognized key: "${String(s)}"`);t[s]&&i.push(s)}return i}function eq(e,t){const n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const a=new Set(Wm(e,t)),l={};return hl(l,e,Reflect.ownKeys(ao(e)).filter(u=>!a.has(u))),ga(e,ir(n,{shape:l,checks:[]}))}function tq(e,t){if(!Ud(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=ao(e);for(const a of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(s,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ga(e,ir(e._zod.def,{shape:Vz(e,t)}))}function Vz(e,t){const n={};return hl(n,e,Reflect.ownKeys(ao(e))),K$(n,t),n}function nq(e,t){if(!Ud(t))throw new Error("Invalid input to safeExtend: expected a plain object");return ga(e,ir(e._zod.def,{shape:Vz(e,t)}))}function iq(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n={};hl(n,e,Reflect.ownKeys(ao(e))),hl(n,t,Reflect.ownKeys(ao(t)));const i=ir(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ga(e,i)}function oN(e,t,n,i="partial"){const a=t._zod.def.checks;if(a&&a.length>0)throw new Error(`.${i}() cannot be used on object schemas containing refinements`);const u=n?new Set(Wm(t,n)):void 0,f={};return hl(f,t,Reflect.ownKeys(ao(t)),e&&((h,g)=>u&&!u.has(g)?h:new e({type:"optional",innerType:h}))),ga(t,ir(t._zod.def,{shape:f,checks:[]}))}function rq(e,t,n){const i=n?new Set(Wm(t,n)):void 0,s={};return hl(s,t,Reflect.ownKeys(ao(t)),(a,l)=>i&&!i.has(l)?a:new e({type:"nonoptional",innerType:a})),ga(t,ir(t._zod.def,{shape:s}))}function Qs(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function sq(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Gz(e,t){return t.map(n=>{var i;return(i=n).path??(i.path=[]),n.path.unshift(e),n})}function rd(e){return typeof e=="string"?e:e?.message}function aN(e){const t=[];for(const n of e??[]){const i=n._zod.def;if(!/_(length|size)$|_equals$/.test(i.check))break;const s=i.maximum??i.length??i.size;s>=0&&t.push([s,n])}return t}function Fb(e,t,n){var i;for(let s=t;s<e.length;s++)(i=e[s]).schema??(i.schema=n)}function Qc(e,t,n){var i;const s=e.inst?._zod?.traits;s?.has("$ZodType")&&(s.has("$ZodCheck")?(i=e).schema??(i.schema=e.inst):e.schema=e.inst);const a=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,l=e.message?e.message:rd(e.inst?._zod.def?.error?.(e))??rd(a?.(e))??rd(t?.error?.(e))??rd(n.customError?.(e))??rd(n.localeError?.(e))??"Invalid input",u={};for(const f of Object.keys(e))f==="inst"||f==="schema"||f==="continue"||f==="input"||f==="__proto__"||(u[f]=e[f]);return u.path??(u.path=[]),u.message=l,t?.reportInput&&(u.input=e.input),u}const oq=/[\uD800-\uDBFF]/;function u1(e){const t=e.length;if(!oq.test(e))return t;let n=t;for(let i=0;i<t-1;i++)(e.charCodeAt(i)&64512)===55296&&(e.charCodeAt(i+1)&64512)===56320&&(n--,i++);return n}function d1(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function aq(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";const n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Hd(...e){const[t,n,i]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:i}:{...t}}function lq(e,t){for(const n in t){const i=Object.getOwnPropertyDescriptor(t,n);i.get?Object.defineProperty(e,n,{...i,enumerable:!1}):cq(e,n,i.value)}}function la(e,t,n,i=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:i,value:n}),n}function Zz(e,t,n){return la(e,t,n,!1)}function Yz(e,t){for(const n in e){const i=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return la(this,n,i(this))},set(s){la(this,n,s)}})}return t}function cq(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:la(this,t,n.bind(this))},set(i){la(this,t,i)}})}function uq(e,t){const n=Object.getPrototypeOf(e);return t in n?void 0:n}let l_,Yo=!1;const dq={configurable:!0,get(){Yo=!0}};function yt(e,t,n){const i=Object.getPrototypeOf(e._zod);if(t in i&&l_!==e._zod){l_=void 0;return}l_=e._zod,Object.defineProperty(i,t,{configurable:!0,get(){Object.defineProperty(this,t,dq);const s=Yo;Yo=!1;try{const a=n(this);return Yo?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:a}),Yo=Yo||s,a}catch(a){throw delete this[t],Yo=Yo||s,a}},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s})}})}function hq(e,t,n,i){const s=uq(e,t);s&&Object.defineProperty(s,t,{configurable:!0,get(){const a={configurable:!0,writable:!0,enumerable:i,value:void 0};return Object.defineProperty(this,t,a),a.value=n(this),Object.defineProperty(this,t,a),a.value},set(a){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:i,value:a})}})}const fq="~constantCatch";function pq(e){const t=()=>e;return t[fq]=!0,t}var lN;const c_={value:void 0,enumerable:!1};let cN="captureStackTrace"in Error?Error:null;function mq(e){const t=cN;if(t){const n=t.stackTraceLimit;if(typeof n=="number"){try{t.stackTraceLimit=0}catch{return cN=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function de(e,t,n,i){const s={};function a(_){this.def=_,this.constr=m,this.traits=new Set}a.prototype=s;const l=n,u=l&&new WeakSet;function f(_,b){if(_._zod){if(_._zod.traits.has(e))return}else{c_.value=new a(b);try{Object.defineProperty(_,"_zod",c_)}finally{c_.value=void 0}}if(_._zod.traits.add(e),t(_,b),u){const S=Object.getPrototypeOf(_),C=_._zod.constr.prototype;let k=S;for(;k&&k!==C;)k=Object.getPrototypeOf(k);const R=k??S;u.has(R)||(u.add(R),lq(R,l))}const x=m.prototype;for(const S in x)Object.prototype.hasOwnProperty.call(x,S)&&(S in _||(_[S]=x[S].bind(_)))}const h=i?.Parent??Object;class g extends h{}Object.defineProperty(g,"name",{value:e});function m(_){const b=i?.Parent?mq(g):this;f(b,_);const x=b._zod.deferred;if(x){for(const C of x)C();b._zod.deferred=void 0}const S=globalThis.__zod_globalConfig?.postProcessor;return S&&S(b),b}return Object.defineProperty(m,"init",{value:f}),Object.defineProperty(m,Symbol.hasInstance,{value:_=>i?.Parent&&_ instanceof i.Parent?!0:_?._zod?.traits?.has(e)}),Object.defineProperty(m,"name",{value:e}),m}class nl extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Xz extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(lN=globalThis).__zod_globalConfig??(lN.__zod_globalConfig={});const ws=globalThis.__zod_globalConfig;function va(e){return e&&Object.assign(ws,e),ws}function gq(){const e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Bb,2)),e.message}function vq(e){this._zod.message=e}const yq={get:gq,set:vq,enumerable:!0,configurable:!0},u_={value:void 0,enumerable:!1},uN=new WeakSet([Object.prototype,Error.prototype]),_q=(e,t)=>{e.name="$ZodError",u_.value=t,Object.defineProperty(e,"issues",u_),u_.value=void 0,Object.defineProperty(e,"message",yq);const n=Object.getPrototypeOf(e);uN.has(n)||(uN.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){const i=()=>this.message;return Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,"toString",{value:i,configurable:!0,writable:!0})}}))},bq=de("$ZodError",_q);function xq(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t==="__proto__"?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Sq(e,t=n=>n.message){const n={},i=[];for(const s of e.issues)s.path.length>0?xq(n,s.path[0],()=>[]).push(t(s)):i.push(t(s));return{formErrors:i,fieldErrors:n}}function wq(e,t=n=>n.message){const n={_errors:[]},i=(s,a=[])=>{for(const l of s.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>i({issues:u},[...a,...l.path]));else if(l.code==="invalid_key")i({issues:l.issues},[...a,...l.path]);else if(l.code==="invalid_element")i({issues:l.issues},[...a,...l.path]);else{const u=[...a,...l.path];if(u.length===0)n._errors.push(t(l));else{let f=n,h=0;for(;h<u.length;){const g=u[h],m=h===u.length-1;if(g==="_errors"){m&&f._errors.push(t(l)),h++;continue}Object.prototype.hasOwnProperty.call(f,g)||Object.defineProperty(f,g,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});const _=f[g];m&&_._errors.push(t(l)),f=_,h++}}}};return i(e),n}function Km(e,t){return{callee:t?.callee??e,Err:t?.Err}}const h1=e=>{const t=(n,i,s,a)=>{const l=s?{...s,async:!1}:{async:!1},u=n._zod.run({value:i,issues:[]},l);if(u instanceof Promise)throw new nl;if(u.issues.length){const f=new(a?.Err??e)(u.issues.map(h=>Qc(h,l,va())));throw $z(f,a?.callee??t),f}return u.value};return t},f1=e=>{const t=async(n,i,s,a)=>{const l=s?{...s,async:!0}:{async:!0};let u=n._zod.run({value:i,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const f=new(a?.Err??e)(u.issues.map(h=>Qc(h,l,va())));throw $z(f,a?.callee??t),f}return u.value};return t},p1=e=>(t,n,i)=>{const s=i?{...i,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new nl;return a.issues.length?Qz(e,a.issues,s):{success:!0,data:a.value}};function Qz(e,t,n){let i;return{success:!1,get error(){return i||(i=new e(t.map(s=>Qc(s,n,va()))),t=void 0,n=void 0),i},set error(s){i=s,t=void 0,n=void 0}}}const m1=e=>async(t,n,i)=>{const s=i?{...i,async:!0}:{async:!0};let a=t._zod.run({value:n,issues:[]},s);return a instanceof Promise&&(a=await a),a.issues.length?Qz(e,a.issues,s):{success:!0,data:a.value}},Cq=Symbol.for("zod.compile.invalid"),kq=Symbol.for("zod.compile.fallback"),Eq=((e,t,n)=>{const i=e._zod.bag.validator;if(i!==void 0){if(i(t)!==Cq)return!0;if(i.definite===!0&&n===void 0)return!1}return Nq(e,t,n)});function Nq(e,t,n){const i=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},s=e._zod.bag.fallbackRun;let a;if(s?(i[kq]=!0,a=s({value:t,issues:[]},i)):a=e._zod.run({value:t,issues:[]},i),a instanceof Promise)throw new nl;return a.issues.length===0}const Rq=async(e,t,n)=>{const i=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0};let s=e._zod.run({value:t,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length===0},Tq=e=>{const t=h1(e),n=(i,s,a,l)=>{const u=a?{...a,direction:"backward"}:{direction:"backward"};return t(i,s,u,Km(n,l))};return n},Dq=e=>{const t=h1(e),n=(i,s,a,l)=>t(i,s,a,Km(n,l));return n},Aq=e=>{const t=f1(e),n=async(i,s,a,l)=>{const u=a?{...a,direction:"backward"}:{direction:"backward"};return await t(i,s,u,Km(n,l))};return n},Oq=e=>{const t=f1(e),n=async(i,s,a,l)=>await t(i,s,a,Km(n,l));return n},jq=e=>(t,n,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return p1(e)(t,n,s)},zq=e=>(t,n,i)=>p1(e)(t,n,i),Mq=e=>async(t,n,i)=>{const s=i?{...i,direction:"backward"}:{direction:"backward"};return m1(e)(t,n,s)},Iq=e=>async(t,n,i)=>m1(e)(t,n,i),Pq=/^[cC][0-9a-z]{6,}$/,Lq=/^[0-9a-z]+$/,Bq=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Fq=/^[0-9a-vA-V]{20}$/,Uq=/^[A-Za-z0-9]{27}$/,Hq=/^[a-zA-Z0-9_-]{21}$/;function $q(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const qq=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Wq=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,dN=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Kq=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Vq="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Gq(){return new RegExp(Vq,"u")}const Zq=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Yq=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Xq=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Qq=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Jq=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,eW=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,tW=/^https?$/,nW=/^\+[1-9]\d{6,14}$/,Jz="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";function iW(e){return new RegExp(`^${e}$`)}const rW=iW(Jz);function Ub(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function sW(e){return new RegExp(`^${Ub(e)}$`)}function oW(e){const t=["Z"];e.offset&&t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${Ub({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,i=e.local?`${n}|${Ub({precision:e.precision})}`:n;return new RegExp(`^${Jz}T(?:${i})$`)}const aW=/^[\s\S]{0,}$/,lW=/^-?\d+(?:\.\d+)?$/,cW=/^(?:true|false)$/i,uW=/^[^A-Z]*$/,dW=/^[^a-z]*$/,Pi=de("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),g1=e=>{const t=e.value;return!q$(t)&&t.length!==void 0},Jp={number:"number",bigint:"bigint",object:"date"},eM=de("$ZodCheckLessThan",(e,t)=>{Pi.init(e,t);const n=Jp[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value<=t.value:i.value<t.value)||i.issues.push({origin:Jp[typeof i.value]??n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),tM=de("$ZodCheckGreaterThan",(e,t)=>{Pi.init(e,t);const n=Jp[typeof t.value];e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:Jp[typeof i.value]??n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),hW=de("$ZodCheckMultipleOf",(e,t)=>{Pi.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):W$(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),fW=de("$ZodCheckNumberFormat",(e,t)=>{Pi.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),i=n?"int":"number",[s,a]=Kz[t.format];e._zod.check=l=>{const u=l.value;if(n){if(!Number.isInteger(u)){l.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?l.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort}):l.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,inclusive:!0,continue:!t.abort});return}}u<s&&l.issues.push({origin:"number",input:u,code:"too_small",minimum:s,inclusive:!0,inst:e,continue:!t.abort}),u>a&&l.issues.push({origin:"number",input:u,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),pW=de("$ZodCheckMaxLength",(e,t)=>{var n;Pi.init(e,t),(n=e._zod.def).when??(n.when=g1),e._zod.check=i=>{const s=i.value,a=s.length;if((typeof s=="string"&&a>t.maximum?u1(s):a)<=t.maximum)return;const u=d1(s);i.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),mW=de("$ZodCheckMinLength",(e,t)=>{var n;Pi.init(e,t),(n=e._zod.def).when??(n.when=g1),e._zod.check=i=>{const s=i.value,a=s.length;if((typeof s=="string"&&a>=t.minimum&&a<t.minimum*2?u1(s):a)>=t.minimum)return;const u=d1(s);i.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),gW=de("$ZodCheckLengthEquals",(e,t)=>{var n;Pi.init(e,t),(n=e._zod.def).when??(n.when=g1),e._zod.check=i=>{const s=i.value,a=s.length,l=typeof s=="string"&&a>=t.length&&a<=t.length*2?u1(s):a;if(l===t.length)return;const u=d1(s),f=l>t.length;i.issues.push({origin:u,...f?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),Vm=de("$ZodCheckStringFormat",(e,t)=>{var n,i;Pi.init(e,t),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),vW=de("$ZodCheckRegex",(e,t)=>{Vm.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),yW=de("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=uW),Vm.init(e,t)}),_W=de("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=dW),Vm.init(e,t)}),bW=de("$ZodCheckIncludes",(e,t)=>{Pi.init(e,t);const n=Fc(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position},}${n}`:n);t.pattern=i,e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),xW=de("$ZodCheckStartsWith",(e,t)=>{Pi.init(e,t);const n=new RegExp(`^${Fc(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),SW=de("$ZodCheckEndsWith",(e,t)=>{Pi.init(e,t);const n=new RegExp(`.*${Fc(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}}),wW=de("$ZodCheckOverwrite",(e,t)=>{Pi.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class CW{constructor(t=[],n={}){this.content=[],this.indent=0,this.args=t,this.closed=n}indented(t){this.indent+=1;try{t(this)}finally{this.indent-=1}}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const i=t.split(`
53
- `).filter(l=>l),s=Math.min(...i.map(l=>l.length-l.trimStart().length)),a=i.map(l=>l.slice(s)).map(l=>" ".repeat(this.indent*2)+l);for(const l of a)this.content.push(l)}compile(){const t=Function,n=this?.content??[""];return new t(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
54
- ${n.join(`
55
- `)}
56
- };`)(...Object.values(this.closed))}}const kW={major:4,minor:6,patch:7},sn=de("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=kW;const i=e._zod.def.checks,s=e._zod.traits.has("$ZodCheck")?[e,...i??[]]:i?.length?[...i]:[];for(const a of s)for(const l of a._zod.onattach)l(e);if(s.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const a=(u,f,h)=>{if(u.memo)return u;let g=Qs(u),m;for(const _ of f){if(_._zod.def.when){if(sq(u)||!_._zod.def.when(u))continue}else if(g)continue;const b=u.issues.length,x=_._zod.check(u);if(x instanceof Promise&&h?.async===!1)throw new nl;if(m||x instanceof Promise)m=(m??Promise.resolve()).then(async()=>{await x,u.issues.length!==b&&(Fb(u.issues,b,e),g||(g=Qs(u,b)))});else{if(u.issues.length===b)continue;Fb(u.issues,b,e),g||(g=Qs(u,b))}}return m?m.then(()=>u):u},l=(u,f,h)=>{if(Qs(u))return u.aborted=!0,u;const g=a(f,s,h);if(g instanceof Promise){if(h.async===!1)throw new nl;return g.then(m=>e._zod.parse(m,h))}return e._zod.parse(g,h)};e._zod.run=(u,f)=>{if(f.skipChecks)return e._zod.parse(u,f);if(f.direction==="backward"){const g=e._zod.parse({value:u.value,issues:[]},{...f,skipChecks:!0});return g instanceof Promise?g.then(m=>l(m,u,f)):l(g,u,f)}const h=e._zod.parse(u,f);if(h instanceof Promise){if(f.async===!1)throw new nl;return h.then(g=>a(g,s,f))}return a(h,s,f)}}},{get"~standard"(){return Zz(this,"~standard",iM(this))},set"~standard"(e){la(this,"~standard",e)}}),nM=(e,t)=>e.issues.length?{issues:e.issues.map(n=>Qc(n,t,va()))}:{value:e.value};async function EW(e,t){const n={async:!0};return nM(await e._zod.run({value:t,issues:[]},n),n)}function iM(e){return{validate:t=>{const n={async:!1};try{const i=e._zod.run({value:t,issues:[]},n);if(!(i instanceof Promise))return nM(i,n)}catch{}return EW(e,t)},vendor:"zod",version:1}}const v1=de("$ZodString",(e,t)=>{sn.init(e,t),e._zod.pattern=t.pattern??aW,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Gt=de("$ZodStringFormat",(e,t)=>{Vm.init(e,t),v1.init(e,t)}),NW=de("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Wq),Gt.init(e,t)}),RW=de("$ZodUUID",(e,t)=>{if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=dN(i))}else t.pattern??(t.pattern=dN());Gt.init(e,t)}),TW=de("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Kq),Gt.init(e,t)}),rM=1,em=2;function sM(e){try{return typeof URL<"u"&&typeof URL.canParse=="function"?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function DW(e,t){return!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t)?sM(e)||em:AW(e,t)}function AW(e,t){if(!t.normalize&&t.protocol?.source===tW.source&&!/^https?:\/\//i.test(e))return rM;try{if(typeof URL<"u"){const n=URL;if(typeof n.parse=="function")return n.parse(e)??em}return new URL(e)}catch{return em}}const OW=/[\t\n\r]/g;function hN(e){return e.replace(OW,"")}function jW(e,t){return t.lastIndex=0,t.test(e.hostname)}function zW(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}const MW=de("$ZodURL",(e,t)=>{Gt.init(e,t),e._zod.check=n=>{try{const i=n.value.trim(),s=DW(i,t);if(s===rM){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(s===em){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(s===!0){n.value=hN(i);return}t.hostname&&!jW(s,t.hostname)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!zW(s,t.protocol)&&n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?s.href:hN(i);return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),IW=de("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Gq()),Gt.init(e,t)}),PW=de("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw new Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?Hq:$q(t.length)),Gt.init(e,t)}),LW=de("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Pq),Gt.init(e,t)}),BW=de("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Lq),Gt.init(e,t)}),FW=de("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Bq),Gt.init(e,t)}),UW=de("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Fq),Gt.init(e,t)}),HW=de("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Uq),Gt.init(e,t)}),$W=de("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=oW(t)),Gt.init(e,t)}),qW=de("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=rW),Gt.init(e,t)}),WW=de("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=sW(t)),Gt.init(e,t)}),KW=de("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=qq),Gt.init(e,t)}),VW=de("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Zq),Gt.init(e,t)}),GW=/^[0-9a-fA-F:.]+$/;function oM(e){return GW.test(e)?sM(`http://[${e}]`):!1}const ZW=de("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Yq),Gt.init(e,t),e._zod.check=n=>{oM(n.value)||n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),YW=de("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Xq),Gt.init(e,t)});function XW(e){const t=e.split("/");if(t.length!==2)return!1;const[n,i]=t;if(!i)return!1;const s=Number(i);return`${s}`!==i||s<0||s>128?!1:oM(n)}const QW=de("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Qq),Gt.init(e,t),e._zod.check=n=>{XW(n.value)||n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function aM(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const lM=/^[0-9a-zA-Z+/]*={0,2}$/,JW=de("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=lM),Gt.init(e,t),e._zod.check=n=>{aM(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),y1=/^[A-Za-z0-9_-]*$/;function eK(e){if(!y1.test(e))return!1;const t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return aM(n)}const tK=de("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=y1),Gt.init(e,t),e._zod.check=n=>{eK(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),nK=de("$ZodE164",(e,t)=>{t.pattern??(t.pattern=nW),Gt.init(e,t)});function iK(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[i]=n;if(!i)return!1;const s=JSON.parse(atob(i));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const rK=de("$ZodJWT",(e,t)=>{Gt.init(e,t),e._zod.check=n=>{iK(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),cM=de("$ZodNumber",(e,t)=>{sn.init(e,t),e._zod.pattern=lW,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const a=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:String(s):void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...a?{received:a}:{}}),n}}),sK=de("$ZodNumberFormat",(e,t)=>{fW.init(e,t),cM.init(e,t)}),oK=de("$ZodBoolean",(e,t)=>{sn.init(e,t),e._zod.pattern=cW,e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),aK=de("$ZodUnknown",(e,t)=>{sn.init(e,t),e._zod.parse=n=>n}),lK=de("$ZodNever",(e,t)=>{sn.init(e,t),e._zod.parse=(n,i)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function cK(e,t){const n=aN(e._zod.def.checks);if(!n.length)return;const i=Math.min(...n.map(a=>a[0])),s=e._zod.parse;e._zod.parse=(a,l)=>{const u=t(a.value);if(u>i&&!l?.skipChecks&&l?.direction!=="backward"){for(const[f,h]of aN(e._zod.def.checks))if(u>f&&h._zod.def.when(a)){const g=a.issues.length;return h._zod.check(a),a.issues[g].continue=!1,Fb(a.issues,g,e),a}}return s(a,l)}}const uK=e=>Array.isArray(e)?e.length:-1;function fN(e,t,n){e.issues.length&&t.issues.push(...Gz(n,e.issues)),t.value[n]=e.value}const dK=de("$ZodArray",(e,t)=>{sn.init(e,t);const n=ws.memoizer;n?.attach(e),e._zod.parse=(i,s)=>{const a=i.value;if(!Array.isArray(a))return i.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),i;i.value=n?n.alloc(e,i,Array(a.length),s):Array(a.length);const l=[],u=s?.abortEarly;for(let f=0;f<a.length;f++){const h=a[f],g=t.element._zod.run({value:h,issues:[]},s);if(g instanceof Promise)l.push(g.then(m=>fN(m,i,f)));else if(fN(g,i,f),u&&g.issues.length!==0&&Qs(g))break}return l.length?Promise.all(l).then(()=>i):i},cK(e,uK)});function tm(e,t,n,i,s,a){const l=n in i,u=a==="optional";if(!(!l&&u&&s==="optional")){if(e.issues.length){if(s!==void 0&&u&&!l)return;t.issues.push(...Gz(n,e.issues))}if(!l&&s===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?(l||s==="defaulted"&&!u)&&(t.value[n]=void 0):t.value[n]=e.value}}const hK=[];function uM(e){const t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),i=n.length?n:hK,s=i.length?[...t,...i]:t;for(const l of s)if(!e.shape?.[l]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(l)}": expected a Zod schema`);const a=X$(e.shape);return{...e,allKeys:s,symbolKeys:i,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function dM(e,t,n,i,s,a,l){const u=[],f=s.keySet,h=s.catchall._zod,g=h.def.type,m=h.optin,_=h.optout;let b=0;for(const x in t){if(l&&n.issues.length!==b){if(Qs(n,b))break;b=n.issues.length}if(f.has(x))continue;if(x==="__proto__"){g==="never"&&u.push(x);continue}if(g==="never"){u.push(x);continue}const S=h.run({value:t[x],issues:[]},i);S instanceof Promise?e.push(S.then(C=>tm(C,n,x,t,m,_))):tm(S,n,x,t,m,_)}return u.length&&n.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const fK=de("$ZodObject",(e,t)=>{sn.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape"),i=n?.get?n.get.raw:t.shape??{};if(i){const h=()=>{const g={...i};return Object.defineProperty(t,"shape",{value:g}),h.raw=g,g};h.raw=i,Object.defineProperty(t,"shape",{get:h})}const s=qm(()=>uM(t));yt(e,"propValues",h=>{const g=h.def.shape,m={};for(const _ in g){const b=g[_]._zod;if(b.values){Object.prototype.hasOwnProperty.call(m,_)||ma(m,_,new Set);for(const x of b.values)m[_].add(x);b.optin!==void 0&&m[_].add(void 0)}}return m});const a=Fd,l=t.catchall;let u;const f=ws.memoizer;f?.attach(e),e._zod.parse=(h,g)=>{u??(u=s.value);const m=h.value;if(!a(m))return h.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),h;h.value=f?f.alloc(e,h,{},g):{};const _=[],b=u.shape,x=g?.abortEarly;let S=h.issues.length;for(const C of u.allKeys){if(x&&h.issues.length!==S){if(Qs(h,S))break;S=h.issues.length}if(C==="__proto__")continue;const k=b[C],R=k._zod.optin,N=k._zod.optout,A=k._zod.run({value:m[C],issues:[]},g);A instanceof Promise?_.push(A.then(I=>tm(I,h,C,m,R,N))):tm(A,h,C,m,R,N)}return l?dM(_,m,h,g,s.value,e,x===!0):_.length?Promise.all(_).then(()=>h):h}}),pK=de("$ZodObjectJIT",(e,t)=>{fK.init(e,t);const n=e._zod.parse,i=qm(()=>uM(t)),s=ws.memoizer,a=b=>{const x=i.value,S=x.symbolKeys,C=new CW(["payload","ctx"],{shape:b,inst:e,memo:s,syms:S}),k=I=>`shape[${I}]._zod.run({ value: input[${I}], issues: [] }, ctx)`,R=(I,T)=>`
57
- let ${I}_ab = false;
58
- for (let i = 0; i < ${I}.issues.length; i++) {
59
- const iss = ${I}.issues[i];
60
- iss.path = iss.path ? [${T}, ...iss.path] : [${T}];
61
- payload.issues.push(iss);
62
- if (iss.continue !== true) ${I}_ab = true;
63
- }
64
- if (${I}_ab && ctx && ctx.abortEarly) {
65
- payload.value = newResult;
66
- return payload;
67
- }`;C.write("const input = payload.value;");const N=Object.create(null);let A=0;for(const I of x.allKeys)N[I]=`key_${A++}`;C.write(s?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(const I of x.allKeys){if(I==="__proto__")continue;const T=N[I],D=typeof I=="symbol"?`syms[${S.indexOf(I)}]`:V$(I),L=`${D} in input`,ee=b[I],U=ee?._zod?.optin,F=U!==void 0,B=ee?._zod?.optout==="optional";if(C.write(`const ${T} = ${k(D)};`),F&&B){const W=U==="optional"?`${T}_present`:`${T}.value !== undefined || ${T}_present`;C.write(`
68
- const ${T}_present = ${L};
69
- if (!${T}.issues.length || ${T}_present) {
70
- if (${T}.issues.length) {${R(T,D)}
71
- }
72
-
73
- if (${W}) {
74
- newResult[${D}] = ${T}.value;
75
- }
76
- }
77
-
78
- `)}else F?(C.write(`
79
- if (${T}.issues.length) {${R(T,D)}
80
- }
81
- `),U==="defaulted"?C.write(`newResult[${D}] = ${T}.value;`):C.write(`
82
- if (${T}.value !== undefined || ${L}) {
83
- newResult[${D}] = ${T}.value;
84
- }
85
- `)):C.write(`
86
- const ${T}_present = ${L};
87
- if (${T}.issues.length) {${R(T,D)}
88
- }
89
- if (!${T}_present && !${T}.issues.length) {
90
- payload.issues.push({
91
- code: "invalid_type",
92
- expected: "nonoptional",
93
- input: undefined,
94
- path: [${D}]
95
- });
96
- if (ctx && ctx.abortEarly) {
97
- payload.value = newResult;
98
- return payload;
99
- }
100
- }
101
-
102
- if (${T}_present) {
103
- newResult[${D}] = ${T}.value;
104
- }
105
-
106
- `)}return C.write("payload.value = newResult;"),C.write("return payload;"),C.compile()};let l;const u=Fd,f=!ws.jitless,g=f&&Z$.value,m=t.catchall;let _;e._zod.parse=(b,x)=>{_??(_=i.value);const S=b.value;return u(S)?f&&g&&x?.async===!1&&x.jitless!==!0?(l||(l=a(t.shape)),b=l(b,x),m?dM([],S,b,x,_,e,x?.abortEarly===!0):b):n(b,x):(b.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),b)}});function pN(e,t,n,i){for(const a of e)if(a.issues.length===0)return t.value=a.value,t;const s=e.filter(a=>!Qs(a));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(a=>a.issues.map(l=>Qc(l,i,va())))}),t)}const hM=de("$ZodUnion",(e,t)=>{sn.init(e,t),yt(e,"optin",i=>i.def.options.some(s=>s._zod.optin==="defaulted")?"defaulted":i.def.options.some(s=>s._zod.optin!==void 0)?"optional":void 0),yt(e,"optout",i=>i.def.options.some(s=>s._zod.optout==="optional")?"optional":void 0),yt(e,"values",i=>{if(i.def.options.every(s=>s._zod.values))return new Set(i.def.options.flatMap(s=>Array.from(s._zod.values)))}),yt(e,"pattern",i=>{if(i.def.options.every(s=>s._zod.pattern)){const s=i.def.options.map(a=>a._zod.pattern);return new RegExp(`^(${s.map(a=>l1(a.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(i,s)=>{if(n)return n(i,s);let a=!1;const l=[];for(const u of t.options){const f=u._zod.run({value:i.value,issues:[]},s);if(f instanceof Promise)l.push(f),a=!0;else{if(f.issues.length===0)return f;l.push(f)}}return a?Promise.all(l).then(u=>pN(u,i,e,s)):pN(l,i,e,s)}});function mK(e){const t=new Map;for(const n of e.options){const i=n._zod.propValues?.[e.discriminator];if(!i||i.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(const s of i)if(t.has(s)){if(s!==void 0)throw new Error(`Duplicate discriminator value "${String(s)}"`);t.set(s,null)}else t.set(s,n)}return t}const gK=de("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,hM.init(e,t);const n=e._zod.parse;yt(e,"propValues",s=>{const a={};let l=0;for(const u of s.def.options){const f=u._zod.propValues;if(!f||Object.keys(f).length===0)throw new Error(`Invalid discriminated union option at index "${s.def.options.indexOf(u)}"`);f[s.def.discriminator]?.has(void 0)&&l++;for(const[h,g]of Object.entries(f)){Object.prototype.hasOwnProperty.call(a,h)||ma(a,h,new Set);for(const m of g)a[h].add(m)}}return!s.def.unionFallback&&l>1&&a[s.def.discriminator]?.delete(void 0),a}),t.options.forEach((s,a)=>{const l=c1(s._zod.def);if(l&&!Object.prototype.hasOwnProperty.call(l,t.discriminator))throw new Error(`Invalid discriminated union option at index "${a}"`)});const i=qm(()=>mK(t));e._zod.parse=(s,a)=>{const l=s.value;if(!Fd(l))return s.issues.push({code:"invalid_type",expected:"object",input:l,inst:e}),s;const u=l?.[t.discriminator],f=i.value.get(u);return f&&(u!==void 0||a.direction!=="backward")?f._zod.run(s,a):t.unionFallback||a.direction==="backward"?n(s,a):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(i.value.keys()).filter(h=>i.value.get(h)!==null),input:l,path:[t.discriminator],inst:e}),s)}}),vK=de("$ZodIntersection",(e,t)=>{sn.init(e,t),e._zod.parse=(n,i)=>{const s=n.value,a=t.left._zod.run({value:s,issues:[]},i),l=t.right._zod.run({value:s,issues:[]},i);return a instanceof Promise||l instanceof Promise?Promise.all([a,l]).then(([f,h])=>mN(n,f,h)):mN(n,a,l)}});function Hb(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ud(e)&&Ud(t)){const n=Object.keys(t),i=Object.keys(e).filter(a=>n.indexOf(a)!==-1),s={...e,...t};Object.prototype.hasOwnProperty.call(s,"__proto__")&&delete s.__proto__;for(const a of i){if(a==="__proto__")continue;const l=Hb(e[a],t[a]);if(!l.valid)return{valid:!1,mergeErrorPath:[a,...l.mergeErrorPath]};s[a]=l.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const s=e[i],a=t[i],l=Hb(s,a);if(!l.valid)return{valid:!1,mergeErrorPath:[i,...l.mergeErrorPath]};n.push(l.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function mN(e,t,n){const i=new Map;let s;const a=new Map,l=(h,g)=>{let m;if(h.code==="unrecognized_keys"&&!h.path?.length)s??(s=h),m=h.keys;else if(h.code==="invalid_key"&&h.origin==="record"&&h.path?.length===1){const _=String(h.path[0]);a.has(_)||a.set(_,h),m=[_]}else return!1;for(const _ of m)i.has(_)||i.set(_,{}),i.get(_)[g]=!0;return!0};for(const h of t.issues)l(h,"l")||e.issues.push(h);for(const h of n.issues)l(h,"r")||e.issues.push(h);const u=[...i].filter(([,h])=>h.l&&h.r).map(([h])=>h);if(u.length){const h=s?u.filter(g=>s.keys.includes(g)):[];h.length&&e.issues.push({...s,keys:h});for(const g of u)!h.includes(g)&&a.has(g)&&e.issues.push(a.get(g))}const f=Hb(t.value,n.value);if(!f.valid){if(Qs(e))return e;throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(f.mergeErrorPath)}`)}return e.value=f.data,e}const yK=de("$ZodEnum",(e,t)=>{sn.init(e,t);const n=Lb(t.entries),i=new Set(n);e._zod.values=i,yt(e,"pattern",s=>{const a=Lb(s.def.entries).filter(l=>Y$.has(typeof l));return new RegExp(a.length?`^(${a.map(l=>Fc(l.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(s,a)=>{const l=s.value;return i.has(l)||s.issues.push({code:"invalid_value",values:n,input:l,inst:e}),s}}),_K=de("$ZodLiteral",(e,t)=>{sn.init(e,t);const n=new Set(t.values);e._zod.values=n,yt(e,"pattern",i=>{const s=i.def.values;return new RegExp(s.length?`^(${s.map(a=>typeof a=="string"?Fc(a):a?Fc(a.toString()):String(a)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(i,s)=>{const a=i.value;return n.has(a)||i.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),i}}),bK=de("$ZodTransform",(e,t)=>{sn.init(e,t),e._zod.optin="optional",ws.memoizer?.guard(e),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Xz(e.constructor.name);const s=t.transform(n.value,n);if(i.async)return(s instanceof Promise?s:Promise.resolve(s)).then(l=>(n.value=l,n));if(s instanceof Promise)throw new nl;return n.value=s,n}});function gN(e,t){return e.value=t.issues.length?void 0:t.value,e}const fM=de("$ZodOptional",(e,t)=>{sn.init(e,t),yt(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",yt(e,"values",n=>{const i=n.def.innerType._zod.values;return i?new Set([...i,void 0]):void 0}),yt(e,"pattern",n=>{const i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${l1(i.source)})?$`):void 0}),e._zod.parse=(n,i)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;const s=t.innerType._zod.run({value:n.value,issues:[]},i);return s instanceof Promise?s.then(a=>gN(n,a)):gN(n,s)}return t.innerType._zod.run(n,i)}}),xK=de("$ZodExactOptional",(e,t)=>{fM.init(e,t),yt(e,"values",n=>n.def.innerType._zod.values),yt(e,"pattern",n=>n.def.innerType._zod.pattern),e._zod.parse=(n,i)=>t.innerType._zod.run(n,i)}),SK=de("$ZodNullable",(e,t)=>{sn.init(e,t),yt(e,"optin",n=>n.def.innerType._zod.optin),yt(e,"optout",n=>n.def.innerType._zod.optout),yt(e,"pattern",n=>{const i=n.def.innerType._zod.pattern;return i?new RegExp(`^(${l1(i.source)}|null)$`):void 0}),yt(e,"values",n=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,i)=>n.value===null?n:t.innerType._zod.run(n,i)}),wK=de("$ZodDefault",(e,t)=>{sn.init(e,t),e._zod.optin="defaulted",yt(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then(a=>vN(a,t)):vN(s,t)}});function vN(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const CK=de("$ZodPrefault",(e,t)=>{sn.init(e,t),e._zod.optin="defaulted",yt(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,i)=>(i.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,i))}),kK=de("$ZodNonOptional",(e,t)=>{sn.init(e,t),yt(e,"values",n=>{const i=n.def.innerType._zod.values;return i?new Set([...i].filter(s=>s!==void 0)):void 0}),e._zod.parse=(n,i)=>{const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then(a=>yN(a,e)):yN(s,e)}});function yN(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}function _N(e,t,n,i){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(s=>Qc(s,i,va()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}const EK=de("$ZodCatch",(e,t)=>{sn.init(e,t),yt(e,"optin",n=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),yt(e,"optout",n=>n.def.innerType._zod.optout),yt(e,"values",n=>n.def.innerType._zod.values),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);const s=t.innerType._zod.run({value:n.value,issues:[]},i);return s instanceof Promise?s.then(a=>_N(n,a,t,i)):_N(n,s,t,i)}}),NK=de("$ZodPipe",(e,t)=>{sn.init(e,t),yt(e,"values",n=>n.def.in._zod.values),yt(e,"optin",n=>n.def.in._zod.optin),yt(e,"optout",n=>n.def.out._zod.optout),yt(e,"propValues",n=>n.def.in._zod.propValues),e._zod.parse=(n,i)=>{if(i.direction==="backward"){const a=t.out._zod.run(n,i);return a instanceof Promise?a.then(l=>Gf(l,t.in,i)):Gf(a,t.in,i)}const s=t.in._zod.run(n,i);return s instanceof Promise?s.then(a=>Gf(a,t.out,i)):Gf(s,t.out,i)}});function Gf(e,t,n){return e.issues.some(i=>i.code!=="unrecognized_keys")?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const RK=de("$ZodReadonly",(e,t)=>{sn.init(e,t),yt(e,"propValues",n=>n.def.innerType._zod.propValues),yt(e,"values",n=>n.def.innerType._zod.values),yt(e,"optin",n=>n.def.innerType?._zod?.optin),yt(e,"optout",n=>n.def.innerType?._zod?.optout),e._zod.parse=(n,i)=>{if(i.direction==="backward")return t.innerType._zod.run(n,i);const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then(bN):bN(s)}});function bN(e){return e.memo||(e.value=Object.freeze(e.value)),e}const TK=de("$ZodCustom",(e,t)=>{Pi.init(e,t),sn.init(e,t),e._zod.parse=(n,i)=>n,e._zod.check=n=>{const i=n.value,s=t.fn(i);if(s instanceof Promise)return s.then(a=>xN(a,n,i,e));xN(s,n,i,e)}});function xN(e,t,n,i){if(!e){const s={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(s.params=i._zod.def.params),t.issues.push(Hd(s))}}class DK extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform"),this.name="ZodCyclicError"}}const $b="~memo",SN=[];function pM(e){return e!==null&&typeof e=="object"}function d_(e){return e.map(t=>t.path?{...t,path:t.path.slice()}:{...t})}const mM=new WeakMap,_d=0,Dp=1,Rd=2;function Ap(e,t,n){const i=mM.get(e);if(i!==void 0)return i?Rd:_d;if(t.has(e))return Rd;t.add(e);let s=_d;const a=g=>{if(s!==Rd&&g?._zod){const m=Ap(g,t);m>s&&(s=m)}},l=(g,m)=>{let _=_d;for(const b of Reflect.ownKeys(g)){const x=Object.getOwnPropertyDescriptor(g,b);if(!x.enumerable)continue;const S=x.get?Dp:x.value?._zod?Ap(x.value,t):_d;S>_&&(_=S)}return _},u=g=>{g>s&&(s=g)},f=e._zod.def;switch(f.type){case"object":{const g=c1(f);u(g?l(g):Dp),a(f.catchall);break}case"array":a(f.element);break;case"tuple":for(const g of f.items)a(g);a(f.rest);break;case"record":case"map":a(f.keyType),a(f.valueType);break;case"set":a(f.valueType);break;case"union":for(const g of f.options)a(g);break;case"intersection":a(f.left),a(f.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":a(f.innerType);break;case"pipe":a(f.in),a(f.out);break;case"function":a(f.input),a(f.output);break;case"lazy":{const g=f._cachedInner??void 0;u(g?Ap(g,t):Dp);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(const g in f){const m=Object.getOwnPropertyDescriptor(f,g);if(!m||m.get)continue;const _=m.value;if(!(!_||typeof _!="object")){if(_._zod)a(_);else if(Array.isArray(_))for(const b of _)a(b)}}}return t.delete(e),AK(e,s)}function AK(e,t){return t!==Dp&&mM.set(e,t===Rd),t}function OK(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}let Zf;const Yf=[],jK={alloc(e,t,n){const i=Zf;if(!i)return n;Zf=void 0;const s={value:n,issues:null};return i.set(t.value,s),Yf.push(s),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const n=e._zod.parse,i=(s,a)=>{if(a.direction!=="backward"&&MK(a,s.value))throw new DK;return n(s,a)};e._zod.parse=i,e._zod.run===n&&(e._zod.run=i)})},attach(e){var t;let n,i=!1,s,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{const l=e._zod.parse,u=(f,h)=>{if(n===void 0){const k=Ap(e,new Set);if(k===_d)return e._zod.parse=l,e._zod.run===u&&(e._zod.run=l),l(f,h);k===Rd||i?n=!0:i=!0}const g=f.value;if(!pM(g))return l(f,h);let m=h[$b];m||(m={buckets:new WeakMap,backEdges:void 0},h[$b]=m);let _;s===h?_=a:(_=OK(m,e),s=h,a=_);const b=_.get(g);if(b)return f.value=b.value,b.issues?b.issues.length&&f.issues.push(...d_(b.issues)):(f.memo=!0,m.backEdges??(m.backEdges=new WeakSet),m.backEdges.add(b.value)),f;Zf=_;const x=Yf.length,S=l(f,h);Zf=void 0;const C=Yf.length>x?Yf.pop():void 0;return S instanceof Promise?S.then(k=>(C&&(C.issues=k.issues.length?d_(k.issues):SN),k)):(C&&(C.issues=S.issues.length?d_(S.issues):SN),S)};e._zod.parse=u,e._zod.run===l&&(e._zod.run=u)})}};function zK(){return jK}function MK(e,t){const n=e[$b]?.backEdges;return n!==void 0&&pM(t)&&n.has(t)}const IK=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(a){return e[a]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},i={nan:"NaN"};function s(a,l){return a==="number"&&typeof l=="number"&&!Number.isFinite(l)?String(l):i[a]??a}return a=>{switch(a.code){case"invalid_type":{const l=s(a.expected),u=aq(a.input),f=s(u,a.input);return`Invalid input: expected ${l}, received ${f}`}case"invalid_value":return a.values.length===1?`Invalid input: expected ${Wz(a.values[0])}`:`Invalid option: expected one of ${sN(a.values,"|")}`;case"too_big":{const l=a.exact?"exactly ":a.inclusive?"<=":"<",u=t(a.origin);return u?`Too big: expected ${a.origin??"value"} to have ${l}${a.maximum.toString()} ${u.unit??"elements"}`:`Too big: expected ${a.origin??"value"} to be ${l}${a.maximum.toString()}`}case"too_small":{const l=a.exact?"exactly ":a.inclusive?">=":">",u=t(a.origin);return u?`Too small: expected ${a.origin} to have ${l}${a.minimum.toString()} ${u.unit}`:`Too small: expected ${a.origin} to be ${l}${a.minimum.toString()}`}case"invalid_format":{const l=a;return l.format==="starts_with"?`Invalid string: must start with "${l.prefix}"`:l.format==="ends_with"?`Invalid string: must end with "${l.suffix}"`:l.format==="includes"?`Invalid string: must include "${l.includes}"`:l.format==="regex"?`Invalid string: must match pattern ${l.pattern}`:`Invalid ${n[l.format]??a.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${a.divisor}`;case"unrecognized_keys":return`Unrecognized key${a.keys.length>1?"s":""}: ${sN(a.keys,", ")}`;case"invalid_key":return`Invalid key in ${a.origin}`;case"invalid_union":return a.options&&Array.isArray(a.options)&&a.options.length>0?`Invalid discriminator value. Expected ${a.options.map(u=>`'${u}'`).join(" | ")}`:a.inclusive===!1?"Invalid input: more than one option matched":"Invalid input";case"invalid_element":return`Invalid value in ${a.origin}`;default:return"Invalid input"}}};function PK(){return{localeError:IK()}}var wN;class LK{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const i=n[0];return this._map.set(t,i),i&&typeof i=="object"&&"id"in i&&this._idmap.set(i.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const i={...this.get(n)??{}};delete i.id;const s={...i,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function BK(){return new LK}(wN=globalThis).__zod_globalRegistry??(wN.__zod_globalRegistry=BK());const bd=globalThis.__zod_globalRegistry;function _1(e){return e.checks&&(e.checks=[...e.checks]),e}function FK(e,t){return new e(_1({type:"string",...ze(t)}))}function UK(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...ze(t)})}function HK(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...ze(t)})}function $K(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...ze(t)})}function qK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...ze(t)})}function WK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...ze(t)})}function KK(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...ze(t)})}function VK(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...ze(t)})}function GK(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...ze(t)})}function ZK(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...ze(t)})}function YK(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...ze(t)})}function XK(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...ze(t)})}function QK(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...ze(t)})}function JK(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...ze(t)})}function eV(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...ze(t)})}function tV(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...ze(t)})}function nV(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...ze(t)})}function iV(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...ze(t)})}function rV(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...ze(t)})}function sV(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...ze(t)})}function oV(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...ze(t)})}function aV(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...ze(t)})}function lV(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...ze(t)})}function cV(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...ze(t)})}function uV(e,t){return new e({type:"string",format:"date",check:"string_format",...ze(t)})}function dV(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...ze(t)})}function hV(e,t){return new e({type:"string",format:"duration",check:"string_format",...ze(t)})}function fV(e,t){return new e(_1({type:"number",checks:[],...ze(t)}))}function pV(e,t){return new e(_1({type:"number",coerce:!0,checks:[],...ze(t)}))}function mV(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...ze(t)})}function gV(e,t){return new e({type:"boolean",...ze(t)})}function vV(e){return new e({type:"unknown"})}function yV(e,t){return new e({type:"never",...ze(t)})}function CN(e,t){return new eM({check:"less_than",...ze(t),value:e,inclusive:!1})}function h_(e,t){return new eM({check:"less_than",...ze(t),value:e,inclusive:!0})}function kN(e,t){return new tM({check:"greater_than",...ze(t),value:e,inclusive:!1})}function f_(e,t){return new tM({check:"greater_than",...ze(t),value:e,inclusive:!0})}function EN(e,t){return new hW({check:"multiple_of",...ze(t),value:e})}function gM(e,t){return new pW({check:"max_length",...ze(t),maximum:e})}function nm(e,t){return new mW({check:"min_length",...ze(t),minimum:e})}function vM(e,t){return new gW({check:"length_equals",...ze(t),length:e})}function _V(e,t){return new vW({check:"string_format",format:"regex",...ze(t),pattern:e})}function bV(e){return new yW({check:"string_format",format:"lowercase",...ze(e)})}function xV(e){return new _W({check:"string_format",format:"uppercase",...ze(e)})}function SV(e,t){return new bW({check:"string_format",format:"includes",...ze(t),includes:e})}function wV(e,t){return new xW({check:"string_format",format:"starts_with",...ze(t),prefix:e})}function CV(e,t){return new SW({check:"string_format",format:"ends_with",...ze(t),suffix:e})}function Jc(e){return new wW({check:"overwrite",tx:e})}function kV(e){return Jc(t=>t.normalize(e))}function EV(){return Jc(e=>e.trim())}function NV(){return Jc(e=>e.toLowerCase())}function RV(){return Jc(e=>e.toUpperCase())}function TV(){return Jc(e=>G$(e))}function DV(e,t,n){return new e({type:"array",element:t,...ze(n)})}function AV(e,t,n){return new e({type:"custom",check:"custom",fn:t,...ze(n)})}function OV(e,t){const n=jV(i=>(i.addIssue=s=>{if(typeof s=="string")i.issues.push(Hd(s,i.value,n._zod.def));else{const a=s;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),"input"in a||(a.input=i.value),a.inst??(a.inst=n),a.continue??(a.continue=!n._zod.def.abort),i.issues.push(Hd(a))}},e(i.value,i)),t);return n}function jV(e,t){const n=new Pi({check:"custom",...ze(t)});return n._zod.check=e,n}function Td(e,...t){for(const n of t)for(const i of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,i)&&ma(e,i,n[i]);return e}function yM(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??bd,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function ca(e,t,n,i,s){const a=typeof t.unrepresentable=="function"?t.unrepresentable({zodSchema:e,path:i.path,message:s}):t.unrepresentable;if(a==="any")return!1;if(a===void 0||a==="throw")throw new Error(s);return Object.assign(n,a),!0}function si(e,t,n={path:[],schemaPath:[]}){var i;const s=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;const l={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,l),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;const u=e._zod.toJSONSchema?.();if(u)l.schema=u;else{const g={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,l.schema,g);else{const _=l.schema,b=t.processors[s.type];if(!b)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);b(e,t,_,g)}const m=e._zod.parent;m&&(l.ref||(l.ref=m),si(m,t,g),t.seen.get(m).isParent=!0)}const f=t.metadataRegistry.get(e);return f&&Td(l.schema,f),t.io==="input"&&vi(e)&&(delete l.schema.examples,delete l.schema.default),t.io==="input"&&"_prefault"in l.schema&&((i=l.schema).default??(i.default=l.schema._prefault)),delete l.schema._prefault,t.seen.get(e).schema}function NN(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function _M(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;const i=new Map;for(const l of e.seen.entries()){const u=e.metadataRegistry.get(l[0])?.id;if(u){const f=i.get(u);if(f&&f!==l[0])throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(u,l[0])}}const s=l=>{const u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const m=e.external.registry.get(l[0])?.id,_=e.external.uri??(x=>x);if(m)return{ref:_(m)};const b=l[1].defId??l[1].schema.id??`schema${e.counter++}`;return l[1].defId=b,{defId:b,ref:`${_("__shared")}#/${u}/${NN(b)}`}}const f="#",h=`${f}/${u}/`;if(l[1]===n&&!l[1].schema.id)return{ref:f};const g=l[1].schema.id??`__schema${e.counter++}`;return{defId:g,ref:h+NN(g)}},a=l=>{if(l[1].schema.$ref)return;const u=l[1],{ref:f,defId:h}=s(l);u.def={...u.schema},h&&(u.defId=h);const g=u.schema;for(const m in g)delete g[m];g.$ref=f};if(e.cycles==="throw")for(const l of e.seen.entries()){const u=l[1];if(u.cycle)throw new Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
107
-
108
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const l of e.seen.entries()){const u=l[1];if(t===l[0]){a(l);continue}if(e.external){const h=e.external.registry.get(l[0])?.id;if(t!==l[0]&&h){a(l);continue}}if(e.metadataRegistry.get(l[0])?.id){a(l);continue}if(u.cycle){a(l);continue}u.count>1&&e.reused==="ref"&&a(l)}e.external&&(e.sharedDefsExtractedFor=e.external)}function bM(e){const t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;const n=[];for(const i of t){if(!i||typeof i!="object")return;bM(i);const s=Object.keys(i);if(s.length!==1||s[0]!=="type")return;const a=i.type;for(const l of Array.isArray(a)?a:[a]){if(typeof l!="string")return;n.includes(l)||n.push(l)}}delete e.anyOf,e.type=n.length===1?n[0]:n}const xM=new Set(["type","properties","required","additionalProperties"]),RN=["oneOf","anyOf"];function TN(e){const t=e.additionalProperties;return t===void 0||t===!1||typeof t!="object"||t===null?null:Object.keys(t).length?t:null}function qb(e){const t=[];for(const a of e){if(typeof a!="object"||a.type!=="object")return null;for(const l in a)if(!xM.has(l))return null;t.push(a)}const n={},i=new Set;for(const a of t){for(const l in a.properties){if(Object.prototype.hasOwnProperty.call(n,l))continue;const u=[];for(const h of t){const g=h.properties?.[l]??TN(h);g!=null&&(u.some(m=>JSON.stringify(m)===JSON.stringify(g))||u.push(g))}const f=u.length===1?u[0]:qb(u)??{allOf:u};ma(n,l,f)}for(const l of a.required??[])i.add(l)}const s={type:"object",properties:n};if(i.size&&(s.required=[...i]),t.every(a=>a.additionalProperties===!1))s.additionalProperties=!1;else{const a=[];for(const l of t){const u=TN(l);u&&!a.some(f=>JSON.stringify(f)===JSON.stringify(u))&&a.push(u)}a.length===1?s.additionalProperties=a[0]:a.length>1&&(s.additionalProperties={allOf:a})}return s}function zV(e){const t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(const s of xM)if(s in e)return;const n=t.filter(s=>RN.some(a=>Array.isArray(s[a])));let i=null;if(!n.length)i=qb(t);else{const s=n[0],a=RN.find(f=>Array.isArray(s[f]));if(Object.keys(s).length!==1)return;const l=t.filter(f=>f!==s),u=s[a].map(f=>qb([...l,f]));if(u.some(f=>!f))return;i={[a]:u}}i&&(delete e.allOf,Td(e,i))}function SM(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=u=>{const f=e.seen.get(u);if(f.ref===null)return;const h=f.def??f.schema,g={...h},m=f.ref;if(f.ref=null,m){i(m);const b=e.seen.get(m),x=b.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(x)):Td(h,x),Td(h,g),u._zod.parent===m)for(const C in h)C==="$ref"||C==="allOf"||C in g||delete h[C];if(x.$ref&&b.def)for(const C in h)C==="$ref"||C==="allOf"||C in b.def&&JSON.stringify(h[C])===JSON.stringify(b.def[C])&&delete h[C]}const _=u._zod.parent;if(_&&_!==m){i(_);const b=e.seen.get(_);if(b?.schema.$ref&&(h.$ref=b.schema.$ref,b.def))for(const x in h)x==="$ref"||x==="allOf"||x in b.def&&JSON.stringify(h[x])===JSON.stringify(b.def[x])&&delete h[x]}e.override({zodSchema:u,jsonSchema:h,path:f.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(const u of[...e.seen.entries()].reverse())i(u[0]);if(e.target!=="openapi-3.0")for(const u of e.seen.entries())bM(u[1].def??u[1].schema);for(const u of e.deferred)u();if(e.intersections.length){const u=new Map;for(const f of e.seen.values())for(const h of[f.schema,f.def]){const g=h?.allOf;if(!Array.isArray(g))continue;const m=u.get(g);m?m.push(h):u.set(g,[h])}for(const f of e.intersections)for(const h of u.get(f)??[])zV(h)}}const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(u)}Td(s,n.defId?n.schema:n.def??n.schema);const a=e.metadataRegistry.get(t)?.id;a!==void 0&&s.id===a&&delete s.id;const l=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(const u of e.seen.entries()){const f=u[1];f.def&&f.defId&&(f.def.id===f.defId&&delete f.def.id,ma(l,f.defId,f.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(l).length>0&&(e.target==="draft-2020-12"?s.$defs=l:s.definitions=l);try{const u=JSON.parse(JSON.stringify(s));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:im(t,"input",e.processors),output:im(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}function vi(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const i=e._zod.def;if(i.type==="transform")return!0;if(i.type==="array")return vi(i.element,n);if(i.type==="set")return vi(i.valueType,n);if(i.type==="lazy")return vi(i.getter(),n);if(i.type==="promise"||i.type==="optional"||i.type==="nonoptional"||i.type==="nullable"||i.type==="readonly"||i.type==="default"||i.type==="prefault"||i.type==="catch")return vi(i.innerType,n);if(i.type==="intersection")return vi(i.left,n)||vi(i.right,n);if(i.type==="record"||i.type==="map")return vi(i.keyType,n)||vi(i.valueType,n);if(i.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:vi(i.in,n)||vi(i.out,n);if(i.type==="object"){for(const s in i.shape)if(vi(i.shape[s],n))return!0;return!1}if(i.type==="union"){for(const s of i.options)if(vi(s,n))return!0;return!1}if(i.type==="tuple"){for(const s of i.items)if(vi(s,n))return!0;return!!(i.rest&&vi(i.rest,n))}return!1}const MV=(e,t={})=>n=>{const i=yM({...n,processors:t});return si(e,i),_M(i,e),SM(i,e)},im=(e,t,n={})=>i=>{const{libraryOptions:s,target:a}=i??{},l=yM({...s??{},target:a,io:t,processors:n});return si(e,l),_M(l,e),SM(l,e)},Uc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Hc=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},DN=(e,t)=>{Uc(e,"minimum",t),Hc(e,"maximum",t)},wM=(e,t)=>{e.multipleOf??(e.multipleOf=[]),e.multipleOf.includes(t)||e.multipleOf.push(t)},CM=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},kM=(e,t)=>{e.mime=e.mime?e.mime.filter(n=>t.includes(n)):[...t]},EM=(e,t)=>{e.format=t,t.includes("int")&&(e.isInt=!0)},AN=(e,t)=>Uc(e,"minimum",t.minimum),ON=(e,t)=>Hc(e,"maximum",t.maximum),jN=e=>(t,n)=>{EM(t,n.format);const[i,s]=e[n.format];Uc(t,"minimum",i),Hc(t,"maximum",s)},IV={greater_than:(e,t)=>Uc(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>Hc(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>wM(e,t.value),number_format:jN(Kz),bigint_format:jN(Q$),min_length:AN,max_length:ON,length_equals:(e,t)=>DN(e,t.length),min_size:AN,max_size:ON,size_equals:(e,t)=>DN(e,t.size),string_format:(e,t)=>{EM(e,t.format),t.pattern&&CM(e,t.pattern),(t.format==="base64"||t.format==="base64url")&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>kM(e,t.mime)};function gs(e){const t={},n=e._zod.def,i=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(const a of i)IV[a._zod.def.check]?.(t,a._zod.def);const s=e._zod.bag;s.minimum!==void 0&&Uc(t,"minimum",s.minimum),s.exclusiveMinimum!==void 0&&Uc(t,"exclusiveMinimum",s.exclusiveMinimum),s.maximum!==void 0&&Hc(t,"maximum",s.maximum),s.exclusiveMaximum!==void 0&&Hc(t,"exclusiveMaximum",s.exclusiveMaximum),s.multipleOf!==void 0&&wM(t,s.multipleOf),s.format!==void 0&&(t.format??(t.format=s.format),s.format.includes("int")&&(t.isInt=!0)),s.mime&&kM(t,s.mime);for(const a of s.patterns??[])CM(t,a);return t}const PV={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},LV=new Map([[lM,Jq],[y1,eW]]),BV=e=>LV.get(e)??e,FV=(e,t,n,i)=>{const s=n;s.type="string";const{minimum:a,maximum:l,format:u,patterns:f,contentEncoding:h,laxFormat:g}=gs(e);if(typeof a=="number"&&(s.minLength=a),typeof l=="number"&&(s.maxLength=l),u&&(s.format=PV[u]??u,s.format===""&&delete s.format,(u==="time"||g)&&delete s.format),h&&(s.contentEncoding=h),f&&f.size>0){const m=[...f].map(BV);m.length===1?s.pattern=m[0].source:m.length>1&&(s.allOf=[...m.map(_=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:_.source}))])}},UV=(e,t,n,i)=>{const s=n,{minimum:a,maximum:l,multipleOf:u,exclusiveMaximum:f,exclusiveMinimum:h,isInt:g}=gs(e);s.type=g?"integer":"number";const m=typeof h=="number"&&h>=(a??Number.NEGATIVE_INFINITY),_=typeof f=="number"&&f<=(l??Number.POSITIVE_INFINITY),b=t.target==="draft-04"||t.target==="openapi-3.0";if(m?b?(s.minimum=h,s.exclusiveMinimum=!0):s.exclusiveMinimum=h:typeof a=="number"&&(s.minimum=a),_?b?(s.maximum=f,s.exclusiveMaximum=!0):s.exclusiveMaximum=f:typeof l=="number"&&(s.maximum=l),u){const x=new Set;for(const k of u)Number.isFinite(k)&&k!==0?x.add(Math.abs(k)):ca(e,t,s,i,`A multipleOf divisor of ${k} cannot be represented in JSON Schema`);const[S,...C]=x;S!==void 0&&(s.multipleOf=S),C.length&&(s.allOf=[...s.allOf??[],...C.map(k=>({multipleOf:k}))])}},HV=(e,t,n,i)=>{n.type="boolean"},$V=(e,t,n,i)=>{n.not={}},qV=(e,t,n,i)=>{},WV=(e,t,n,i)=>{const s=e._zod.def,a=Lb(s.entries);if(a.length===0){n.not={};return}a.every(l=>typeof l=="number")&&(n.type="number"),a.every(l=>typeof l=="string")&&(n.type="string"),n.enum=a},KV=(e,t,n,i)=>{const s=e._zod.def;if(s.values.length===0){n.not={};return}const a=[];for(const l of s.values)if(l===void 0){if(ca(e,t,n,i,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof l=="bigint"){if(ca(e,t,n,i,"BigInt literals cannot be represented in JSON Schema"))return;a.push(Number(l))}else a.push(l);if(a.length!==0)if(a.length===1){const l=a[0];n.type=l===null?"null":typeof l,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[l]:n.const=l}else a.every(l=>typeof l=="number")&&(n.type="number"),a.every(l=>typeof l=="string")&&(n.type="string"),a.every(l=>typeof l=="boolean")&&(n.type="boolean"),a.every(l=>l===null)&&(n.type="null"),n.enum=a},VV=(e,t,n,i)=>{ca(e,t,n,i,"Custom types cannot be represented in JSON Schema")},GV=(e,t,n,i)=>{ca(e,t,n,i,"Transforms cannot be represented in JSON Schema")},ZV=(e,t,n,i)=>{const s=n,a=e._zod.def,{minimum:l,maximum:u}=gs(e);typeof l=="number"&&(s.minItems=l),typeof u=="number"&&(s.maxItems=u),s.type="array",s.items=si(a.element,t,{...i,path:[...i.path,"items"]})};function Wb(e){const t=e._zod.def;return t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform")?Wb(t.out):t.type==="catch"?Wb(t.innerType):e._zod.optin}const YV=(e,t,n,i)=>{const s=n,a=e._zod.def,l=a.shape;if(Object.getOwnPropertySymbols(l).length&&ca(e,t,s,i,"Symbol keys cannot be represented in JSON Schema"))return;s.type="object",s.properties={};for(const h in l)ma(s.properties,h,si(l[h],t,{...i,path:[...i.path,"properties",h]}));const f=[];for(const h of Object.keys(l)){const g=a.shape[h];(t.io==="input"?Wb(g)===void 0:g._zod.optout===void 0)&&f.push(h)}f.length>0&&(s.required=f),a.catchall?._zod.def.type==="never"?s.additionalProperties=!1:a.catchall?a.catchall&&(s.additionalProperties=si(a.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},XV=(e,t,n,i)=>{const s=e._zod.def,a=s.inclusive===!1,l=s.options.map((u,f)=>si(u,t,{...i,path:[...i.path,a?"oneOf":"anyOf",f]}));a?n.oneOf=l:n.anyOf=l},QV=(e,t,n,i)=>{const s=e._zod.def,a=si(s.left,t,{...i,path:[...i.path,"allOf",0]}),l=si(s.right,t,{...i,path:[...i.path,"allOf",1]}),u=h=>"allOf"in h&&Object.keys(h).length===1,f=[...u(a)?a.allOf:[a],...u(l)?l.allOf:[l]];n.allOf=f,t.intersections.push(f)},JV=(e,t,n,i)=>{const s=e._zod.def,a=si(s.innerType,t,i),l=t.seen.get(e);t.target==="openapi-3.0"?(l.ref=s.innerType,n.nullable=!0):n.anyOf=[a,{type:"null"}]},eG=(e,t,n,i)=>{const s=e._zod.def;si(s.innerType,t,i);const a=t.seen.get(e);a.ref=s.innerType},b1=Symbol();function NM(e,t,n,i,s){let a=!1;const l=JSON.stringify(e,(u,f)=>typeof f!="bigint"?f:(a=!0,null));return a?(ca(t,n,i,s,"BigInt defaults cannot be represented in JSON Schema"),b1):JSON.parse(l)}const tG=(e,t,n,i)=>{const s=e._zod.def;si(s.innerType,t,i);const a=t.seen.get(e);a.ref=s.innerType;const l=NM(s.defaultValue,e,t,n,i);l!==b1&&(n.default=l)},nG=(e,t,n,i)=>{const s=e._zod.def;si(s.innerType,t,i);const a=t.seen.get(e);if(a.ref=s.innerType,t.io!=="input")return;const l=NM(s.defaultValue,e,t,n,i);l!==b1&&(n._prefault=l)},iG=(e,t,n,i)=>{const s=e._zod.def;si(s.innerType,t,i);const a=t.seen.get(e);a.ref=s.innerType;let l;try{l=s.catchValue(void 0)}catch{ca(e,t,n,i,"Dynamic catch values are not supported in JSON Schema");return}n.default=l},rG=(e,t,n,i)=>{const s=e._zod.def,a=s.in._zod.traits.has("$ZodTransform"),l=t.io==="input"?a?s.out:s.in:s.out;si(l,t,i);const u=t.seen.get(e);u.ref=l},sG=(e,t,n,i)=>{const s=e._zod.def;si(s.innerType,t,i);const a=t.seen.get(e);a.ref=s.innerType,n.readOnly=!0},RM=(e,t,n,i)=>{const s=e._zod.def;si(s.innerType,t,i);const a=t.seen.get(e);a.ref=s.innerType},zN=new WeakSet([Object.prototype,Error.prototype]);function Xf(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){const i=n(this);return Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0}),i},set(i){Object.defineProperty(this,t,{value:i,configurable:!0,writable:!0})}})}const oG=(e,t)=>{bq.init(e,t),e.name="ZodError";const n=Object.getPrototypeOf(e);zN.has(n)||(zN.add(n),Xf(n,"format",i=>s=>wq(i,s)),Xf(n,"flatten",i=>s=>Sq(i,s)),Xf(n,"addIssue",i=>s=>{i.issues.push(s),i.message=JSON.stringify(i.issues,Bb,2)}),Xf(n,"addIssues",i=>s=>{i.issues.push(...s),i.message=JSON.stringify(i.issues,Bb,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},Rr=de("ZodError",oG,void 0,{Parent:Error}),aG=h1(Rr),lG=f1(Rr),cG=p1(Rr),uG=m1(Rr),dG=Tq(Rr),hG=Dq(Rr),fG=Aq(Rr),pG=Oq(Rr),mG=jq(Rr),gG=zq(Rr),vG=Mq(Rr),yG=Iq(Rr);function _G(){ws.localeError||va(PK())}function x1(){ws.memoizer||va({memoizer:zK()})}const on=de("ZodType",(e,t)=>(_G(),sn.init(e,t),e.def=t,e.type=t.type,e),{check(...e){const t=this.def;return this.clone(ir(t,{checks:[...t.checks??[],...e.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ga(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(fZ(e,t))},superRefine(e,t){return this.check(pZ(e,t))},overwrite(e){return this.check(Jc(e))},optional(){return MN(this)},exactOptional(){return eZ(this)},nullable(){return IN(this)},nullish(){return MN(IN(this))},nonoptional(e){return oZ(this,e)},array(){return wn(this)},or(e){return Ds([this,e])},and(e){return YG(this,e)},transform(e){return PN(this,JG(e))},default(e){return iZ(this,e)},prefault(e){return sZ(this,e)},catch(e){return lZ(this,e)},pipe(e){return PN(this,e)},readonly(){return dZ(this)},describe(e){const t=this.clone();return bd.add(t,{description:e}),t},meta(...e){if(e.length===0)return bd.get(this);const t=this.clone();return bd.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return Zz(this,"~standard",{...iM(this),jsonSchema:{input:im(this,"input"),output:im(this,"output")}})},set"~standard"(e){la(this,"~standard",e)},parse:function e(t,n){return aG(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await lG(this,t,n,{callee:e})},safeParse(e,t){return cG(this,e,t)},async safeParseAsync(e,t){return uG(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){la(this,"spa",e)},validate(e,t){return Eq(this,e,t)},validateAsync(e,t){return Rq(this,e,t)},encode:function e(t,n){return dG(this,t,n,{callee:e})},decode:function e(t,n){return hG(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await fG(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await pG(this,t,n,{callee:e})},safeEncode(e,t){return mG(this,e,t)},safeDecode(e,t){return gG(this,e,t)},async safeEncodeAsync(e,t){return vG(this,e,t)},async safeDecodeAsync(e,t){return yG(this,e,t)},toJSONSchema(e){return MV(this,{})(e)},get description(){return bd.get(this)?.description},get _def(){return this._zod.def}}),TM=de("_ZodString",(e,t)=>{v1.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>FV(e,n,i)},Yz({format:e=>gs(e).format??null,minLength:e=>gs(e).minimum??null,maxLength:e=>gs(e).maximum??null},{regex(...e){return this.check(_V(...e))},includes(...e){return this.check(SV(...e))},startsWith(...e){return this.check(wV(...e))},endsWith(...e){return this.check(CV(...e))},min(...e){return this.check(nm(...e))},max(...e){return this.check(gM(...e))},length(...e){return this.check(vM(...e))},nonempty(...e){return this.check(nm(1,...e))},lowercase(e){return this.check(bV(e))},uppercase(e){return this.check(xV(e))},trim(){return this.check(EV())},normalize(...e){return this.check(kV(...e))},toLowerCase(){return this.check(NV())},toUpperCase(){return this.check(RV())},slugify(){return this.check(TV())}})),bG=de("ZodString",(e,t)=>{v1.init(e,t),TM.init(e,t)},{email(e){return this.check(UK(kG,e))},url(e){return this.check(VK(NG,e))},jwt(e){return this.check(lV(HG,e))},emoji(e){return this.check(GK(RG,e))},guid(e){return this.check(HK(EG,e))},uuid(e){return this.check($K(Qf,e))},uuidv4(e){return this.check(qK(Qf,e))},uuidv6(e){return this.check(WK(Qf,e))},uuidv7(e){return this.check(KK(Qf,e))},nanoid(e){return this.check(ZK(TG,e))},cuid(e){return this.check(YK(DG,e))},cuid2(e){return this.check(XK(AG,e))},ulid(e){return this.check(QK(OG,e))},base64(e){return this.check(sV(BG,e))},base64url(e){return this.check(oV(FG,e))},xid(e){return this.check(JK(jG,e))},ksuid(e){return this.check(eV(zG,e))},ipv4(e){return this.check(tV(MG,e))},ipv6(e){return this.check(nV(IG,e))},cidrv4(e){return this.check(iV(PG,e))},cidrv6(e){return this.check(rV(LG,e))},e164(e){return this.check(aV(UG,e))},datetime(e){return this.check(cV(xG,e))},date(e){return this.check(uV(SG,e))},time(e){return this.check(dV(wG,e))},duration(e){return this.check(hV(CG,e))}});function V(e){return FK(bG,e)}const Jt=de("ZodStringFormat",(e,t)=>{Gt.init(e,t),TM.init(e,t)}),xG=de("ZodISODateTime",(e,t)=>{$W.init(e,t),Jt.init(e,t)}),SG=de("ZodISODate",(e,t)=>{qW.init(e,t),Jt.init(e,t)}),wG=de("ZodISOTime",(e,t)=>{WW.init(e,t),Jt.init(e,t)}),CG=de("ZodISODuration",(e,t)=>{KW.init(e,t),Jt.init(e,t)}),kG=de("ZodEmail",(e,t)=>{TW.init(e,t),Jt.init(e,t)}),EG=de("ZodGUID",(e,t)=>{NW.init(e,t),Jt.init(e,t)}),Qf=de("ZodUUID",(e,t)=>{RW.init(e,t),Jt.init(e,t)}),NG=de("ZodURL",(e,t)=>{MW.init(e,t),Jt.init(e,t)}),RG=de("ZodEmoji",(e,t)=>{IW.init(e,t),Jt.init(e,t)}),TG=de("ZodNanoID",(e,t)=>{PW.init(e,t),Jt.init(e,t)}),DG=de("ZodCUID",(e,t)=>{LW.init(e,t),Jt.init(e,t)}),AG=de("ZodCUID2",(e,t)=>{BW.init(e,t),Jt.init(e,t)}),OG=de("ZodULID",(e,t)=>{FW.init(e,t),Jt.init(e,t)}),jG=de("ZodXID",(e,t)=>{UW.init(e,t),Jt.init(e,t)}),zG=de("ZodKSUID",(e,t)=>{HW.init(e,t),Jt.init(e,t)}),MG=de("ZodIPv4",(e,t)=>{VW.init(e,t),Jt.init(e,t)}),IG=de("ZodIPv6",(e,t)=>{ZW.init(e,t),Jt.init(e,t)}),PG=de("ZodCIDRv4",(e,t)=>{YW.init(e,t),Jt.init(e,t)}),LG=de("ZodCIDRv6",(e,t)=>{QW.init(e,t),Jt.init(e,t)}),BG=de("ZodBase64",(e,t)=>{JW.init(e,t),Jt.init(e,t)}),FG=de("ZodBase64URL",(e,t)=>{tK.init(e,t),Jt.init(e,t)}),UG=de("ZodE164",(e,t)=>{nK.init(e,t),Jt.init(e,t)}),HG=de("ZodJWT",(e,t)=>{rK.init(e,t),Jt.init(e,t)}),S1=de("ZodNumber",(e,t)=>{cM.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>UV(e,n,i,s),e.isFinite=!0},Yz({minValue:e=>{const{minimum:t,exclusiveMinimum:n}=gs(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:e=>{const{maximum:t,exclusiveMaximum:n}=gs(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:e=>{const{isInt:t,multipleOf:n}=gs(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>gs(e).format??null},{gt(e,t){return this.check(kN(e,t))},gte(e,t){return this.check(f_(e,t))},min(e,t){return this.check(f_(e,t))},lt(e,t){return this.check(CN(e,t))},lte(e,t){return this.check(h_(e,t))},max(e,t){return this.check(h_(e,t))},int(e){return this.check(Ve(e))},safe(e){return this.check(Ve(e))},positive(e){return this.check(kN(0,e))},nonnegative(e){return this.check(f_(0,e))},negative(e){return this.check(CN(0,e))},nonpositive(e){return this.check(h_(0,e))},multipleOf(e,t){return this.check(EN(e,t))},step(e,t){return this.check(EN(e,t))},finite(){return this}}));function Ae(e){return fV(S1,e)}const $G=de("ZodNumberFormat",(e,t)=>{sK.init(e,t),S1.init(e,t)});function Ve(e){return mV($G,e)}const qG=de("ZodBoolean",(e,t)=>{oK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>HV(e,n,i)});function Qt(e){return gV(qG,e)}const WG=de("ZodUnknown",(e,t)=>{aK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>qV()});function Kb(){return vV(WG)}const KG=de("ZodNever",(e,t)=>{lK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>$V(e,n,i)});function DM(e){return yV(KG,e)}const VG=de("ZodArray",(e,t)=>{x1(),dK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>ZV(e,n,i,s),e.element=t.element},{min(e,t){return this.check(nm(e,t))},nonempty(e){return this.check(nm(1,e))},max(e,t){return this.check(gM(e,t))},length(e,t){return this.check(vM(e,t))},unwrap(){return this.element}});function wn(e,t){return DV(VG,e,t)}const AM=de("ZodObject",(e,t)=>{x1(),pK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>YV(e,n,i,s),hq(e,"shape",n=>n._zod.def.shape,!1)},{keyof(){return Ge(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ir(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ir(this._zod.def,{catchall:Kb()}))},loose(){return this.clone(ir(this._zod.def,{catchall:Kb()}))},strict(){return this.clone(ir(this._zod.def,{catchall:DM()}))},strip(){return this.clone(ir(this._zod.def,{catchall:void 0}))},extend(e){return tq(this,e)},safeExtend(e){return nq(this,e)},merge(e){return iq(this,e)},pick(e){return J$(this,e)},omit(e){return eq(this,e)},partial(...e){return oN(jM,this,e[0])},exactPartial(...e){return oN(zM,this,e[0],"exactPartial")},required(...e){return rq(MM,this,e[0])}});function pe(e,t){const n={type:"object",shape:e??{},...ze(t)};return new AM(n)}function Kt(e,t){return new AM({type:"object",shape:e,catchall:DM(),...ze(t)})}const OM=de("ZodUnion",(e,t)=>{hM.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>XV(e,n,i,s),e.options=t.options});function Ds(e,t){return new OM({type:"union",options:e,...ze(t)})}const GG=de("ZodDiscriminatedUnion",(e,t)=>{OM.init(e,t),gK.init(e,t)});function w1(e,t,n){return new GG({type:"union",options:t,discriminator:e,...ze(n)})}const ZG=de("ZodIntersection",(e,t)=>{vK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>QV(e,n,i,s)});function YG(e,t){return new ZG({type:"intersection",left:e,right:t})}const Vb=de("ZodEnum",(e,t)=>{yK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(i,s,a)=>WV(e,i,s),e.enum=t.entries,e.options=[...e._zod.values];const n=new Set(Object.keys(t.entries));e.extract=(i,s)=>{const a={};for(const l of i)if(n.has(l))a[l]=t.entries[l];else throw new Error(`Key ${l} not found in enum`);return new Vb({...t,checks:[],...ze(s),entries:a})},e.exclude=(i,s)=>{const a={...t.entries};for(const l of i)if(n.has(l))delete a[l];else throw new Error(`Key ${l} not found in enum`);return new Vb({...t,checks:[],...ze(s),entries:a})}});function Ge(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Vb({type:"enum",entries:n,...ze(t)})}const XG=de("ZodLiteral",(e,t)=>{_K.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>KV(e,n,i,s),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Ce(e,t){return new XG({type:"literal",values:Array.isArray(e)?e:[e],...ze(t)})}const QG=de("ZodTransform",(e,t)=>{x1(),bK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>GV(e,n,i,s),e._zod.parse=(n,i)=>{if(i.direction==="backward")throw new Xz(e.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(Hd(a,n.value,t));else{const l=a;l.fatal&&(l.continue=!1),l.code??(l.code="custom"),"input"in l||(l.input=n.value),l.inst??(l.inst=e),n.issues.push(Hd(l))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(a=>(n.value=a,n)):(n.value=s,n)}});function JG(e){return new QG({type:"transform",transform:e})}const jM=de("ZodOptional",(e,t)=>{fM.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>RM(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function MN(e){return new jM({type:"optional",innerType:e})}const zM=de("ZodExactOptional",(e,t)=>{xK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>RM(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function eZ(e){return new zM({type:"optional",innerType:e})}const tZ=de("ZodNullable",(e,t)=>{SK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>JV(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function IN(e){return new tZ({type:"nullable",innerType:e})}const nZ=de("ZodDefault",(e,t)=>{wK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>tG(e,n,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function iZ(e,t){return new nZ({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():qz(t)}})}const rZ=de("ZodPrefault",(e,t)=>{CK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>nG(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function sZ(e,t){return new rZ({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():qz(t)}})}const MM=de("ZodNonOptional",(e,t)=>{kK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>eG(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function oZ(e,t){return new MM({type:"nonoptional",innerType:e,...ze(t)})}const aZ=de("ZodCatch",(e,t)=>{EK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>iG(e,n,i,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function lZ(e,t){return new aZ({type:"catch",innerType:e,catchValue:typeof t=="function"?t:pq(t)})}const cZ=de("ZodPipe",(e,t)=>{NK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>rG(e,n,i,s),e.in=t.in,e.out=t.out});function PN(e,t){return new cZ({type:"pipe",in:e,out:t})}const uZ=de("ZodReadonly",(e,t)=>{RK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>sG(e,n,i,s),e.unwrap=()=>e._zod.def.innerType});function dZ(e){return new uZ({type:"readonly",innerType:e})}const hZ=de("ZodCustom",(e,t)=>{TK.init(e,t),on.init(e,t),e._zod.processJSONSchema=(n,i,s)=>VV(e,n,i,s)});function fZ(e,t={}){return AV(hZ,e,t)}function pZ(e,t){return OV(e,t)}function lo(e){return pV(S1,e)}const mZ=Ge(["project","default","session"]),rm=V().min(1).max(128),C1=Ds([pe({workspace:Ce("default")}).strict(),pe({projectId:rm}).strict(),pe({sessionId:rm}).strict()]),Br=V().min(1).max(4096).refine(e=>{const t=e.replaceAll("\\","/");return!t.startsWith("/")&&!t.includes("\0")&&t.split("/").every(n=>n!==".."&&!n.includes(":"))},"Expected a relative path inside the authorized root").transform(e=>e.replaceAll("\\","/")),io=V().regex(/^[a-f0-9]{64}$/);pe({scope:C1,path:Br,content:V().max(1024*1024),expectedVersion:io}).strict();Ds([pe({workspace:Ce("default"),path:Br,version:io.optional()}).strict(),pe({projectId:rm,path:Br,version:io.optional()}).strict(),pe({sessionId:rm,path:Br,version:io.optional()}).strict()]);pe({path:Br.default("."),limit:lo().int().min(1).max(200).default(50),cursor:V().min(1).max(2048).optional()}).strict();const IM=pe({path:V(),realPath:V(),content:V(),version:io,size:Ae().int().nonnegative(),encoding:Ce("utf-8")}),gZ=IM.omit({content:!0,encoding:!0}).extend({previousVersion:io}),vZ=pe({path:V(),name:V(),type:Ge(["file","directory"]),size:Ae().int().nonnegative().optional()}),yZ=pe({items:wn(vZ),nextCursor:V().nullable(),revision:io}),_Z=pe({kind:Ce("file"),scope:C1,path:Br,version:io.optional()}).strict(),PM=pe({executable:V().min(1).max(4096).refine(e=>!e.includes("\0")),args:wn(V().max(8192).refine(e=>!e.includes("\0"))).max(256),cwd:Br.default("."),timeoutMs:Ae().int().min(1).max(6e5).default(12e4)}).strict().refine(e=>e.args.reduce((t,n)=>t+n.length,e.executable.length)<=65536),LM=Ge(["CREATED","RUNNING","CANCELLING","COMPLETED","FAILED","CANCELLED","TIMED_OUT","INTERRUPTED"]);pe({after:lo().int().min(0).max(Number.MAX_SAFE_INTEGER).default(0),limit:lo().int().min(1).max(500).default(100)}).strict();const BM=pe({cursor:Ae().int().positive(),data:V().max(16*1024).refine(e=>new TextEncoder().encode(e).byteLength<=16*1024),channel:Ge(["stdout","stderr"]),timestamp:Ae().int()}).strict(),bZ=pe({status:LM,exitCode:Ae().int().nullable(),reasonCode:V().nullable(),truncated:Qt(),startedAt:Ae().nullable(),endedAt:Ae().nullable()});pe({}).strict();const $c=V().regex(/^cmd_[a-f0-9-]{36}$/);pe({topic:Ce("command"),resourceId:$c,after:Ae().int().min(0).max(Number.MAX_SAFE_INTEGER).default(0)}).strict();const FM=pe({kind:Ce("event"),protocolVersion:Ce(1),topic:Ce("command"),eventId:V(),streamId:$c,resourceId:$c,sequence:Ae().int().nonnegative(),timestamp:Ae(),type:Ce("command.status"),payload:bZ}),LN=pe({id:$c,scope:pe({projectId:V()}).strict().or(pe({sessionId:V()}).strict()),status:LM,exitCode:Ae().nullable(),reasonCode:V().nullable(),truncated:Qt(),startedAt:Ae().nullable(),endedAt:Ae().nullable(),currentSequence:Ae().int().nonnegative()}),xZ=pe({chunks:wn(BM).max(500),oldestCursor:Ae().int().positive(),nextCursor:Ae().int().nonnegative(),truncated:Qt(),resyncRequired:Qt()}),SZ=BM.extend({kind:Ce("command.output"),resourceId:$c}).strict(),wZ=["trace","debug","info","warn","error","fatal"],CZ=["stable","beta"],kZ=Ge(wZ),EZ=Ge(CZ);function NZ(e){let t;try{t=new URL(e)}catch{return!1}return(t.protocol==="http:"||t.protocol==="https:")&&t.username===""&&t.password===""&&t.pathname==="/"&&t.search===""&&t.hash===""}const UM=V().max(2048).refine(NZ,"must be an http(s) origin without path, query or credentials"),RZ=Kt({host:V().min(1).max(255),port:Ve().min(1).max(65535),publicUrl:UM.nullable(),trustedProxies:wn(V().min(1)).max(64)}),TZ=Kt({sessionTtlMinutes:Ve().min(1).max(43200),idleTtlMinutes:Ve().min(1).max(43200),requireHttpsForRemote:Qt()}),DZ=Kt({rpId:V().min(1).max(253),rpName:V().min(1).max(128),origin:UM}),AZ=Kt({level:kZ,retentionDays:Ve().min(1).max(3650)}),OZ=Kt({channel:EZ,autoCheck:Qt(),autoInstall:Qt()}),jZ=Kt({enabled:Qt(),port:Ae().int().min(1).max(65535).default(3211)});Kt({version:Ce(1),server:RZ,auth:TZ,webauthn:DZ,logging:AZ,updates:OZ,preview:jZ});pe({action:Ge(["start","stop","restart"]),expectedPm2Name:V().min(1).max(256),requestKey:V().min(1).max(256),confirmed:Ce(!0)}).strict();const ya="[0-9a-f-]{36}",di=V().regex(new RegExp(`^tgt_${ya}$`)),HM=V().regex(new RegExp(`^bld_${ya}$`)),Cs=V().regex(new RegExp(`^art_${ya}$`)),eh=V().regex(new RegExp(`^plan_${ya}$`)),k1=V().trim().min(1).max(80).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/,"must be a simple service name"),Ii=V().trim().min(1).max(64).regex(/^[A-Za-z0-9][A-Za-z0-9._+-]*$/,"must be a simple version label");function E1(e){for(const t of e){const n=t.codePointAt(0)??0;if(n<=31||n===127)return!0}return!1}const zZ=e=>!E1(e);function $M(e,t){return!e||e.length>1024||E1(e)||e.includes("\\")?!1:e==="."?t:e.startsWith("/")||/^[A-Za-z]:/.test(e)?!1:e.split("/").every(n=>n.length>0&&n!=="."&&n!=="..")}const qM=V().min(1).max(1024).refine(e=>$M(e,!0),"must be a relative path inside the project"),MZ=V().min(1).max(1024).refine(e=>$M(e,!1),"must be a relative directory inside the project"),IZ=V().min(1).max(1024).refine(e=>e.startsWith("/")&&!e.includes("..")&&!E1(e),"must be an absolute HTTP path without traversal"),WM=wn(V().min(1).max(4096).refine(zZ,"must not contain control characters")).min(1).max(64),PZ=Kt({command:WM,cwd:qM.default("."),outputDir:MZ,timeoutMs:Ve().min(1e3).max(6e5).default(3e5)}),LZ=Kt({command:WM,cwd:qM.default(".")}),KM=Kt({path:IZ,port:Ve().min(1024).max(65535),timeoutMs:Ve().min(1e3).max(12e4).default(3e4),intervalMs:Ve().min(100).max(1e4).default(500)}),BZ=Kt({strategy:Ge(["restart","none"]),maxAttempts:Ve().min(0).max(10).default(3)}),FZ=Kt({version:Ii,build:PZ,start:LZ,health:KM,recovery:BZ});Ds([Kt({targetId:di}),Kt({name:k1})]);const VM=Kt({branch:V().max(255).nullable(),commit:V().max(128).nullable(),dirty:Qt().nullable()});pe({id:di,projectId:V().min(1).max(128),name:k1,currentArtifactId:Cs.nullable(),currentVersion:Ii.nullable(),createdAt:Ve(),updatedAt:Ve()});const UZ=Ge(["RUNNING","SUCCEEDED","FAILED","CANCELLED"]);pe({id:HM,targetId:di,projectId:V().min(1).max(128),status:UZ,spec:FZ,specHash:V().regex(/^[a-f0-9]{64}$/),reasonCode:V().max(64).nullable(),logRef:V().min(1).max(1024),startedAt:Ve().nullable(),endedAt:Ve().nullable(),createdAt:Ve()});pe({id:Cs,buildId:HM,targetId:di,projectId:V().min(1).max(128),version:Ii,artifactHash:V().regex(/^[a-f0-9]{64}$/),sizeBytes:Ve().nonnegative(),fileCount:Ve().nonnegative(),source:VM,createdAt:Ve()});const HZ=Ge(["READY","WAITING_APPROVAL","AUTHORIZED","APPLYING","HEALTH_CHECK","SUCCEEDED","FAILED","CANCELLED","EXPIRED","INVALIDATED","UNKNOWN"]),$Z=Kt({strategy:Ge(["restart","none"]),maxAttempts:Ve().min(0).max(10),previousArtifactAvailable:Qt(),databaseRollback:Ce("unsupported")}),qZ=Kt({scope:Ce("single-service"),firstDeploy:Qt(),restartRequired:Ce(!0),downtime:Ce("brief"),replacesVersion:Ii.nullable(),replacesArtifact:Cs.nullable()}),WZ=Kt({version:Ce(1),targetId:di,projectId:V().min(1).max(128),artifactId:Cs,artifactHash:V().regex(/^[a-f0-9]{64}$/),artifactVersion:Ii,previousArtifactId:Cs.nullable(),previousVersion:Ii.nullable(),specHash:V().regex(/^[a-f0-9]{64}$/),source:VM,health:KM,recovery:$Z,impact:qZ,expiresAt:Ve().positive()});pe({id:eh,targetId:di,projectId:V().min(1).max(128),artifactId:Cs,previousArtifactId:Cs.nullable(),previousVersion:Ii.nullable(),version:Ii,status:HZ,plan:WZ,planHash:V().regex(/^[a-f0-9]{64}$/),expiresAt:Ve(),requestedBy:V().min(1).max(128),createdAt:Ve()});const N1=V().regex(new RegExp(`^dauth_${ya}$`)),GM=V().regex(new RegExp(`^dapv_${ya}$`)),R1=Ge(["apply","start","stop","restart","recover"]),T1=Ge(["standard","strict","readonly","autonomous"]),KZ=Kt({type:Ge(["human","agent"]),id:V().min(1).max(128)});Kt({domain:Ce("service-ops"),projectId:V().min(1).max(128),targetId:di,action:R1.default("apply"),policy:T1,policySnapshotId:V().min(1).max(128),actor:KZ,clientSessionId:V().min(1).max(128).nullable().default(null),sessionId:V().min(1).max(128).nullable().default(null),turnId:V().min(1).max(128).nullable().default(null)});const VZ=Kt({domain:Ce("service-ops"),projectId:V().min(1).max(128),targetId:di,planId:eh,action:R1,planHash:V().regex(/^[a-f0-9]{64}$/),artifactHash:V().regex(/^[a-f0-9]{64}$/)}),GZ=Ge(["PENDING","AUTHORIZED","DENIED","EXPIRED","REVOKED","CONSUMED","INVALIDATED"]),ZZ=Ge(["PENDING","APPROVED","DENIED","EXPIRED","REVOKED"]);pe({id:N1,planId:eh,targetId:di,projectId:V().min(1).max(128),action:R1,actorType:Ge(["human","agent"]),actorId:V().min(1).max(128),clientSessionId:V().min(1).max(128).nullable(),sessionId:V().min(1).max(128).nullable(),turnId:V().min(1).max(128).nullable(),policy:T1,policySnapshotId:V().min(1).max(128),status:GZ,planHash:V().regex(/^[a-f0-9]{64}$/),artifactHash:V().regex(/^[a-f0-9]{64}$/),scope:VZ,scopeHash:V().regex(/^[a-f0-9]{64}$/),approvalId:GM.nullable(),expiresAt:Ve(),decidedAt:Ve().nullable(),consumedAt:Ve().nullable(),reasonCode:V().max(64).nullable(),createdAt:Ve()});pe({id:GM,authorizationId:N1,planId:eh,targetId:di,projectId:V().min(1).max(128),status:ZZ,planHash:V().regex(/^[a-f0-9]{64}$/),artifactHash:V().regex(/^[a-f0-9]{64}$/),requestedBy:V().min(1).max(128),decidedBy:V().min(1).max(128).nullable(),expiresAt:Ve(),decidedAt:Ve().nullable(),createdAt:Ve()});const ZM=V().regex(new RegExp(`^dep_${ya}$`)),YM=Ge(["running","stopped"]),D1=Ge(["stopped","starting","running","unhealthy","stopping","failed","unknown"]),XM=pe({targetId:di,projectId:V().min(1).max(128),name:k1,pm2Name:V().min(1).max(256),projectName:V().nullable(),source:Ge(["pm2-cli","deployment"]),version:Ii.nullable(),artifactHash:V().regex(/^[a-f0-9]{64}$/).nullable(),desiredState:YM,observedState:D1,pid:Ve().positive().nullable(),lastHealthAt:Ve().nullable(),reasonCode:V().max(64).nullable(),updatedAt:Ve()}),YZ=pe({pm2Home:V().min(1).max(4096).optional(),items:wn(XM),unassociated:wn(pe({pm2Name:V(),reason:V()}))}),XZ=Ge(["APPLYING","HEALTH_CHECK","SUCCEEDED","FAILED","UNKNOWN"]);pe({id:ZM,targetId:di,planId:eh,authorizationId:N1,artifactId:Cs,previousArtifactId:Cs.nullable(),previousVersion:Ii.nullable(),version:Ii,status:XZ,planHash:V().regex(/^[a-f0-9]{64}$/),artifactHash:V().regex(/^[a-f0-9]{64}$/),reasonCode:V().max(64).nullable(),startedAt:Ve(),endedAt:Ve().nullable(),createdAt:Ve()});pe({topic:Ce("service-ops"),resourceId:di,after:Ve().min(0).max(Number.MAX_SAFE_INTEGER).default(0)}).strict();pe({observedState:D1,desiredState:YM,version:Ii.nullable(),artifactHash:V().regex(/^[a-f0-9]{64}$/).nullable(),pid:Ve().positive().nullable(),deploymentId:ZM.nullable(),reasonCode:V().max(64).nullable()});const QZ=V().regex(new RegExp(`^sauth_${ya}$`)),QM=Ge(["start","stop","restart","recover"]),JZ=Ge(["PENDING","AUTHORIZED","DENIED","EXPIRED","REVOKED","CONSUMED"]);Kt({domain:Ce("service-ops"),projectId:V().min(1).max(128),targetId:di,action:QM,artifactHash:V().regex(/^[a-f0-9]{64}$/),version:Ii});pe({id:QZ,targetId:di,projectId:V().min(1).max(128),action:QM,actorType:Ge(["human","agent"]),actorId:V().min(1).max(128),clientSessionId:V().min(1).max(128).nullable(),sessionId:V().min(1).max(128).nullable(),turnId:V().min(1).max(128).nullable(),policy:T1,policySnapshotId:V().min(1).max(128),status:JZ,artifactHash:V().regex(/^[a-f0-9]{64}$/),version:Ii,scopeHash:V().regex(/^[a-f0-9]{64}$/),expiresAt:Ve(),decidedAt:Ve().nullable(),decidedBy:V().min(1).max(128).nullable(),consumedAt:Ve().nullable(),reasonCode:V().max(64).nullable(),createdAt:Ve()});Kt({version:Ce(1),artifactId:Cs,targetId:di,hash:V().regex(/^[a-f0-9]{64}$/),files:wn(Kt({path:V().min(1).max(1024),size:Ve().nonnegative(),hash:V().regex(/^[a-f0-9]{64}$/)}))});pe({available:Qt(),nodeExecutable:V(),entry:V().nullable(),version:V().nullable(),home:V(),namespace:Ce("larness"),serviceNamePattern:Ce("larness:<projectId>:<serviceKey>"),project:pe({id:V(),name:V(),root:V(),releaseRoot:V()}).nullable(),unassociatedServices:wn(pe({pm2Name:V(),reason:V()})).optional(),services:wn(pe({projectId:V(),projectName:V(),name:V(),pm2Name:V(),observedState:D1,pid:Ve().nullable(),updatedAt:Ve()}))});const Gb="prj_default",eY=Qt().default(!1),tY="workspace.sessions.changed",nY="workspace.jobs.changed",iY=w1("kind",[pe({kind:Ce("subscribed"),subscription:pe({topic:Ce("system"),resourceId:Ce("system")})}),pe({kind:Ce(tY)})]),rY=pe({kind:Ce(nY)}),A1=V().min(1).max(4096).refine(e=>!e.includes("\0"),"Git path cannot contain NUL"),JM=V().min(1).max(255).refine(e=>!e.includes("\0")&&!e.startsWith("-"),"Invalid branch name"),sY=pe({action:Ce("add"),paths:wn(A1).min(1).max(200)}).strict(),oY=pe({action:Ce("unstage"),paths:wn(A1).min(1).max(200)}).strict(),aY=pe({action:Ce("discard"),path:A1,confirmed:Ce(!0)}).strict(),lY=pe({action:Ce("commit"),message:V().min(1).max(4e3)}).strict(),cY=pe({action:Ce("createBranch"),name:JM}).strict(),uY=pe({action:Ce("switchBranch"),name:JM}).strict(),dY=pe({action:Ce("pull")}).strict(),hY=pe({action:Ce("push")}).strict();Ds([sY,oY,aY,lY,cY,uY,dY,hY]);pe({decision:Ge(["approve","reject"])}).strict();pe({path:V().min(1).max(4096),staged:Ge(["true","false"]).default("false")}).strict();pe({limit:lo().int().min(1).max(100).default(50),cursor:lo().int().nonnegative().default(0)}).strict();pe({limit:lo().int().min(1).max(200).default(100),cursor:lo().int().nonnegative().default(0)}).strict();Ge(["script","agent"]);const e3=Ge(["skip","run_once"]),t3=Ge(["readonly","autonomous"]);Ge(["scheduled","manual","catch_up"]);Ge(["queued","running","succeeded","failed","timed_out","cancelled","interrupted","skipped"]);Ge(["JOB_SCRIPT_FAILED","JOB_TIMEOUT","JOB_RUN_CANCELLED","JOB_AGENT_FAILED","JOB_INTERRUPTED","JOB_OVERLAP"]);const fY=V().min(9).max(128).refine(e=>e.trim().split(/\s+/).length===5,"Cron 必须是 5 字段"),BN=V().min(1).max(64),n3=w1("type",[pe({type:Ce("cron"),expression:fY,timezone:BN}).strict(),pe({type:Ce("interval"),seconds:Ae().int().min(60).max(604800),timezone:BN}).strict()]),i3={name:V().trim().min(1).max(80),projectId:V().min(1).max(128).nullable(),schedule:n3,enabled:Qt().default(!0),timeoutSeconds:Ae().int().min(60).max(3600).default(600),missedPolicy:e3.default("skip")},pY=pe({...i3,kind:Ce("script"),script:pe({source:V().min(1).max(65536)}).strict()}).strict(),mY=pe({...i3,kind:Ce("agent"),agent:pe({prompt:V().trim().min(1).max(10240),model:V().min(1).max(128).nullable().optional(),credentialProfileId:V().min(1).max(128).nullable().optional(),thinking:V().min(1).max(32).nullable().optional(),approvalPolicy:t3.default("readonly")}).strict()}).strict();w1("kind",[pY,mY]);pe({name:V().trim().min(1).max(80).optional(),enabled:Qt().optional(),schedule:n3.optional(),timeoutSeconds:Ae().int().min(60).max(3600).optional(),missedPolicy:e3.optional(),script:pe({source:V().min(1).max(65536)}).strict().optional(),agent:pe({prompt:V().trim().min(1).max(10240).optional(),model:V().min(1).max(128).nullable().optional(),credentialProfileId:V().min(1).max(128).nullable().optional(),thinking:V().min(1).max(32).nullable().optional(),approvalPolicy:t3.optional()}).strict().optional()}).strict();const gY=pe({id:V().min(1).max(80),title:V().trim().min(1).max(200),detail:V().max(500).optional(),status:Ge(["pending","running","done","failed"])}).strict(),vY=pe({title:V().trim().min(1).max(200),steps:wn(gY).min(1).max(12)}).strict().superRefine((e,t)=>{new Set(e.steps.map(n=>n.id)).size!==e.steps.length&&t.addIssue({code:"custom",message:"Step IDs must be unique"}),e.steps.filter(n=>n.status==="running").length>1&&t.addIssue({code:"custom",message:"Only one step can be running"})}),yY=vY.safeExtend({id:V().min(1),kind:Ce("plan"),createdAt:Ae().int().nonnegative(),turnId:V().optional()}),Wn=V().regex(/^term_[a-f0-9-]{36}$/);pe({title:V().min(1).max(80).refine(e=>[...e].every(t=>{const n=t.codePointAt(0)??0;return n>=32&&(n<127||n>159)})).transform(e=>e.trim()).pipe(V().min(1))}).strict();const r3=V().regex(/^[a-zA-Z0-9_-]{1,64}$/),s3=Ge(["CREATED","RUNNING","STOPPING","EXITED","TERMINATED","INTERRUPTED"]);pe({scope:C1.optional(),cwd:Br.default("."),sourceSessionId:V().min(1).max(128).optional(),riskAcknowledged:Ce(!0)}).strict();pe({role:r3,executable:V(),args:wn(V()),cwd:Br.default(".").describe("Project-relative working directory. Defaults to the project root (.). Use the package directory for a direct package command.")}).strict().superRefine((e,t)=>{PM.safeParse(e&&{executable:e.executable,args:e.args,cwd:e.cwd}).success||t.addIssue({code:"custom",message:"Invalid program parameters"})});pe({terminalId:Wn,after:Ae().int().nonnegative().max(Number.MAX_SAFE_INTEGER).default(0),limit:Ae().int().min(1).max(500).default(100)}).strict();pe({terminalId:Wn}).strict();const O1=pe({kind:Ce("terminal"),projectId:V().min(1),terminalId:Wn,role:r3.nullable()}).strict(),_Y=pe({kind:Ce("preview"),projectId:V().min(1).max(128),serviceId:V().regex(/^svc_[a-f0-9-]{36}$/),path:V().min(1).max(2048),name:V().min(1).max(128).optional()}).strict(),bY=Ds([_Z,O1,_Y]);pe({connectionId:V().uuid()}).strict();pe({terminalId:Wn}).strict();pe({terminalId:Wn,leaseGeneration:Ae().int().positive(),inputSequence:Ae().int().positive().max(Number.MAX_SAFE_INTEGER),data:V().min(1).max(8192).refine(e=>new TextEncoder().encode(e).length<=8192)}).strict();pe({terminalId:Wn,leaseGeneration:Ae().int().positive()}).strict();pe({terminalId:Wn,leaseGeneration:Ae().int().positive()}).strict();pe({action:Ge(["acquire","renew","release"]),connectionId:V().uuid(),leaseGeneration:Ae().int().positive().optional()}).strict();pe({connectionId:V().uuid(),leaseGeneration:Ae().int().positive(),cols:Ae().int().min(2).max(500),rows:Ae().int().min(1).max(300)}).strict();pe({type:Ce("terminal.input"),terminalId:Wn,leaseGeneration:Ae().int().positive(),inputSequence:Ae().int().positive().max(Number.MAX_SAFE_INTEGER),data:V().max(8192).refine(e=>new TextEncoder().encode(e).length<=8192)}).strict();pe({topic:Ce("terminal"),resourceId:Wn,after:Ae().int().nonnegative().max(Number.MAX_SAFE_INTEGER).default(0)}).strict();const o3=pe({cursor:Ae().int().positive(),data:V().max(16384).refine(e=>new TextEncoder().encode(e).length<=16384),timestamp:Ae().int()}).strict(),xY=o3.extend({kind:Ce("terminal.output"),resourceId:Wn}).strict(),a3=pe({ownerType:Ge(["human","agent"]),ownerClientSessionId:V(),ownerConnectionId:V().nullable(),ownerTurnId:V().nullable(),ownerExecutionId:V().nullable(),generation:Ae().int().positive(),expiresAt:Ae().int()}),SY=pe({status:s3,exitCode:Ae().int().nullable(),reasonCode:V().nullable(),lease:a3.nullable()}),l3=pe({kind:Ce("event"),protocolVersion:Ce(1),topic:Ce("terminal"),eventId:V(),streamId:Wn,resourceId:Wn,sequence:Ae().int().positive(),timestamp:Ae(),type:Ge(["terminal.created","terminal.status","terminal.exit","terminal.lease"]),payload:SY}),Gm=pe({writeBlocked:Qt(),id:Wn,projectId:V().nullable(),workspaceSessionId:V().nullable(),sourceSessionId:V().nullable(),cwd:V(),shell:V(),mode:Ge(["shell","dev"]),role:V().nullable(),title:V().nullable().default(null),status:s3,exitCode:Ae().nullable(),reasonCode:V().nullable(),currentSequence:Ae().int(),lease:a3.nullable()}),wY=pe({chunks:wn(o3).max(500),nextCursor:Ae().int(),oldestCursor:Ae().int(),truncated:Qt(),resyncRequired:Qt()}),CY=pe({kind:Ce("subscribed"),connectionId:V().uuid(),subscription:pe({topic:Ce("terminal"),resourceId:V()})}),kY=pe({kind:Ce("terminal.input.ack"),inputSequence:Ae().int(),accepted:Qt()}),EY=pe({kind:Ce("error"),code:V()}),NY=pe({items:wn(Gm),nextCursor:Wn.nullable()}),Zm=V().regex(/^svc_[a-f0-9-]{36}$/),c3=Ge(["REGISTERING","STARTING","RUNNING","UNKNOWN","UNREGISTERED"]),u3=Ce("temporary"),d3=pe({host:Ge(["127.0.0.1","::1"]),port:Ae().int().min(1).max(65535),protocol:Ce("http")}).strict(),RY=pe({kind:u3.describe("temporary development preview only; registration does not create a persistent PM2 service"),terminalId:Wn.describe("Managed terminal owning the real listening process; not a PM2 targetId or pm2Name"),name:V().trim().min(1).max(80),endpoint:d3.describe("Use the terminal listener's port and a loopback host value. The backend discovers the actual bind address, including wildcard listeners.")}).strict(),Ym=pe({id:Zm,projectId:V().min(1).max(128),sourceSessionId:V().min(1).max(128).nullable(),name:V().min(1).max(80),kind:u3,status:c3,terminalId:Wn,terminalExecutionId:V().min(1).max(128),endpointGeneration:Ae().int().nonnegative(),endpoint:d3,previewEligible:Qt(),reasonCode:V().nullable(),createdAt:Ae().int(),updatedAt:Ae().int(),endedAt:Ae().int().nullable()}),TY=pe({items:wn(Ym),nextCursor:V().nullable()}),j1=pe({id:V().min(1).max(128),projectId:V().min(1).max(128),kind:Ce("service.register"),risk:Ce("L2"),status:Ge(["PREPARED","WAITING_APPROVAL","APPROVED","RUNNING","COMPLETED","FAILED","REJECTED","EXPIRED","INTERRUPTED"]),params:RY,paramsHash:V(),snapshotVersion:V(),requestedBy:V(),decidedBy:V().nullable(),expiresAt:Ae().int(),decidedAt:Ae().int().nullable(),startedAt:Ae().int().nullable(),endedAt:Ae().int().nullable(),result:Kb(),createdAt:Ae().int()}),DY=pe({status:c3,terminalId:Wn,terminalExecutionId:V().min(1).max(128),endpointGeneration:Ae().int().nonnegative(),reasonCode:V().nullable()});pe({topic:Ce("service"),resourceId:Zm,after:Ae().int().min(0).max(Number.MAX_SAFE_INTEGER).default(0)}).strict();const h3=V().regex(/^(?:(?:project|session):[a-zA-Z0-9_-]{1,128}|workspace:default)$/),f3=V().regex(/^file:(?:(?:project|session):[a-zA-Z0-9_-]{1,128}|workspace:default)$/);pe({topic:Ce("file"),resourceId:h3,paths:wn(Br).min(1).max(128).default(["."]),after:Ae().int().min(0).max(Number.MAX_SAFE_INTEGER).default(0)}).strict();const AY=V().regex(/^ops:tgt_[0-9a-f-]{36}$/);pe({streamId:Ds([f3,$c,Wn,Zm,AY]),after:lo().int().min(0).max(Number.MAX_SAFE_INTEGER).default(0),limit:lo().int().min(1).max(500).default(100)}).strict();const OY=pe({path:Br,version:io.optional(),changeType:Ge(["created","modified","deleted"])}),jY=pe({reasonCode:Ge(["WATCH_UNAVAILABLE","WATCH_LIMIT","SCAN_LIMIT","QUEUE_OVERFLOW","ROOT_UNAVAILABLE","DIRECTORY_REPLACED","RECOVERED","SCAN_FAILED"])}),FN=pe({kind:Ce("event"),protocolVersion:Ce(1),topic:Ce("file"),eventId:V(),streamId:f3,sequence:Ae().int().nonnegative(),timestamp:Ae()}),p3=Ds([FN.extend({type:Ce("file.changed"),payload:OY}),FN.extend({type:Ce("file.resync.required"),payload:jY})]),zY=pe({kind:Ce("event"),protocolVersion:Ce(1),topic:Ce("service"),eventId:V(),streamId:Zm,sequence:Ae().int().nonnegative(),timestamp:Ae(),projectId:V().optional()}),MY=Ds([zY.extend({type:Ge(["service.registered","service.status","service.unregistered"]),payload:DY})]),IY=pe({items:wn(Ds([p3,FM,l3,MY])),currentSequence:Ae().int().nonnegative(),resyncRequired:Qt()}),PY=pe({kind:Ce("subscribed"),subscription:pe({topic:Ce("file"),resourceId:h3}),currentSequence:Ae().int().nonnegative(),resyncRequired:Qt(),partial:Qt()}),LY=pe({kind:Ce("error"),code:V(),message:V()});class rr extends Error{status;code;details;constructor(t,n,i,s){super(i),this.name="ApiError",this.status=t,this.code=n,this.details=s}}let m3=null;function Zb(e){m3=e}const BY="";async function we(e,t={}){const n={accept:"application/json",...t.headers};t.body!==void 0&&(n["content-type"]="application/json"),t.csrf&&(n["x-csrf-token"]=m3??"");const i=await fetch(`${BY}${e}`,{method:t.method??"GET",credentials:"same-origin",headers:n,body:t.body===void 0?void 0:JSON.stringify(t.body)}),s=await i.text();let a;if(s.length>0)try{a=JSON.parse(s)}catch{a=void 0}if(!i.ok){const l=a?.error,u=l?.code??"INTERNAL",f=l?.message??`Request failed with ${i.status}`;throw i.status===401&&e!=="/api/auth/session"&&window.dispatchEvent(new Event("larness:unauthenticated")),new rr(i.status,u,f,l?.details)}return a}async function FY(e){const t=e===void 0?"":`?path=${encodeURIComponent(e)}`;return we(`/api/fs/directories${t}`)}async function g3(){return(await we("/api/projects")).projects}async function UY(e){return we("/api/projects",{method:"POST",body:e,csrf:!0})}async function HY(e){await we(`/api/projects/${encodeURIComponent(e)}`,{method:"DELETE",csrf:!0})}async function $Y(e,t){await we(`/api/projects/${encodeURIComponent(e)}`,{method:"PATCH",body:t,csrf:!0})}async function qY(){return(await we("/api/models")).models}async function Cc(){return we("/api/models/catalog")}async function WY(e){await we("/api/models/default",{method:"PUT",body:e,csrf:!0})}async function KY(e){await we("/api/models/catalog/visibility",{method:"PATCH",body:e,csrf:!0})}async function VY(){return we("/api/models/catalog/refresh",{method:"POST",body:{},csrf:!0})}async function GY(){return(await we("/api/credentials")).credentials}async function ZY(e){return we("/api/credentials",{method:"POST",body:e,csrf:!0})}async function YY(e,t){await v3(e,{endpoint:t})}async function v3(e,t){await we(`/api/credentials/${encodeURIComponent(e)}`,{method:"PATCH",body:t,csrf:!0})}async function XY(e){await we(`/api/credentials/${encodeURIComponent(e)}`,{method:"DELETE",csrf:!0})}async function QY(){return(await we("/api/sessions?limit=100")).sessions}async function JY(e){return we("/api/sessions",{method:"POST",body:e,csrf:!0})}async function y3(e){return we(`/api/sessions/${encodeURIComponent(e)}`)}async function Yb(e,t){return we(`/api/sessions/${encodeURIComponent(e)}`,{method:"PATCH",body:t,csrf:!0})}async function _3(e){await we(`/api/sessions/${encodeURIComponent(e)}`,{method:"DELETE",csrf:!0})}async function UN(e,t,n){return we(`/api/sessions/${encodeURIComponent(e)}/turns`,{method:"POST",body:t,csrf:!0,headers:{"idempotency-key":n}})}async function eX(e){return we(`/api/turns/${encodeURIComponent(e)}/cancel`,{method:"POST",body:{},csrf:!0})}async function tX(e,t=0,n=200){return we(`/api/sessions/${encodeURIComponent(e)}/events?after=${t}&limit=${n}`)}async function HN(e,t=0,n=200){const i=[];let s=t;for(;;){const a=await tX(e,s,n);if(i.push(...a.items),s=a.nextSeq,!a.hasMore)return i}}async function nX(e,t){await we(`/api/approvals/${encodeURIComponent(e)}`,{method:"POST",body:{decision:t},csrf:!0})}function iX(e){const t=["#0A84FF","#FF9F0A","#30D158","#BF5AF2","#64D2FF"],n=Array.from(e.id).reduce((i,s)=>i+s.charCodeAt(0),0);return{id:e.id,kind:e.kind,name:e.name,rootPath:e.realPath,branch:null,git:e.gitDetected,accent:t[n%t.length]??t[0]}}function rX(e){return{id:e.id,label:e.label,provider:e.provider==="openai-compatible"?"openai-compatible":"deepseek",model:e.model,detail:`${Math.round(e.capabilities.maxContextTokens/1e3)}K 上下文 · 工具调用`,maxContextTokens:e.capabilities.maxContextTokens}}function sX(e){return{workspaceKind:mZ.parse(e.workspaceKind??(e.projectId?"project":"session")),workspacePath:e.workspacePath,id:e.id,projectId:e.projectId,title:e.title,status:eY.parse(e.hasActiveTurn)?"running":"idle",updatedAt:e.updatedAt}}const qt=new i7({defaultOptions:{queries:{staleTime:Number.POSITIVE_INFINITY,refetchOnWindowFocus:!1,retry:!1}}}),b3={projects:[],sessions:[],models:[],host:{cpuPercent:0,memoryUsedGb:0,memoryTotalGb:0},services:[],terminals:[],gitChanges:[]};async function oX(){const[e,t,n]=await Promise.all([g3(),QY(),qY()]);return{...b3,projects:e.map(iX),sessions:t.map(sX),models:n.map(rX)}}function qr(){const e=Pt({queryKey:["workspace"],queryFn:oX,enabled:!Bc,staleTime:0}),t=e.data??b3;return{...e,data:t,isPending:e.isPending}}function aX(){const e=Pt({queryKey:["model-catalog"],queryFn:Cc,enabled:!Bc,staleTime:0,retry:!1});return{catalog:e.data,isPending:e.isPending,error:e.error,refetch:e.refetch}}function lX(e){return Pt({queryKey:["session-model",e],queryFn:()=>y3(e??""),enabled:e!==null,staleTime:0,retry:!1}).data??null}const $N=e=>{let t;const n=new Set,i=(h,g)=>{const m=typeof h=="function"?h(t):h;if(!Object.is(m,t)){const _=t;t=g??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(b=>b(t,_))}},s=()=>t,u={setState:i,getState:s,getInitialState:()=>f,subscribe:h=>(n.add(h),()=>n.delete(h))},f=t=e(i,s,u);return u},cX=(e=>e?$N(e):$N),uX=e=>e;function dX(e,t=uX){const n=xp.useSyncExternalStore(e.subscribe,xp.useCallback(()=>t(e.getState()),[e,t]),()=>t(e.getInitialState()));return xp.useDebugValue(n),n}const qN=e=>{const t=cX(e),n=i=>dX(t,i);return Object.assign(n,t),n},eu=(e=>e?qN(e):qN);function hX(e,t){let n;try{n=e()}catch{return}return{getItem:s=>{var a;const l=f=>f===null?null:JSON.parse(f,void 0),u=(a=n.getItem(s))!=null?a:null;return u instanceof Promise?u.then(l):l(u)},setItem:(s,a)=>n.setItem(s,JSON.stringify(a,void 0)),removeItem:s=>n.removeItem(s)}}const Xb=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(i){return Xb(i)(n)},catch(i){return this}}}catch(n){return{then(i){return this},catch(i){return Xb(i)(n)}}}},fX=(e,t)=>(n,i,s)=>{let a={storage:hX(()=>window.localStorage),partialize:C=>C,version:0,merge:(C,k)=>({...k,...C}),...t},l=!1,u=0;const f=new Set,h=new Set;let g=a.storage;if(!g)return e((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...C)},i,s);const m=()=>{const C=a.partialize({...i()});return g.setItem(a.name,{state:C,version:a.version})},_=s.setState;s.setState=(...C)=>(_(...C),m());const b=e((...C)=>(n(...C),m()),i,s);s.getInitialState=()=>b;let x;const S=()=>{var C,k;if(!g)return;const R=++u;l=!1,f.forEach(A=>{var I;return A((I=i())!=null?I:b)});const N=((k=a.onRehydrateStorage)==null?void 0:k.call(a,(C=i())!=null?C:b))||void 0;return Xb(g.getItem.bind(g))(a.name).then(A=>{if(A)if(typeof A.version=="number"&&A.version!==a.version){if(a.migrate){const I=a.migrate(A.state,A.version);return I instanceof Promise?I.then(T=>[!0,T]):[!0,I]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,A.state];return[!1,void 0]}).then(A=>{var I;if(R!==u)return;const[T,D]=A;if(x=a.merge(D,(I=i())!=null?I:b),n(x,!0),T)return m()}).then(()=>{R===u&&(N?.(i(),void 0),x=i(),l=!0,h.forEach(A=>A(x)))}).catch(A=>{R===u&&N?.(void 0,A)})};return s.persist={setOptions:C=>{a={...a,...C},C.storage&&(g=C.storage)},clearStorage:()=>{++u,g?.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:C=>(f.add(C),()=>{f.delete(C)}),onFinishHydration:C=>(h.add(C),()=>{h.delete(C)})},a.skipHydration||S(),x||b},x3=fX,Qa=new Map;function p_(e){Qa.get(e)?.cancel(),Qa.delete(e)}function pX(e,t){if(Qa.has(e))return;const n=document.querySelector(`[data-window-frame="${CSS.escape(e)}"]`),i=document.querySelector('[aria-label="项目窗口"]');if(!n?.animate||!i||window.matchMedia?.("(prefers-reduced-motion: reduce)").matches){t();return}const s=n.getBoundingClientRect(),a=i.getBoundingClientRect(),l=getComputedStyle(n).transform,u=l&&l!=="none"?`${l} `:"",f=n.animate([{transform:`${u}translate(0, 0) scale(1)`,opacity:1,pointerEvents:"none"},{transform:`${u}translate(${a.x+a.width/2-s.x-s.width/2}px, ${a.y+a.height/2-s.y-s.height/2}px) scale(.08)`,opacity:0,pointerEvents:"none"}],{duration:200,easing:"cubic-bezier(.4,0,.2,1)",fill:"forwards"});Qa.set(e,f),f.finished.then(()=>{Qa.get(e)===f&&t()}).catch(()=>{}).finally(()=>{Qa.get(e)===f&&Qa.delete(e),f.cancel()})}function Op(e,t){return t.mode==="all"?!0:t.mode==="global"?e.projectId===null:e.projectId===t.projectId}function Dd(e,t){return e.filter(n=>Op(n,t))}function Rc(e,t){if(e[0]?.kind==="terminal"){const n=e.filter(i=>i.resourceId!=="terminal:empty");return n.find(i=>i.id===t)??n.at(-1)??e[0]}return e.find(n=>n.id===t)??e[0]}function WN(e,t){let n=e.length;for(let s=e.length-1;s>=0;s-=1)if(e[s]?.projectId===t.projectId){n=s+1;break}const i=[...e];return i.splice(n,0,t),i}const KN=420,VN=280,xr=8,mX={files:{width:760,height:520},terminal:{width:680,height:420},services:{width:620,height:460},browser:{width:760,height:540},"git-diff":{width:720,height:480}};function S3(e,t){const n=Math.max(KN,Math.min(e.width,Math.max(KN,t.width-xr*2))),i=Math.max(VN,Math.min(e.height,Math.max(VN,t.height-xr*2))),s=Math.max(xr,t.width-n-xr),a=Math.max(xr,t.height-i-xr);return{width:n,height:i,x:Math.min(Math.max(xr,e.x),s),y:Math.min(Math.max(xr,e.y),a)}}function gX(e,t,n){const i=mX[e],s=Math.min(i.width,n.width-xr*2),a=Math.min(i.height,n.height-xr*2),l=t%5*28;return S3({width:s,height:a,x:Math.max(xr,n.width-s-56-l),y:Math.max(xr,32+l)},n)}function z1(e,t=null){return e?`project:${e}`:t?`session:${t}`:"global"}function Tc(e){const t=e.tabs[0];return z1(t?.projectId??null,t?.sourceSessionId??null)}function GN(){return{width:window.innerWidth,height:Math.max(480,window.innerHeight-48)}}function ZN(e){return`${e}_${crypto.randomUUID()}`}function m_(e){return e.reduce((t,n)=>Math.max(t,n.z),0)}function YN(e){return!e||e==="header"?"global":e}function vX(e,t){return!e||e==="header"?null:t?{mode:"project",projectId:t}:{mode:"global"}}const yX=new Set(["ter_1","svc_web_dev","browser_preview"]);function _X(e){return e.projectId==="prj_larness"||yX.has(e.resourceId)||e.kind==="services"&&e.resourceId.startsWith("svc_")||e.kind==="browser"&&e.browser===void 0||e.kind==="files"&&e.file===void 0||e.kind==="git-diff"&&e.git===void 0}function bX(e,t){const n=e??{};if(!Array.isArray(n.windows))return e;const i=Date.now();let s=0;const a=n.windows.flatMap(u=>{const f=u.tabs.filter(g=>!_X(g)).map(g=>({...g,viewKey:g.viewKey??(g.kind==="files"&&g.file?`file:${g.resourceId}`:g.kind==="git-diff"&&g.git?`diff:${g.projectId}:${g.git.path}`:g.kind==="browser"&&g.browser?`browser:${g.browser.serviceId}:${g.browser.path}`:`${g.kind}:${g.resourceId}`),createdAt:g.createdAt??i+s++}));if(!f.length)return[];const h=new Map;for(const g of f){const m=`${g.kind}:${z1(g.projectId,g.sourceSessionId)}`;h.set(m,[...h.get(m)??[],g])}return[...h.values()].map((g,m)=>({...u,id:m===0?u.id:`${u.id}:scope:${m}`,tabs:g,filter:{mode:"all"},activeTabId:Rc(g,u.activeTabId)?.id??null}))}),l=a.some(u=>u.id===n.focusedId)?n.focusedId??null:a.at(-1)?.id??null;return{windows:a,focusedId:l,zCounter:n.zCounter??10,lastFilters:n.lastFilters??{}}}const et=eu()(x3((e,t)=>({closeRequest:null,windows:[],focusedId:null,zCounter:10,lastFilters:{},open:({kind:n,resourceId:i,title:s,projectId:a=null,sessionId:l=null,source:u="header",file:f,git:h,browser:g,activate:m=!0})=>{const _=t(),b=n==="files"&&f?`file:${i}`:n==="git-diff"&&h?`diff:${a}:${h.path}`:n==="browser"&&g?`browser:${g.serviceId}:${g.path}`:`${n}:${i}`,x=z1(a,l),S=_.windows.find(D=>Tc(D)===x&&D.tabs.some(L=>L.viewKey?L.viewKey===b:L.kind===n&&L.resourceId===i)),C=Math.max(_.zCounter+1,m_(_.windows)+1),k=vX(u,a);if(S){m&&p_(S.id);const D=S.tabs.find(B=>B.viewKey?B.viewKey===b:B.kind===n&&B.resourceId===i),L=D&&(f||h||g)?{...D,...f?{file:f}:{},...h?{git:h}:{},...g?{browser:g}:{},projectId:a,sourceSessionId:l,originType:YN(u)}:void 0,ee=L&&D?D.projectId===a?S.tabs.map(B=>B.id===D.id?L:B):WN(S.tabs.filter(B=>B.id!==D.id),L):S.tabs,U=D?Op(D,S.filter):!1,F=m?k??(U?S.filter:{mode:"all"}):U?S.filter:{mode:"all"};e({windows:_.windows.map(B=>B.id===S.id?{...B,...m?{minimized:!1,activeTabId:D?.id??B.activeTabId,z:C}:{},filter:F,tabs:ee}:B),...m?{focusedId:S.id}:{},zCounter:m?C:_.zCounter,lastFilters:{..._.lastFilters,[n]:F}});return}const R={id:ZN("tab"),kind:n,resourceId:i,viewKey:b,createdAt:Date.now(),title:s,projectId:a,sourceSessionId:l,originType:YN(u),...f?{file:f}:{},...h?{git:h}:{},...g?{browser:g}:{}},N=_.windows.find(D=>Tc(D)===x&&D.tabs.some(L=>L.kind===n));if(N){m&&p_(N.id);const D=WN(N.tabs,R);let L=k??N.filter;Op(R,L)||(L={mode:"all"}),e({windows:_.windows.map(ee=>ee.id===N.id?{...ee,tabs:D,...m?{activeTabId:R.id,minimized:!1,z:C}:{},filter:L}:ee),...m?{focusedId:N.id}:{},zCounter:m?C:_.zCounter,lastFilters:{..._.lastFilters,[n]:L}});return}let A=k??_.lastFilters[n]??{mode:"all"};Op(R,A)||(A={mode:"all"});const I=gX(n,_.windows.length,GN()),T={id:ZN("win"),tabs:[R],activeTabId:m?R.id:null,filter:A,...I,z:C,minimized:!m,maximized:!1,pinned:!1,restore:null};e({windows:[..._.windows,T],...m?{focusedId:T.id}:{},zCounter:C,lastFilters:{..._.lastFilters,[n]:A}})},focus:n=>{p_(n);const i=t(),s=i.windows.find(u=>u.id===n);if(!s)return;const a=Rc(Dd(s.tabs,s.filter),s.activeTabId)?.id??null;if(i.focusedId===n&&!s.minimized&&a===s.activeTabId)return;const l=Math.max(i.zCounter+1,m_(i.windows)+1);e({windows:i.windows.map(u=>u.id===n?{...u,activeTabId:a,minimized:!1,z:l}:u),focusedId:n,zCounter:l})},close:n=>{const i=t().windows.find(s=>s.id===n);i&&(i.tabs.some(s=>["files","git-diff","browser"].includes(s.kind))?e({closeRequest:{windowId:n,tabIds:i.tabs.map(s=>s.id)}}):t().hide(n))},hide:n=>{pX(n,()=>{const i=t();e({windows:i.windows.map(s=>s.id===n?{...s,minimized:!0}:s),focusedId:i.focusedId===n?i.windows.find(s=>s.id!==n&&!s.minimized)?.id??null:i.focusedId})})},hideScope:n=>{const{windows:i,hide:s}=t();for(const a of i)!a.minimized&&!a.pinned&&Tc(a)===n&&s(a.id)},restore:n=>{t().focus(n)},toggleMaximize:n=>{const i=t();e({windows:i.windows.map(s=>s.id===n?{...s,maximized:!s.maximized,restore:s.maximized?null:{x:s.x,y:s.y,width:s.width,height:s.height}}:s)})},togglePin:n=>{const i=t(),s=Math.max(i.zCounter+1,m_(i.windows)+1);e({windows:i.windows.map(a=>a.id===n?{...a,pinned:!a.pinned,z:s}:a),zCounter:s,focusedId:n})},setActiveTab:(n,i)=>{e({windows:t().windows.map(s=>s.id===n?{...s,activeTabId:i}:s)})},closeTab:(n,i)=>{const s=t(),a=s.windows.find(h=>h.id===n);if(!a)return;if(a.tabs.length<=1){e({windows:s.windows.filter(h=>h.id!==n),focusedId:null});return}const l=a.tabs.filter(h=>h.id!==i),u=Dd(l,a.filter),f=Rc(u,a.activeTabId)?.id??null;e({windows:s.windows.map(h=>h.id===n?{...h,tabs:l,activeTabId:f}:h)})},setBounds:(n,i)=>{const s=t();e({windows:s.windows.map(a=>a.id===n?{...a,...S3(i,GN())}:a)})},setFilter:(n,i)=>{const s=t(),a=s.windows.find(f=>f.id===n);if(!a)return;const l=Dd(a.tabs,i),u=Rc(l,a.activeTabId)?.id??null;e({windows:s.windows.map(f=>f.id===n?{...f,filter:i,activeTabId:u}:f),lastFilters:{...s.lastFilters,[a.tabs[0]?.kind??"terminal"]:i}})}}),{name:"larness.windows.v2",version:4,migrate:bX,partialize:e=>({windows:e.windows,focusedId:e.focusedId,zCounter:e.zCounter,lastFilters:e.lastFilters})}));function co(e){return"projectId"in e?`project:${e.projectId}`:"sessionId"in e?`session:${e.sessionId}`:"workspace:default"}function sm(e,t){return["files",co(e),"content",t]}async function w3(e,t){return IM.parse(await we(`/api/files?${new URLSearchParams({...e,path:t})}`))}async function xX(e,t,n,i){return gZ.parse(await we("/api/files",{method:"PUT",csrf:!0,headers:{"Idempotency-Key":crypto.randomUUID()},body:{scope:e,path:t,content:n,expectedVersion:i}}))}async function SX(e,t,n){const[i,s]=co(e).split(":"),a=new URLSearchParams({path:t,...n?{cursor:n}:{}});return yZ.parse(await we(`/api/${i==="project"?"projects":i==="session"?"sessions":"workspaces"}/${encodeURIComponent(s)}/files?${a}`))}function il(e){if(e instanceof rr){if(["FILE_NOT_EDITABLE","PAYLOAD_TOO_LARGE"].includes(e.code))return"不支持编辑:仅支持 512 KiB 以内的普通 UTF-8 文本。";if(e.code==="VERSION_CONFLICT")return"磁盘文件已变化,草稿已保留。";if(e.code==="RESOURCE_LOCKED")return"项目正在写入,请稍后重试;草稿已保留。";if(["NOT_FOUND","FORBIDDEN","PATH_OUTSIDE_PROJECT"].includes(e.code))return"文件不可用或已失去访问权限;本地草稿已保留。"}return"文件操作失败,请刷新后重试;本地草稿已保留。"}const It=eu(e=>({drafts:{},saving:{},monitoring:{},closeRequest:null,edit:(t,n,i)=>e(s=>({drafts:{...s.drafts,[t]:{text:n,baseVersion:i}}})),discard:t=>e(n=>{const i={...n.drafts};return delete i[t],{drafts:i}})}));async function C3(e,t,n){const i=await qt.fetchQuery({queryKey:sm(e,t),queryFn:()=>w3(e,t),staleTime:0});return et.getState().open({kind:"files",resourceId:i.realPath,title:i.path.split("/").at(-1)??i.path,projectId:"projectId"in e?e.projectId:null,sessionId:"sessionId"in e?e.sessionId:null,source:n,file:{scope:e,path:i.path}}),i}const g_=new Map;function om(e){const t=g_.get(e.resourceId);if(t)return t;const n=It.getState().drafts[e.resourceId],i=e.file;if(!n||!i)return Promise.resolve();It.setState(a=>({saving:{...a.saving,[e.resourceId]:!0}}));const s=(async()=>{try{const a=await xX(i.scope,i.path,n.text,n.baseVersion);qt.setQueryData(sm(i.scope,i.path),{...a,content:n.text,encoding:"utf-8"});const l=It.getState().drafts[e.resourceId];l===n?It.getState().discard(e.resourceId):l&&It.getState().edit(e.resourceId,l.text,a.version)}finally{It.setState(a=>({saving:{...a.saving,[e.resourceId]:!1}})),g_.delete(e.resourceId),qt.invalidateQueries({queryKey:sm(i.scope,i.path)})}})();return g_.set(e.resourceId,s),s}function k3(e,t){const n=co(e),i=JSON.stringify([...new Set(t)].sort()),[s,a]=w.useState("正在连接文件监听…");return w.useEffect(()=>{const l=JSON.parse(i);if(!l.length)return;let u=!1,f=0,h=1e3,g,m,_=!1;const b=`file:${n}`,x=()=>{u||qt.invalidateQueries({queryKey:["files",n]})},S=async()=>{if(!(_||u)){_=!0;try{for(let k=0;k<10&&!u;k++){const R=IY.parse(await we(`/api/resource-events?${new URLSearchParams({streamId:b,after:String(f),limit:"500"})}`));if(u)return;if(R.resyncRequired||!R.items.length){f=R.currentSequence;break}if(f=Math.max(f,R.items.at(-1)?.sequence??f),f>=R.currentSequence)break;k===9&&(f=R.currentSequence)}}catch{u||a("监听恢复失败,请手动刷新。")}finally{_=!1,x()}}},C=()=>{if(u)return;const k=new URL("/ws",window.location.href);k.protocol=k.protocol==="https:"?"wss:":"ws:",g=new WebSocket(k),g.onopen=()=>g?.send(JSON.stringify({type:"subscribe",subscriptions:[{topic:"file",resourceId:n,paths:l.slice(0,128),after:f}]})),g.onmessage=R=>{if(u)return;let N;try{N=JSON.parse(String(R.data))}catch{a("文件监听响应无效,请刷新。");return}const A=PY.safeParse(N);if(A.success&&A.data.subscription.resourceId===n){h=1e3,a(A.data.partial||l.length>128?"部分监听,请按需手动刷新。":"文件监听已连接"),S(),x();return}if(LY.safeParse(N).success){a("文件监听不可用,请手动刷新。");return}const I=p3.safeParse(N);!I.success||I.data.streamId!==b||I.data.sequence<=f||(I.data.sequence!==f+1?S():f=I.data.sequence,I.data.type==="file.resync.required"&&a(I.data.payload.reasonCode==="RECOVERED"?"文件监听已连接":"监听已降级,请手动刷新。"),x())},g.onerror=()=>{u||a("文件监听断开,可手动刷新。")},g.onclose=()=>{u||(a("文件监听断开,正在重连;可手动刷新。"),m=setTimeout(C,h),h=Math.min(h*2,1e4))}};return C(),()=>{u=!0,clearTimeout(m),g?.close()}},[n,i]),s}function Xm(e,t,n){if(e)return{projectId:e};const i=n.find(s=>s.id===t);return i&&i.workspaceKind!=="default"?{sessionId:i.id}:{workspace:"default"}}function M1(e,t,n){const i=Xm(e,t,n);return"projectId"in i?`project:${i.projectId}`:"sessionId"in i?`session:${i.sessionId}`:"global"}function I1(e,t){return"workspace"in Xm(null,e,t)?"默认工作区":"独立会话"}const at=eu()(x3((e,t)=>({projectId:null,sessionId:"",pinnedSessionId:null,draftSession:null,sidebarWidth:268,resourceWidth:340,sidebarCollapsed:!1,resourceCollapsed:!1,mobileSidebarOpen:!1,expandedProjects:{prj_larness:!0,prj_docs:!0},focusComposerNonce:0,reconcileWorkspace:(n,i)=>{const s=t();if(s.sessionId!==""&&s.sessionId===s.pinnedSessionId)return;const a=s.projectId===null||n.includes(s.projectId);if(a&&s.draftSession?.id===s.sessionId&&s.draftSession.projectId===s.projectId)return;const l=i.find(f=>f.id===s.sessionId);if(l){(l.projectId!==s.projectId||s.draftSession)&&t().selectSession(l.id,l.projectId);return}const u=a?s.projectId:null;if(a&&s.sessionId.startsWith("draft_")){e({draftSession:{id:s.sessionId,projectId:u}});return}t().startDraft(u)},selectSession:(n,i)=>e({sessionId:n,projectId:i,pinnedSessionId:null,draftSession:null,mobileSidebarOpen:!1}),openPinnedSession:(n,i)=>e({sessionId:n,projectId:i,pinnedSessionId:n,draftSession:null,mobileSidebarOpen:!1}),startDraft:n=>e(i=>{if(i.draftSession!==null&&i.draftSession.projectId===n)return{sessionId:i.draftSession.id,projectId:n,mobileSidebarOpen:!1};const s=`draft_${crypto.randomUUID()}`;return{draftSession:{id:s,projectId:n},sessionId:s,projectId:n,mobileSidebarOpen:!1}}),commitDraft:(n,i)=>e({sessionId:n,projectId:i,draftSession:null,mobileSidebarOpen:!1}),setSidebarWidth:n=>e({sidebarWidth:n}),setResourceWidth:n=>e({resourceWidth:n}),toggleSidebar:()=>e(n=>({sidebarCollapsed:!n.sidebarCollapsed})),toggleResource:()=>e(n=>({resourceCollapsed:!n.resourceCollapsed})),setMobileSidebar:n=>e({mobileSidebarOpen:n}),toggleProject:n=>e(i=>({expandedProjects:{...i.expandedProjects,[n]:!(i.expandedProjects[n]??!0)}})),focusComposer:()=>e(n=>({focusComposerNonce:n.focusComposerNonce+1}))}),{name:"larness.nav.v1",version:1,partialize:e=>({projectId:e.projectId,sessionId:e.sessionId,draftSession:e.draftSession,sidebarWidth:e.sidebarWidth,resourceWidth:e.resourceWidth,sidebarCollapsed:e.sidebarCollapsed,resourceCollapsed:e.resourceCollapsed,expandedProjects:e.expandedProjects})}));function wX({projectId:e}){const t=at(s=>s.sessionId),{data:n}=qr(),i=Xm(e,t,n.sessions);return p.jsx(CX,{scope:i},co(i))}function CX({scope:e}){const[t,n]=w.useState(["."]),[i,s]=w.useState(null);return k3(e,t),p.jsxs("div",{className:"p-1.5 text-[11px] text-ink-2",children:[i?p.jsx("p",{role:"alert",className:"p-2 text-danger",children:i}):null,p.jsx(E3,{scope:e,path:".",depth:0,expanded:t,toggle:a=>n(l=>l.includes(a)?l.filter(u=>u!==a&&!u.startsWith(`${a}/`)):[...l,a]),open:a=>{s(null),C3(e,a,"projectId"in e?"project":"workspace"in e?"global":"session").catch(l=>s(il(l)))}})]})}function E3({scope:e,path:t,depth:n,expanded:i,toggle:s,open:a}){const l=p7({queryKey:["files",co(e),"directory",t],initialPageParam:void 0,queryFn:({pageParam:u})=>SX(e,t,u),getNextPageParam:u=>u.nextCursor??void 0,staleTime:0});return p.jsxs(p.Fragment,{children:[l.isPending?p.jsx("p",{className:"p-2 text-ink-3",children:"正在读取目录…"}):null,l.isError?p.jsxs("div",{role:"alert",className:"p-2 text-danger",children:[il(l.error),p.jsx("button",{type:"button",onClick:()=>{qt.resetQueries({queryKey:["files",co(e),"directory",t]})},children:"重新加载目录"})]}):null,l.data?.pages.flatMap(u=>u.items).map(u=>p.jsxs("div",{children:[p.jsxs("button",{type:"button","aria-label":u.type==="directory"?`目录 ${u.name}`:`打开文件 ${u.name}`,"aria-expanded":u.type==="directory"?i.includes(u.path):void 0,className:"flex h-[26px] w-full items-center gap-1.5 rounded px-1.5 text-left hover:bg-accent-soft",style:{paddingLeft:6+n*12},onClick:()=>u.type==="directory"?s(u.path):a(u.path),children:[u.type==="directory"?p.jsxs(p.Fragment,{children:[i.includes(u.path)?p.jsx(Fm,{size:11}):p.jsx(Hr,{size:11}),p.jsx(Um,{size:13,className:"text-warning"})]}):p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"w-[11px]"}),p.jsx(Yj,{size:13,className:"text-ink-3"})]}),p.jsx("span",{className:"truncate",children:u.name})]}),u.type==="directory"&&i.includes(u.path)?p.jsx(E3,{scope:e,path:u.path,depth:n+1,expanded:i,toggle:s,open:a}):null]},u.path)),t==="."&&l.isSuccess&&l.data.pages.every(u=>u.items.length===0)?p.jsx("p",{className:"px-2 py-3 text-[10.5px] text-ink-3",children:"当前工作区暂无文件"}):null,l.hasNextPage?p.jsx("button",{type:"button",className:"px-3 py-2 text-accent",disabled:l.isFetchingNextPage,onClick:()=>{l.fetchNextPage()},children:"加载更多文件"}):null]})}const XN={running:"bg-success",idle:"bg-ink-3",waiting:"bg-warning",error:"bg-danger",info:"bg-accent"};function Qb({tone:e="idle",pulse:t=!1,className:n}){return p.jsx("span",{className:qe("relative inline-flex h-1.5 w-1.5 shrink-0 rounded-full",XN[e],n),children:t?p.jsx("span",{className:qe("absolute inset-0 animate-ping rounded-full opacity-60",XN[e])}):null})}async function kX(e){return we(`/api/projects/${encodeURIComponent(e)}/git/status`)}async function EX(e,t,n){return we(`/api/projects/${encodeURIComponent(e)}/git/diff?path=${encodeURIComponent(t)}&staged=${n}`)}async function NX(e,t=100,n=0){return(await we(`/api/projects/${encodeURIComponent(e)}/git/branches?limit=${t}&cursor=${n}`)).items}async function QN(e,t){return we(`/api/projects/${encodeURIComponent(e)}/git/actions`,{method:"POST",csrf:!0,body:t})}async function RX(e,t){return we(`/api/resource-actions/${encodeURIComponent(e)}/decision`,{method:"POST",csrf:!0,body:{decision:t}})}async function JN(e){return we(`/api/resource-actions/${encodeURIComponent(e)}/execute`,{method:"POST",csrf:!0,body:{}})}function eR(){return{folders:new Map,files:[]}}function TX(e){const t=eR();for(const n of e){let i=t;for(const s of n.path.split("/").slice(0,-1)){i.folders.has(s)||i.folders.set(s,eR());const a=i.folders.get(s);a&&(i=a)}i.files.push(n)}return t}const DX={modified:"M",added:"A",deleted:"D",renamed:"R",untracked:"U",conflicted:"!"};function AX({changes:e,disabled:t,onOpen:n,onStage:i,onUnstage:s,onDiscard:a}){function l(u,f){return p.jsxs(p.Fragment,{children:[[...u.folders].sort(([h],[g])=>h.localeCompare(g)).map(([h,g])=>{let m=g,_=h;for(;!m.files.length&&m.folders.size===1;){const b=[...m.folders][0];if(!b)break;_+=`/${b[0]}`,m=b[1]}return p.jsxs("details",{open:!0,className:"group/folder",children:[p.jsxs("summary",{style:{paddingLeft:8+f*12},className:"flex cursor-pointer list-none items-center gap-1.5 py-1 text-[11px] text-ink-2 hover:bg-surface-2",children:[p.jsx(Hr,{size:11,className:"shrink-0 transition-transform group-open/folder:rotate-90 motion-reduce:transition-none"}),p.jsx(Um,{size:13,className:"shrink-0 text-warning"}),p.jsx("span",{className:"truncate",children:_})]}),l(m,f+1)]},h)}),u.files.sort((h,g)=>h.path.localeCompare(g.path)).map(h=>p.jsxs("div",{style:{paddingLeft:8+f*12},className:"group flex min-w-0 items-center gap-1 rounded-md pr-1 hover:bg-surface-2 focus-within:bg-surface-2",children:[p.jsxs("button",{type:"button",title:h.origPath?`${h.origPath} → ${h.path}`:h.path,"aria-label":`查看差异 ${h.path}${h.staged?"(已暂存)":""}`,onClick:()=>n(h),className:"flex min-w-0 flex-1 items-center gap-1.5 py-1 text-left text-[11px] text-ink-2",children:[p.jsx(s1,{size:13,className:"shrink-0 text-accent"}),p.jsx("span",{className:"truncate",children:h.path.split("/").at(-1)})]}),!h.staged&&h.status!=="conflicted"?p.jsx("button",{type:"button",disabled:t,"aria-label":`暂存 ${h.path}`,title:"暂存更改",onClick:()=>i(h.path),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-ink-3 opacity-0 transition-opacity hover:bg-surface group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 disabled:opacity-30 [@media(hover:none)]:opacity-100",children:p.jsx($r,{size:13})}):null,h.staged?p.jsx("button",{type:"button",disabled:t,"aria-label":`取消暂存 ${h.path}`,title:"取消暂存(保留工作区修改)",onClick:()=>s(h.path),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-ink-3 opacity-0 transition-opacity hover:bg-surface group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 disabled:opacity-30 [@media(hover:none)]:opacity-100",children:p.jsx(hz,{size:13})}):h.status!=="conflicted"?p.jsx("button",{type:"button",disabled:t,"aria-label":`放弃更改 ${h.path}`,title:h.status==="untracked"?"放弃更改(删除未跟踪文件)":"放弃未暂存更改",onClick:()=>a(h),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded text-ink-3 opacity-0 transition-opacity hover:bg-danger/10 hover:text-danger group-hover:opacity-100 group-focus-within:opacity-100 focus:opacity-100 disabled:opacity-30 [@media(hover:none)]:opacity-100",children:p.jsx(F$,{size:13})}):null,p.jsx("span",{title:h.status,className:`w-4 shrink-0 text-center font-mono text-[10px] ${h.status==="deleted"||h.status==="conflicted"?"text-danger":h.status==="untracked"||h.status==="added"?"text-success":"text-warning"}`,children:DX[h.status]??h.status.slice(0,1).toUpperCase()})]},h.path))]})}return p.jsx("div",{children:l(TX(e),0)})}function OX({projectId:e}){return p.jsx(zX,{projectId:e},e??"none")}function jX(e,t){return`diff:${e}:${t}`}function zX({projectId:e}){const[t,n]=w.useState(null),i=et(P=>P.open),[s,a]=w.useState(!1),[l,u]=w.useState(""),f=w.useRef(!1),[h,g]=w.useState(!1),[m,_]=w.useState(""),[b,x]=w.useState(null),[S,C]=w.useState(""),k=Pt({queryKey:["git","status",e],queryFn:()=>kX(e??""),enabled:e!==null,refetchInterval:3e3,retry:!1}),R=Pt({queryKey:["git","branches",e],queryFn:()=>NX(e??""),enabled:e!==null,retry:!1});if(e===null)return p.jsx("p",{className:"px-2 py-3 text-[10.5px] text-ink-3",children:"暂无 Git 仓库"});if(k.isPending)return p.jsx("p",{className:"px-2 py-3 text-[10.5px] text-ink-3",children:"读取 Git 状态…"});if(k.isError&&!k.data)return p.jsx("p",{className:"px-2 py-3 text-[10.5px] text-ink-3",children:"Git 暂不可用"});const N=k.data;if(!N)return null;const A=[...N.staged.map(P=>({...P,staged:!0})),...N.unstaged.map(P=>({...P,staged:!1})),...N.untracked.map(P=>({path:P,origPath:null,status:"untracked",staged:!1})),...N.conflicts.map(P=>({...P,staged:!1}))],I=async()=>{await Promise.all([k.refetch(),R.refetch()])},T=async P=>{if(!f.current){f.current=!0,g(!0),_("");try{await P(),await I()}catch(Z){_(Z instanceof Error?Z.message:"Git 操作失败"),await I()}finally{f.current=!1,g(!1)}}},D=P=>T(async()=>{const Z=await QN(e,P);if((await JN(Z.id)).status!=="COMPLETED")throw new Error("Git 操作未完成,请重试核对。");P.action==="discard"&&n(null),P.action==="commit"&&u(""),P.action==="createBranch"&&C("")}),L=P=>T(async()=>{const Z=await QN(e,P);x(Z)}),ee=P=>T(async()=>{if(!b)return;const Z=await RX(b.id,P);x(Z),P==="reject"&&x(null)}),U=()=>T(async()=>{if(!b)return;const P=await JN(b.id);if(x(P.status==="COMPLETED"||P.status==="FAILED"?null:P),P.status!=="COMPLETED")throw new Error("Git 操作未完成,请核对状态后重试。")}),F=A.filter(P=>P.staged),B=[...new Map(A.filter(P=>!P.staged).map(P=>[P.path,P])).values()],W=h||b!==null||k.isError,te=P=>i({kind:"git-diff",resourceId:jX(e,P.path),title:P.path.split("/").pop()??P.path,projectId:e,source:"project",git:{path:P.path,staged:P.staged}}),G=()=>{!W&&l.trim()&&F.length&&D({action:"commit",message:l.trim()})};return p.jsxs("div",{"data-testid":"git-panel",className:"relative flex h-full min-h-0 flex-col px-1 pb-1",children:[p.jsxs("div",{className:"shrink-0 space-y-2 px-1 pb-2",children:[p.jsx("textarea",{"aria-label":"提交信息",value:l,disabled:h,onChange:P=>u(P.target.value),onKeyDown:P=>{P.key==="Enter"&&(P.metaKey||P.ctrlKey)&&(P.preventDefault(),G())},rows:2,placeholder:"提交信息(⌘ / Ctrl + Enter)",className:"w-full resize-none rounded-lg border border-line bg-surface px-2.5 py-2 text-[11px] focus:border-accent focus:outline-none"}),p.jsxs("button",{type:"button",title:"仅提交已暂存的更改","aria-label":`提交已暂存 (${F.length})`,disabled:W||!l.trim()||!F.length,onClick:G,className:"flex h-8 w-full items-center justify-center gap-1.5 rounded-lg bg-accent text-[11px] font-medium text-white transition-opacity disabled:opacity-40",children:[p.jsx(Ic,{size:14}),"提交"]})]}),p.jsxs("div",{className:"min-h-0 flex-1 overflow-auto",children:[[{title:"已暂存",rows:F},{title:"更改",rows:B}].map(P=>P.rows.length?p.jsxs("details",{open:!0,className:"mb-1",children:[p.jsxs("summary",{className:"flex cursor-pointer items-center gap-2 px-2 py-1.5 text-[11px] font-medium text-ink-2",children:[p.jsx("span",{children:P.title}),p.jsx("span",{className:"ml-auto rounded-full bg-accent-soft px-1.5 text-[10px] text-accent",children:P.rows.length})]}),p.jsx(AX,{changes:P.rows,disabled:W,onOpen:te,onStage:Z=>{D({action:"add",paths:[Z]})},onUnstage:Z=>{D({action:"unstage",paths:[Z]})},onDiscard:Z=>{_(""),n(Z)}})]},P.title):null),A.length?null:p.jsx("p",{className:"px-2 py-3 text-[11px] text-ink-3",children:"工作区干净"})]}),p.jsxs("div",{className:"relative mt-1 flex shrink-0 items-center gap-1 border-t border-line px-1 pt-1.5 text-ink-3",role:"toolbar","aria-label":"Git 操作",children:[p.jsxs("button",{type:"button",disabled:W,"aria-label":"管理分支",title:N.upstream??"未设置上游",onClick:()=>a(P=>!P),"aria-expanded":s,className:"flex min-w-0 flex-1 items-center gap-1 rounded px-1 py-1 text-[10.5px] hover:bg-surface-2 disabled:opacity-40",children:[p.jsx(iz,{size:13}),p.jsx("span",{className:"truncate",children:N.branch})]}),p.jsxs("span",{className:"shrink-0 font-mono text-[9px]",title:"传入 / 传出提交",children:["↓",N.behind," ↑",N.ahead]}),p.jsx("button",{type:"button",disabled:W,"aria-label":"拉取(仅快进)",title:"拉取(仅快进)",onClick:()=>{L({action:"pull"})},className:"rounded p-1.5 hover:bg-surface-2 disabled:opacity-40",children:p.jsx(Sj,{size:13})}),p.jsx("button",{type:"button",disabled:W,"aria-label":"推送",title:"推送",onClick:()=>{L({action:"push"})},className:"rounded p-1.5 hover:bg-surface-2 disabled:opacity-40",children:p.jsx(Rj,{size:13})}),p.jsx("button",{type:"button",disabled:h,"aria-label":"刷新 Git","aria-busy":h,title:"刷新 Git",onClick:()=>{T(async()=>{})},className:"rounded p-1.5 hover:bg-surface-2 disabled:opacity-40",children:p.jsx(xl,{size:12,className:h?"animate-spin motion-reduce:animate-none":""})}),s?p.jsxs("section",{"aria-label":"分支管理",className:"absolute bottom-full left-0 right-0 z-10 mb-2 space-y-2 rounded-xl border border-line bg-surface p-3 shadow-lg",children:[p.jsxs("div",{className:"flex items-center justify-between text-[11px] font-medium text-ink-2",children:["分支",p.jsx("button",{type:"button","aria-label":"关闭分支管理",onClick:()=>a(!1),children:p.jsx(pa,{size:12})})]}),R.isError?p.jsx("p",{role:"alert",className:"text-[10px] text-danger",children:"分支读取失败,请刷新重试。"}):null,p.jsxs("select",{"aria-label":"切换分支",value:N.branch,disabled:W||!R.data,onChange:P=>{const Z=P.target.value;Z!==N.branch&&D({action:"switchBranch",name:Z})},className:"w-full rounded border border-line bg-surface px-2 py-1 text-[11px]",children:[R.data?.some(P=>P.name===N.branch)?null:p.jsx("option",{value:N.branch,children:N.branch}),(R.data??[]).map(P=>p.jsx("option",{value:P.name,children:P.name},P.name))]}),p.jsxs("form",{className:"flex gap-1",onSubmit:P=>{P.preventDefault(),!W&&S.trim()&&D({action:"createBranch",name:S.trim()})},children:[p.jsx("input",{"aria-label":"新分支名",value:S,onChange:P=>C(P.target.value),placeholder:"新分支名",className:"min-w-0 flex-1 rounded border border-line bg-surface px-2 py-1 text-[11px]"}),p.jsx("button",{type:"submit","aria-label":"创建分支",title:"创建分支",disabled:W||!S.trim(),className:"rounded border border-line px-2 disabled:opacity-40",children:p.jsx($r,{size:13})})]})]}):null]}),p.jsx(xi,{open:t!==null,onOpenChange:P=>{!P&&!h&&n(null)},children:p.jsxs(ui,{className:"space-y-4 text-sm",onEscapeKeyDown:P=>{h&&P.preventDefault()},onPointerDownOutside:P=>{h&&P.preventDefault()},children:[p.jsx(Si,{children:"放弃更改?"}),p.jsx(wi,{children:t?.status==="untracked"?"该文件尚未被 Git 跟踪,确认后将删除,无法通过 Git 恢复。":"该文件的未暂存修改将丢失,恢复为暂存区版本;已暂存内容会保留。"}),p.jsx("p",{className:"break-all rounded bg-surface-2 p-2 font-mono text-xs",children:t?.path}),m?p.jsx("p",{role:"alert",className:"text-danger",children:m}):null,p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(Se,{variant:"secondary",disabled:h,onClick:()=>n(null),children:"取消"}),p.jsx(Se,{className:"bg-danger text-white",disabled:h||b!==null||k.isError,onClick:()=>{t&&D({action:"discard",path:t.path,confirmed:!0})},children:"确认放弃"})]})]})}),k.isError?p.jsx("p",{role:"status",className:"px-2 text-[10px] text-ink-3",children:"Git 状态读取失败,请刷新后继续。"}):null,m?p.jsx("p",{role:"alert",className:"px-2 text-[10.5px] leading-4 text-danger",children:m}):null,b?p.jsxs("section",{"aria-label":"Git 操作审批",className:"max-h-56 shrink-0 space-y-1.5 overflow-auto rounded border border-warning/30 bg-warning/[.05] p-2",children:[p.jsxs("div",{className:"flex items-center gap-2 text-[10.5px] font-medium text-ink",children:[p.jsx("span",{children:"Git 操作审批"}),p.jsx("span",{className:"ml-auto rounded-full border border-line bg-surface px-1.5 text-[9px]",children:b.status})]}),p.jsx("p",{className:"break-all font-mono text-[9.5px] text-ink-3",children:JSON.stringify(b.params)}),p.jsxs("p",{className:"text-[9.5px] text-ink-3",children:["风险 ",b.risk," · 到期 ",new Date(b.expiresAt).toLocaleTimeString()]}),p.jsxs("div",{className:"flex gap-1",children:[b.status==="WAITING_APPROVAL"?p.jsxs(p.Fragment,{children:[p.jsx("button",{type:"button",disabled:h,onClick:()=>ee("approve"),className:"flex-1 rounded bg-accent px-2 py-1 text-[10px] text-white disabled:opacity-45",children:"批准"}),p.jsx("button",{type:"button",disabled:h,onClick:()=>ee("reject"),className:"flex-1 rounded border border-line px-2 py-1 text-[10px] disabled:opacity-45",children:"拒绝"})]}):null,b.status==="APPROVED"?p.jsx("button",{type:"button",disabled:h,onClick:U,className:"flex-1 rounded bg-accent px-2 py-1 text-[10px] text-white disabled:opacity-45",children:"执行一次"}):null,b.status==="FAILED"?p.jsx("p",{className:"text-[10px] text-danger",children:"执行失败;读取最新状态后重试。"}):null]})]}):null]})}const MX={files:S$,git:iz};function IX(){const{data:e}=qr(),t=at(h=>h.projectId),n=at(h=>h.sessionId),i=at(h=>h.resourceWidth),s=e.projects.find(h=>h.id===t)??null;t==="prj_larness"&&e.gitChanges;const[a,l]=w.useState("files"),u={files:void 0,git:void 0},f=h=>h==="files"?p.jsx(wX,{projectId:t}):p.jsx(OX,{projectId:t});return p.jsxs("aside",{"aria-label":"项目资源","data-project-resources":!0,className:"hidden shrink-0 bg-surface/40 xl:flex xl:flex-col",style:{width:i},children:[p.jsxs("div",{className:"flex h-11 shrink-0 items-center gap-2 px-3.5",children:[p.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-[.08em] text-ink-3",children:"项目资源"}),p.jsx("span",{className:"ml-auto max-w-[140px] truncate rounded-full bg-black/[.045] px-1.5 py-[1px] text-[9.5px] font-medium text-ink-3 dark:bg-white/[.06]",children:s?.name??I1(n,e.sessions)})]}),p.jsx("div",{className:"flex min-h-0 flex-1 flex-col px-2 pb-2",children:["files","git"].map(h=>{const g=MX[h],m=a===h;return p.jsxs("section",{className:"flex min-h-0 flex-col overflow-hidden transition-[flex-grow] duration-200 motion-reduce:transition-none",style:{flexGrow:m?1:0,flexBasis:36,flexShrink:0},children:[p.jsxs("button",{type:"button","aria-expanded":m,"aria-controls":`resource-${h}`,onClick:()=>l(m?null:h),className:"flex h-9 shrink-0 items-center gap-2 rounded-lg px-2.5 text-left text-[11.5px] font-medium text-ink-2 hover:bg-surface-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:[p.jsx(g,{size:14,className:"text-ink-3"}),p.jsx("span",{children:h==="files"?"文件":"Git"}),typeof u[h]=="number"?p.jsx("span",{className:"rounded-full bg-surface-2 px-1.5 text-[10px]",children:u[h]}):null,p.jsx(Fm,{size:13,className:`ml-auto text-ink-3 transition-transform duration-200 motion-reduce:transition-none ${m?"":"-rotate-90"}`})]}),p.jsx("div",{id:`resource-${h}`,inert:!m,"aria-hidden":!m,className:`min-h-0 flex-1 overflow-auto transition-opacity duration-200 motion-reduce:transition-none ${m?"opacity-100":"opacity-0"}`,children:f(h)})]},h)})})]})}function N3(){return Pt({queryKey:["bootstrap"],queryFn:()=>we("/api/bootstrap"),staleTime:5e3,retry:!1})}function P1(e=!0){return Pt({queryKey:["session"],enabled:e,queryFn:async()=>{try{const t=await we("/api/auth/session");return Zb(t.csrfToken),t}catch(t){if(t instanceof rr&&t.code==="UNAUTHENTICATED")return Zb(null),null;throw t}},retry:!1,staleTime:0,refetchInterval:3e4})}function PX(){const e=zn();w.useEffect(()=>{const t=()=>{e.invalidateQueries({queryKey:["session"]}),e.invalidateQueries({queryKey:["bootstrap"]})};return window.addEventListener("larness:unauthenticated",t),()=>window.removeEventListener("larness:unauthenticated",t)},[e])}function LX(){const e=zn(),t=Mm();return async()=>{try{await we("/api/auth/logout",{method:"POST",csrf:!0})}finally{Zb(null),e.clear(),t("/",{replace:!0})}}}function R3({session:e,open:t,onClose:n}){const i=zn(),[s,a]=w.useState(""),[l,u]=w.useState(!1),[f,h]=w.useState(null);w.useEffect(()=>{a(e?.title??""),h(null),u(!1)},[e]);const g=async()=>{if(!(e===null||!s.trim())){u(!0),h(null);try{await Yb(e.id,{title:s.trim()}),await i.invalidateQueries({queryKey:["workspace"]}),n()}catch(m){h(m instanceof Error?m.message:"重命名失败")}finally{u(!1)}}};return p.jsx(xi,{open:t&&e!==null,onOpenChange:m=>m?void 0:n(),children:p.jsxs(ui,{children:[p.jsx(Si,{children:"重命名会话"}),p.jsx(wi,{children:"标题只用于展示,不参与授权。"}),p.jsx("input",{value:s,onChange:m=>a(m.target.value),"aria-label":"会话标题",autoFocus:!0,className:"mt-4 h-9 w-full rounded-lg border border-line bg-surface-2 px-2.5 text-[12px] text-ink outline-none focus:border-accent/40"}),f?p.jsx("p",{role:"alert",className:"mt-2 text-[11px] text-danger",children:f}):null,p.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[p.jsx(Se,{variant:"secondary",size:"sm",onClick:n,children:"取消"}),p.jsx(Se,{variant:"primary",size:"sm",disabled:l||!s.trim(),onClick:()=>{g()},children:l?"正在保存…":"保存"})]})]})})}const tR=["jobs"],T3=["jobs","summary"],nR=e=>["jobs","detail",e],iR=e=>["jobs","runs",e];async function BX(){return we("/api/jobs")}async function FX(){return we("/api/jobs/summary")}async function UX(e){return we(`/api/jobs/${encodeURIComponent(e)}`)}async function HX(e){return we("/api/jobs",{method:"POST",csrf:!0,body:e})}async function D3(e,t){return we(`/api/jobs/${encodeURIComponent(e)}`,{method:"PATCH",csrf:!0,body:t})}async function $X(e){await we(`/api/jobs/${encodeURIComponent(e)}`,{method:"DELETE",csrf:!0})}async function qX(e){return we(`/api/jobs/${encodeURIComponent(e)}/run`,{method:"POST",csrf:!0})}async function WX(e,t){const n=new URLSearchParams({limit:"50"});return we(`/api/jobs/${encodeURIComponent(e)}/runs?${n.toString()}`)}async function KX(e){return we(`/api/job-runs/${encodeURIComponent(e)}/cancel`,{method:"POST",csrf:!0})}function rl(e,t=Date.now()){const n=Math.max(0,t-e),i=Math.floor(n/6e4);if(i<1)return"刚刚";if(i<60)return`${i} 分钟前`;const s=Math.floor(i/60);return s<24?`${s} 小时前`:`${Math.floor(s/24)} 天前`}const A3={queued:"排队中",running:"运行中",succeeded:"成功",failed:"失败",timed_out:"超时",cancelled:"已取消",interrupted:"已中断",skipped:"已跳过"},VX={queued:"text-warning",running:"text-accent",succeeded:"text-success",failed:"text-danger",timed_out:"text-danger",cancelled:"text-ink-3",interrupted:"text-danger",skipped:"text-ink-3"},GX={scheduled:"计划",manual:"手动",catch_up:"补跑"},rR={script:"脚本",agent:"Agent"};function sR(e){return new Date(e).toLocaleString("zh-CN",{hour12:!1})}function oR(e){return e.schedule.type==="cron"?`Cron ${e.schedule.expression} · ${e.schedule.timezone}`:`每 ${e.schedule.seconds} 秒 · ${e.schedule.timezone}`}function ZX(e){return e===null?"—":e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`}function YX(e){return e.lastStatus}function XX({open:e,onOpenChange:t}){const n=zn(),[i,s]=w.useState(null),[a,l]=w.useState(null),[u,f]=w.useState(!1),[h,g]=w.useState(null),m=Pt({queryKey:tR,queryFn:BX,enabled:e,refetchInterval:e?5e3:!1}),_=Pt({queryKey:nR(i??""),queryFn:()=>UX(i??""),enabled:e&&i!==null,refetchInterval:e&&i!==null?2e3:!1}),b=Pt({queryKey:iR(i??""),queryFn:()=>WX(i??""),enabled:e&&i!==null,refetchInterval:e&&i!==null?2e3:!1}),x=Pt({queryKey:["projects","jobs"],queryFn:g3,enabled:e}),S=Pt({queryKey:["model-catalog","jobs"],queryFn:Cc,enabled:e&&a!==null});w.useEffect(()=>{e||(s(null),l(null),f(!1),g(null))},[e]),w.useEffect(()=>{m.data&&!m.isFetching&&i!==null&&!m.data.items.some(D=>D.id===i)&&(s(null),f(!1))},[m.data,i,m.isFetching]);const C=()=>{n.invalidateQueries({queryKey:tR}),n.invalidateQueries({queryKey:T3}),i!==null&&(n.invalidateQueries({queryKey:nR(i)}),n.invalidateQueries({queryKey:iR(i)}))},k=wc({mutationFn:D=>qX(D),retry:!1,onMutate:()=>g(null),onError:D=>g(D instanceof Error?D.message:"执行失败"),onSettled:C}),R=wc({mutationFn:D=>KX(D),retry:!1,onMutate:()=>g(null),onError:D=>g(D instanceof Error?D.message:"取消失败"),onSettled:C}),N=wc({mutationFn:D=>$X(D),retry:!1,onMutate:()=>g(null),onError:D=>g(D instanceof Error?D.message:"删除失败"),onSuccess:()=>{s(null),f(!1)},onSettled:C}),A=wc({mutationFn:({id:D,enabled:L})=>D3(D,{enabled:L}),retry:!1,onMutate:()=>g(null),onError:D=>g(D instanceof Error?D.message:"更新失败"),onSettled:C}),I=()=>{s(null),l(null),f(!1),g(null),t(!1)},T=_.data;return p.jsx(xi,{open:e,onOpenChange:D=>{D||I()},children:p.jsxs(ui,{className:"flex h-[min(700px,calc(100dvh-32px))] w-[min(980px,calc(100vw-32px))] flex-col overflow-hidden p-0","data-testid":"jobs-dialog",children:[p.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2",children:[p.jsx(eN,{size:14,className:"text-ink-3"}),p.jsx(Si,{className:"text-[12px] font-semibold",children:"自动化任务"}),p.jsx(wi,{className:"sr-only",children:"管理 Cron / 固定间隔的脚本与 Agent 任务,查看运行历史"}),p.jsx("span",{className:"rounded bg-surface-2 px-1.5 text-[10px] text-ink-3",children:m.data?.items.length??0}),p.jsx("div",{className:"flex-1"}),p.jsxs(Se,{size:"sm",variant:"ghost",disabled:m.isFetching,onClick:()=>{m.refetch()},children:[p.jsx(xl,{size:12,className:m.isFetching?"animate-spin":void 0}),"刷新"]}),p.jsx(S0,{asChild:!0,children:p.jsx(Se,{size:"sm",variant:"ghost","aria-label":"关闭自动化任务",children:p.jsx(pa,{size:14})})})]}),h!==null&&p.jsx("p",{role:"alert",className:"border-b border-line px-3 py-2 text-[11px] text-danger",children:h}),m.isError&&p.jsx("p",{role:"alert",className:"border-b border-line px-3 py-2 text-[11px] text-danger",children:"任务列表读取失败,请刷新重试。"}),a!==null?p.jsx(JX,{job:a==="new"?null:a,projects:x.data??[],catalog:S.data??null,onCancel:()=>l(null),onSaved:async D=>{l(null),s(D.id),C()},onError:g}):i!==null?p.jsxs("section",{className:"flex min-h-0 flex-1 flex-col","aria-label":"任务详情",children:[p.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-line px-3 py-2",children:[p.jsx(Se,{size:"sm",variant:"ghost","aria-label":"返回任务列表",onClick:()=>{s(null),f(!1)},children:p.jsx(aa,{size:12})}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("h3",{className:"truncate text-[12.5px] font-semibold",children:T?.name??"任务"}),T!==void 0&&p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"rounded bg-surface-2 px-1.5 py-0.5 text-[10px] text-ink-3",children:rR[T.kind]}),p.jsx(Jb,{status:YX(T)}),p.jsx("span",{className:"text-[10px] text-ink-3",children:T.enabled?"已启用":"已停用"})]})]}),p.jsx("p",{className:"mt-1 text-[10px] text-ink-3",children:T===void 0?"正在读取任务…":oR(T)})]}),T!==void 0&&p.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[p.jsx(Se,{size:"sm",variant:"ghost",onClick:()=>A.mutate({id:T.id,enabled:!T.enabled}),disabled:A.isPending,children:T.enabled?"停用":"启用"}),p.jsxs(Se,{size:"sm",variant:"secondary",onClick:()=>k.mutate(T.id),disabled:k.isPending,children:[p.jsx(xz,{size:12}),"立即执行"]}),p.jsx(Se,{size:"sm",variant:"secondary",onClick:()=>l(T),children:"编辑"}),p.jsxs(Se,{size:"sm",variant:"danger",onClick:()=>f(!0),disabled:N.isPending,children:[p.jsx($m,{size:12}),"删除"]})]})]}),u&&T!==void 0&&p.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-line bg-danger/5 px-3 py-2 text-[11px]",children:[p.jsx("span",{children:"删除后不再触发,运行历史保留。运行中的任务会被取消。"}),p.jsx("div",{className:"flex-1"}),p.jsx(Se,{size:"sm",variant:"ghost",onClick:()=>f(!1),children:"取消"}),p.jsx(Se,{size:"sm",variant:"danger",onClick:()=>N.mutate(T.id),disabled:N.isPending,children:"确认删除"})]}),T===void 0?p.jsx("p",{role:"status",className:"p-3 text-[11px] text-ink-3",children:"正在读取任务详情…"}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"grid shrink-0 grid-cols-2 gap-2 px-3 py-2 md:grid-cols-4",children:[p.jsx(Jf,{label:"下一次运行",value:T.nextRunAt?sR(T.nextRunAt):"—"}),p.jsx(Jf,{label:"最近运行",value:T.lastRunAt?rl(T.lastRunAt):"—"}),p.jsx(Jf,{label:"超时",value:`${T.timeoutSeconds} 秒`}),p.jsx(Jf,{label:"错过触发",value:T.missedPolicy==="run_once"?"补跑一次":"跳过"})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:p.jsxs("div",{className:"grid gap-2 md:grid-cols-2",children:[p.jsx(aR,{title:"执行配置",children:T.kind==="script"?p.jsxs(p.Fragment,{children:[p.jsx("p",{className:"mb-2 rounded bg-warning/10 px-2 py-1.5 text-[10.5px] text-warning",children:"脚本以本机账户权限运行,不是沙箱;输出有界并脱敏。"}),p.jsx("pre",{className:"max-h-48 overflow-auto rounded bg-surface-2 p-2 text-[10.5px] leading-relaxed",children:T.script?.source??""})]}):p.jsxs("dl",{className:"space-y-2 text-[11px]",children:[p.jsx(ep,{label:"审批策略",value:T.agent?.approvalPolicy==="autonomous"?"完全自主":"只读"}),p.jsx(ep,{label:"模型",value:T.agent?.model??"继承会话默认"}),p.jsx(ep,{label:"提示词",value:p.jsx("span",{className:"whitespace-pre-wrap",children:T.agent?.prompt??""})}),T.agent?.sessionId&&p.jsx(ep,{label:"会话",value:p.jsx("button",{type:"button",className:"text-accent hover:underline",onClick:()=>{at.getState().openPinnedSession(T.agent?.sessionId??"",T.projectId),I()},children:"打开任务会话"})})]})}),p.jsx(aR,{title:"运行历史",children:b.isPending?p.jsx("p",{className:"text-[11px] text-ink-3",children:"正在读取运行历史…"}):b.data?.items.length?p.jsx("div",{className:"space-y-2",children:b.data.items.map(D=>p.jsx(QX,{run:D,onCancel:()=>R.mutate(D.id),onOpenSession:D.sessionId?()=>{at.getState().openPinnedSession(D.sessionId??"",T.projectId),I()}:void 0,cancelling:R.isPending},D.id))}):p.jsx("p",{className:"text-[11px] text-ink-3",children:"还没有运行记录。"})})]})})]})]}):p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-line px-3 py-2",children:[p.jsx("p",{className:"text-[11px] text-ink-3",children:"Cron / 固定间隔任务,支持脚本与 Agent;脚本不是沙箱。"}),p.jsxs(Se,{size:"sm",variant:"secondary",onClick:()=>l("new"),children:[p.jsx($r,{size:12}),"新建任务"]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:m.isPending?p.jsx("p",{role:"status",className:"p-2 text-[11px] text-ink-3",children:"正在读取任务…"}):m.data?.items.length?p.jsx("div",{className:"space-y-1",children:m.data.items.map(D=>p.jsxs("button",{type:"button","aria-label":`${D.name} ${D.lastStatus?A3[D.lastStatus]:"未运行"}`,onClick:()=>s(D.id),className:"flex w-full items-center gap-3 rounded-lg border border-transparent px-2 py-2 text-left hover:border-line hover:bg-surface-2",children:[p.jsx("span",{className:qe("h-1.5 w-1.5 shrink-0 rounded-full",D.enabled?"bg-success":"bg-ink-3/40")}),p.jsxs("span",{className:"min-w-0 flex-1",children:[p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"truncate text-[12px] font-medium",children:D.name}),p.jsx("span",{className:"rounded bg-surface-2 px-1.5 text-[9.5px] text-ink-3",children:rR[D.kind]}),!D.enabled&&p.jsx("span",{className:"text-[9.5px] text-ink-3",children:"已停用"})]}),p.jsx("span",{className:"mt-0.5 block truncate text-[10px] text-ink-3",children:oR(D)})]}),p.jsxs("span",{className:"shrink-0 text-right",children:[p.jsx(Jb,{status:D.lastStatus}),p.jsx("span",{className:"mt-0.5 block text-[10px] text-ink-3",children:D.nextRunAt?`下次 ${sR(D.nextRunAt)}`:"不排期"})]})]},D.id))}):p.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[p.jsx(eN,{size:20,className:"text-ink-3"}),p.jsx("p",{className:"text-[12px] font-medium",children:"还没有定时任务"}),p.jsx("p",{className:"max-w-xs text-[10.5px] text-ink-3",children:"创建脚本或 Agent 任务,Larness 会按 Cron / 间隔在本机执行并保留运行记录。"}),p.jsxs(Se,{size:"sm",variant:"secondary",onClick:()=>l("new"),children:[p.jsx($r,{size:12}),"新建任务"]})]})})]})]})})}function Jb({status:e}){return e===null?p.jsx("span",{className:"text-[10px] text-ink-3",children:"未运行"}):p.jsx("span",{className:qe("text-[10px] font-medium",VX[e]),children:A3[e]})}function Jf({label:e,value:t}){return p.jsxs("div",{className:"rounded-lg bg-surface-2 px-2 py-1.5",children:[p.jsx("div",{className:"text-[9.5px] text-ink-3",children:e}),p.jsx("div",{className:"mt-0.5 truncate text-[11px]",children:t})]})}function aR({title:e,children:t}){return p.jsxs("section",{className:"rounded-lg border border-line p-2",children:[p.jsx("h4",{className:"mb-2 text-[11px] font-semibold",children:e}),t]})}function ep({label:e,value:t}){return p.jsxs("div",{className:"flex gap-2",children:[p.jsx("dt",{className:"w-16 shrink-0 text-ink-3",children:e}),p.jsx("dd",{className:"min-w-0 flex-1",children:t})]})}function QX({run:e,onCancel:t,onOpenSession:n,cancelling:i}){const s=e.status==="running"||e.status==="queued";return p.jsxs("div",{className:"rounded-lg border border-line px-2 py-1.5 text-[10.5px]",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx(Jb,{status:e.status}),p.jsx("span",{className:"text-ink-3",children:GX[e.trigger]}),p.jsx("span",{className:"text-ink-3",children:rl(e.createdAt)}),p.jsx("span",{className:"text-ink-3",children:ZX(e.durationMs)}),p.jsx("span",{className:"flex-1"}),s&&p.jsxs(Se,{size:"sm",variant:"ghost",onClick:t,disabled:i,children:[p.jsx(a1,{size:10}),"取消"]}),n&&p.jsx(Se,{size:"sm",variant:"ghost",onClick:n,children:"打开会话"})]}),e.output&&p.jsx("pre",{className:"mt-1 max-h-24 overflow-auto rounded bg-surface-2 p-1.5 text-[10px]",children:e.output}),e.errorMessage&&p.jsx("p",{className:"mt-1 text-[10px] text-danger",children:e.errorMessage})]})}function JX({job:e,projects:t,catalog:n,onCancel:i,onSaved:s,onError:a}){const[l,u]=w.useState(e?.name??""),[f,h]=w.useState(e?.projectId??""),[g,m]=w.useState(e?.kind??"script"),[_,b]=w.useState(e?.schedule.type??"cron"),[x,S]=w.useState(e?.schedule.type==="cron"?e.schedule.expression:"0 9 * * *"),[C,k]=w.useState(e?.schedule.type==="interval"?String(e.schedule.seconds):"300"),[R,N]=w.useState(e?.schedule.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone),[A,I]=w.useState(String(e?.timeoutSeconds??600)),[T,D]=w.useState(e?.missedPolicy??"skip"),[L,ee]=w.useState(e?.script?.source??'console.log("hello")'),[U,F]=w.useState(e?.agent?.prompt??""),[B,W]=w.useState(e?.agent?.approvalPolicy??"readonly"),[te,G]=w.useState(e?.agent?.model&&e.agent.credentialProfileId?`${e.agent.credentialProfileId}::${e.agent.model}`:""),[P,Z]=w.useState(e?.agent?.approvalPolicy==="autonomous"),[$,ae]=w.useState(!1),[j,_e]=w.useState(null),Le=(n?.groups??[]).flatMap(M=>M.models.filter(K=>K.visible!==!1).map(K=>({key:`${M.credentialProfileId}::${K.id}`,label:`${M.credentialLabel} · ${K.label}`}))),z=async()=>{_e(null);const M=l.trim();if(!M)return _e("请填写任务名称");if(_==="cron"&&x.trim().split(/\s+/).length!==5)return _e("Cron 必须是 5 字段表达式");const K=Number(C);if(_==="interval"&&(!Number.isInteger(K)||K<60))return _e("间隔至少 60 秒");const ne=Number(A);if(!Number.isInteger(ne)||ne<60||ne>3600)return _e("超时需在 60–3600 秒之间");if(g==="agent"&&!U.trim())return _e("请填写 Agent 提示词");if(g==="script"&&!L.trim())return _e("请填写脚本源码");if(g==="agent"&&B==="autonomous"&&!P)return _e("请先确认完全自主风险");const me=_==="cron"?{type:"cron",expression:x.trim(),timezone:R.trim()}:{type:"interval",seconds:K,timezone:R.trim()},[Ee,ve]=te?te.split("::"):[null,null],Re=g==="script"?{name:M,projectId:f||null,kind:"script",schedule:me,enabled:e?.enabled??!0,timeoutSeconds:ne,missedPolicy:T,script:{source:L}}:{name:M,projectId:f||null,kind:"agent",schedule:me,enabled:e?.enabled??!0,timeoutSeconds:ne,missedPolicy:T,agent:{prompt:U.trim(),model:ve??null,credentialProfileId:Ee??null,thinking:e?.agent?.thinking??null,approvalPolicy:B}},re={name:M,enabled:e?.enabled??!0,schedule:me,timeoutSeconds:ne,missedPolicy:T,...g==="script"?{script:{source:L}}:{agent:{prompt:U.trim(),model:ve??null,credentialProfileId:Ee??null,thinking:e?.agent?.thinking??null,approvalPolicy:B}}};ae(!0);try{const he=e?await D3(e.id,re):await HX(Re);s(he)}catch(he){const J=he instanceof Error?he.message:"保存失败";_e(J),a(J)}finally{ae(!1)}};return p.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-3",children:[p.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[p.jsx(Se,{size:"sm",variant:"ghost","aria-label":"取消编辑",onClick:i,children:p.jsx(aa,{size:12})}),p.jsx("h3",{className:"text-[12.5px] font-semibold",children:e?"编辑任务":"新建任务"})]}),p.jsxs("div",{className:"grid gap-3 md:grid-cols-2",children:[p.jsx(Yi,{label:"名称",children:p.jsx("input",{className:Zi,value:l,onChange:M=>u(M.target.value)})}),p.jsx(Yi,{label:"项目",children:p.jsxs("select",{className:Zi,value:f,onChange:M=>h(M.target.value),disabled:e!==null,children:[p.jsx("option",{value:"",children:"默认工作区"}),t.filter(M=>M.kind!=="default").map(M=>p.jsx("option",{value:M.id,children:M.name},M.id))]})}),p.jsx(Yi,{label:"类型",children:p.jsxs("select",{className:Zi,value:g,onChange:M=>m(M.target.value),disabled:e!==null,children:[p.jsx("option",{value:"script",children:"脚本"}),p.jsx("option",{value:"agent",children:"Agent"})]})}),p.jsx(Yi,{label:"触发方式",children:p.jsxs("select",{className:Zi,value:_,onChange:M=>b(M.target.value),children:[p.jsx("option",{value:"cron",children:"Cron"}),p.jsx("option",{value:"interval",children:"固定间隔"})]})}),_==="cron"?p.jsx(Yi,{label:"Cron(分 时 日 月 周)",children:p.jsx("input",{className:Zi,value:x,onChange:M=>S(M.target.value)})}):p.jsx(Yi,{label:"间隔(秒)",children:p.jsx("input",{className:Zi,type:"number",min:60,value:C,onChange:M=>k(M.target.value)})}),p.jsx(Yi,{label:"时区(IANA)",children:p.jsx("input",{className:Zi,value:R,onChange:M=>N(M.target.value)})}),p.jsx(Yi,{label:"超时(秒)",children:p.jsx("input",{className:Zi,type:"number",min:60,max:3600,value:A,onChange:M=>I(M.target.value)})}),p.jsx(Yi,{label:"错过触发",children:p.jsxs("select",{className:Zi,value:T,onChange:M=>D(M.target.value),children:[p.jsx("option",{value:"skip",children:"跳过"}),p.jsx("option",{value:"run_once",children:"补跑一次"})]})}),g==="script"?p.jsxs("div",{className:"md:col-span-2",children:[p.jsx(Yi,{label:"脚本源码(Node ESM)",children:p.jsx("textarea",{className:qe(Zi,"h-40 resize-y font-mono leading-relaxed"),value:L,onChange:M=>ee(M.target.value)})}),p.jsx("p",{className:"mt-1 text-[10px] text-warning",children:"以本机账户权限运行,不是沙箱;可使用文件与网络。"})]}):p.jsxs(p.Fragment,{children:[p.jsx("div",{className:"md:col-span-2",children:p.jsx(Yi,{label:"Agent 提示词",children:p.jsx("textarea",{className:qe(Zi,"h-28 resize-y leading-relaxed"),value:U,onChange:M=>F(M.target.value)})})}),p.jsx(Yi,{label:"审批策略",children:p.jsxs("select",{className:Zi,value:B,onChange:M=>{W(M.target.value),Z(!1)},children:[p.jsx("option",{value:"readonly",children:"只读"}),p.jsx("option",{value:"autonomous",children:"完全自主"})]})}),p.jsx(Yi,{label:"模型",children:p.jsxs("select",{className:Zi,value:te,onChange:M=>G(M.target.value),children:[p.jsx("option",{value:"",children:"继承会话默认"}),Le.map(M=>p.jsx("option",{value:M.key,children:M.label},M.key))]})}),B==="autonomous"&&p.jsxs("label",{className:"md:col-span-2 flex items-start gap-2 rounded-lg border border-danger/30 bg-danger/5 px-2 py-2 text-[11px]",children:[p.jsx("input",{type:"checkbox",className:"mt-0.5",checked:P,onChange:M=>Z(M.target.checked)}),p.jsx("span",{children:"我了解:该任务无人值守运行,可按完全自主策略执行已登记工具(含文件写入 / 命令),程序具有本机账户权限且不是沙箱。"})]})]})]}),j&&p.jsx("p",{role:"alert",className:"mt-2 text-[11px] text-danger",children:j}),p.jsxs("div",{className:"mt-3 flex justify-end gap-2",children:[p.jsx(Se,{size:"sm",variant:"ghost",onClick:i,children:"取消"}),p.jsx(Se,{size:"sm",variant:"secondary",onClick:()=>{z()},disabled:$,children:$?"保存中…":"保存"})]})]})}const Zi="h-8 w-full rounded-md border border-line bg-surface px-2 text-[11.5px] outline-none focus:border-accent";function Yi({label:e,children:t}){return p.jsxs("label",{className:"block",children:[p.jsx("span",{className:"mb-1 block text-[10.5px] text-ink-3",children:e}),t]})}const ex=[{value:"https://open.bigmodel.cn/api/paas/v4",label:"标准 · 国内"},{value:"https://open.bigmodel.cn/api/coding/paas/v4",label:"Coding Plan · 国内"},{value:"https://api.z.ai/api/paas/v4",label:"标准 · 国际"},{value:"https://api.z.ai/api/coding/paas/v4",label:"Coding Plan · 国际"}],v_=ex[0].value;function lR(e){return e==="glm"?"GLM":e==="openai-compatible"?"兼容":"DeepSeek"}function eQ(e){return e.contextWindow===null?"窗口未知":`${Math.round(e.contextWindow/1024)}K 上下文`}function tQ(e){if(!e.thinking.supported)return"不支持思考档位";const t=e.thinking.mode??"levels";return t==="toggle"?"思考 开 / 关":t==="mandatory-levels"?"思考 低 / 中 / 高(强制)":"思考 低 / 中 / 高"}function cR(e){return e.syncedAt===null?"尚未同步":`同步于 ${new Date(e.syncedAt).toLocaleString("zh-CN",{hour12:!1})}`}function nQ({open:e,onOpenChange:t}){const n=zn(),[i,s]=w.useState({kind:"list"}),[a,l]=w.useState([]),[u,f]=w.useState(null),[h,g]=w.useState("deepseek"),[m,_]=w.useState(v_),[b,x]=w.useState(""),[S,C]=w.useState("128"),[k,R]=w.useState(""),[N,A]=w.useState("128"),[I,T]=w.useState("DeepSeek Key"),[D,L]=w.useState(""),[ee,U]=w.useState(!1),[F,B]=w.useState(!1),[W,te]=w.useState(!1),[G,P]=w.useState(null),Z=u?.groups??(u===null?[]:[u]),$=u?.defaultSelection??null,ae=i.kind==="key"?Z.find(J=>J.credentialProfileId===i.credentialId):void 0,j=ae?ae.models.filter(J=>ee||J.contextWindow!==null):[],_e=ae?ae.models.filter(J=>J.contextWindow===null).length:0,Le=J=>a.find(Ie=>Ie.id===J)?.masked??"",z=J=>a.find(Ie=>Ie.id===J)?.endpoint??null,M=i.kind==="key"?a.find(J=>J.id===i.credentialId):void 0,K=async()=>{te(!0),P(null);try{const[J,Ie]=await Promise.all([GY(),Cc().catch(()=>null)]);l(J),f(Ie)}catch(J){P(J instanceof Error?J.message:"加载模型设置失败")}finally{te(!1)}};w.useEffect(()=>{if(!e){L(""),U(!1),s({kind:"list"});return}K()},[e]),w.useEffect(()=>{M?.provider==="openai-compatible"&&(R(M.endpoint??""),A(String(Math.max(1,Math.round((M.contextWindow??128e3)/1024)))))},[M?.id,M?.endpoint,M?.contextWindow]);const ne=async()=>{B(!0),P(null);try{f(await VY()),await n.invalidateQueries({queryKey:["model-catalog"]})}catch(J){P(J instanceof Error?J.message:"刷新目录失败"),f(await Cc().catch(()=>null))}finally{B(!1)}},me=async(J,Ie)=>{if(Ie.contextWindow===null){P("该模型未声明上下文窗口,暂时不能设为默认。");return}B(!0),P(null);try{await WY({model:Ie.id,credentialProfileId:J.credentialProfileId}),f(await Cc()),await n.invalidateQueries({queryKey:["model-catalog"]})}catch(Ze){P(Ze instanceof Error?Ze.message:"设置默认模型失败")}finally{B(!1)}},Ee=async(J,Ie)=>{B(!0),P(null);try{await KY({credentialProfileId:J.credentialProfileId,modelId:Ie.id,visible:Ie.visible===!1}),f(await Cc()),await n.invalidateQueries({queryKey:["model-catalog"]})}catch(Ze){P(Ze instanceof Error?Ze.message:"更新显示状态失败")}finally{B(!1)}},ve=async()=>{if(D.trim()){B(!0),P(null);try{await ZY({provider:h,label:I.trim()||(h==="glm"?"GLM Key":"DeepSeek Key"),apiKey:D,...h==="glm"?{endpoint:m}:{},...h==="openai-compatible"?{endpoint:b.trim(),contextWindow:Math.max(1,Number(S)||128)*1024}:{}}),L(""),await K(),await n.invalidateQueries({queryKey:["model-catalog"]}),s({kind:"list"})}catch(J){P(J instanceof Error?J.message:"保存 Key 失败")}finally{B(!1)}}},Re=async(J,Ie)=>{B(!0),P(null);try{await YY(J,Ie),await K(),await ne()}catch(Ze){P(Ze instanceof Error?Ze.message:"更新端点失败")}finally{B(!1)}},re=async J=>{B(!0),P(null);try{await v3(J,{endpoint:k.trim(),contextWindow:Math.max(1,Number(N)||128)*1024}),await K(),await ne()}catch(Ie){P(Ie instanceof Error?Ie.message:"保存兼容端点失败")}finally{B(!1)}},he=async J=>{B(!0),P(null);try{await XY(J),s({kind:"list"}),await K(),await n.invalidateQueries({queryKey:["model-catalog"]})}catch(Ie){P(Ie instanceof Error?Ie.message:"删除 Key 失败")}finally{B(!1)}};return p.jsx(xi,{open:e,onOpenChange:t,children:p.jsxs(ui,{className:"flex h-[min(660px,calc(100dvh-32px))] w-[min(820px,calc(100vw-32px))] flex-col overflow-hidden p-0",children:[p.jsxs("header",{className:"flex shrink-0 items-start gap-2 border-b border-line px-4 py-3",children:[p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx(Si,{children:"模型与凭据"}),p.jsx(wi,{children:"Key 只保存在本机;隐藏的模型不会出现在会话选择器里。"})]}),p.jsx(S0,{asChild:!0,children:p.jsx(Se,{variant:"ghost",size:"sm","aria-label":"关闭模型设置",children:p.jsx(pa,{size:14})})})]}),G?p.jsx("p",{role:"alert",className:"shrink-0 border-b border-line px-4 py-2 text-[11px] text-danger",children:G}):null,i.kind==="list"?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex shrink-0 items-center justify-between px-4 py-2",children:[p.jsx("span",{className:"text-[10.5px] font-semibold text-ink-3",children:"提供方与 Key"}),p.jsxs(Se,{size:"sm",variant:"secondary",onClick:()=>s({kind:"add"}),children:[p.jsx($r,{size:12}),"添加 Key"]})]}),p.jsxs("div",{className:"min-h-0 flex-1 space-y-2 overflow-y-auto px-4 pb-3",children:[Z.length===0?p.jsx("p",{className:"rounded-xl border border-dashed border-line px-3 py-6 text-center text-[11px] text-ink-3",children:a.length===0?"还没有 Key。添加后即可同步官方模型目录。":"目录为空,先刷新一次。"}):null,Z.map(J=>p.jsxs("button",{type:"button",onClick:()=>s({kind:"key",credentialId:J.credentialProfileId}),className:"flex w-full items-center gap-3 rounded-xl border border-line bg-surface px-3 py-2.5 text-left transition-colors hover:bg-surface-2/60",children:[p.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-surface-2 text-ink-3",children:p.jsx(k$,{size:14})}),p.jsxs("span",{className:"min-w-0 flex-1",children:[p.jsxs("span",{className:"flex items-center gap-2 text-[12.5px] font-medium text-ink",children:[lR(J.provider)," · ",J.credentialLabel,p.jsx("span",{className:"font-mono text-[10px] text-ink-3",children:Le(J.credentialProfileId)})]}),p.jsxs("span",{className:"mt-0.5 flex items-center gap-2 text-[10.5px] text-ink-3",children:[p.jsxs("span",{children:[J.models.length," 个模型"]}),J.provider==="glm"?p.jsx("span",{className:"rounded bg-surface-2 px-1 py-[1px]",children:(z(J.credentialProfileId)??v_).includes("/coding/")?"Coding":"标准"}):null,p.jsx("span",{children:"·"}),p.jsx("span",{children:cR(J)}),J.stale?p.jsx("span",{className:"text-warning",children:"· 待刷新"}):null]})]}),p.jsx(Hr,{size:13,className:"shrink-0 text-ink-3"})]},J.credentialProfileId))]}),p.jsx("footer",{className:"shrink-0 border-t border-line px-4 py-2 text-[10.5px] text-ink-3",children:"默认模型用于新会话;会话内可在输入框切换到其他可见模型。"})]}):null,i.kind==="key"?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-line px-4 py-2",children:[p.jsx(Se,{size:"sm",variant:"ghost","aria-label":"返回凭据列表",onClick:()=>s({kind:"list"}),children:p.jsx(aa,{size:13})}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("p",{className:"truncate text-[12.5px] font-semibold",children:ae?`${lR(ae.provider)} · ${ae.credentialLabel}`:"Key"}),p.jsx("p",{className:"text-[10px] text-ink-3",children:ae?cR(ae):""})]}),ae?.provider==="glm"?p.jsx("select",{"aria-label":"GLM 端点",value:M?.endpoint??v_,disabled:F,onChange:J=>{Re(i.credentialId,J.target.value)},className:"h-7 rounded-lg border border-line bg-surface-2 px-1.5 text-[10.5px] text-ink outline-none",children:ex.map(J=>p.jsx("option",{value:J.value,children:J.label},J.value))}):null,p.jsxs(Se,{size:"sm",variant:"secondary",disabled:F,onClick:()=>{ne()},children:[p.jsx(xl,{size:12,className:F?"animate-spin":void 0}),"刷新目录"]}),_e>0?p.jsx(Se,{size:"sm",variant:"ghost","aria-pressed":ee,"aria-label":ee?"隐藏不可用模型":"显示不可用模型",onClick:()=>U(J=>!J),children:ee?"隐藏不可用":`显示不可用 (${_e})`}):null,p.jsx(Se,{size:"sm",variant:"ghost","aria-label":"删除 Key",disabled:F,onClick:()=>{he(i.credentialId)},children:p.jsx($m,{size:12})})]}),ae?.provider==="openai-compatible"?p.jsxs("div",{className:"flex shrink-0 flex-wrap items-end gap-2 border-b border-line px-4 py-2",children:[p.jsxs("label",{className:"block min-w-0 flex-1 text-[10px] font-semibold text-ink-3",children:["端点 URL",p.jsx("input",{value:k,onChange:J=>R(J.target.value),"aria-label":"兼容端点 URL",className:"mt-1 h-7 w-full rounded-lg border border-line bg-surface-2 px-2 font-mono text-[10.5px] font-normal text-ink outline-none"})]}),p.jsxs("label",{className:"block w-24 text-[10px] font-semibold text-ink-3",children:["窗口(K)",p.jsx("input",{value:N,onChange:J=>A(J.target.value),"aria-label":"兼容上下文窗口(K)",inputMode:"numeric",className:"mt-1 h-7 w-full rounded-lg border border-line bg-surface-2 px-2 font-mono text-[10.5px] font-normal text-ink outline-none"})]}),p.jsx(Se,{size:"sm",variant:"secondary",disabled:F||!k.trim(),onClick:()=>{re(i.credentialId)},children:"保存"})]}):null,p.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:ae===void 0?p.jsx("p",{className:"px-4 py-3 text-[11px] text-ink-3",children:"目录不可用,请刷新。"}):j.length===0?p.jsx("p",{className:"px-4 py-3 text-[11px] text-ink-3",children:ae.models.length===0?"该 Key 还没有可用模型,点“刷新目录”同步。":"暂无可选模型;可显示不可用项查看原因。"}):j.map(J=>{const Ie=J.id===$?.model&&ae.credentialProfileId===$.credentialProfileId,Ze=J.contextWindow===null;return p.jsxs("div",{className:"flex items-center gap-2 border-b border-line/60 px-4 py-2 last:border-b-0",children:[p.jsxs("button",{type:"button",disabled:Ze||F,onClick:()=>{me(ae,J)},className:"min-w-0 flex-1 text-left disabled:cursor-not-allowed disabled:opacity-45",children:[p.jsxs("span",{className:"flex items-center gap-2 text-[12px] font-medium text-ink",children:[J.label,Ie?p.jsx("span",{className:"rounded-full bg-accent-soft px-1.5 py-[1px] text-[9px] text-accent",children:"默认"}):null]}),p.jsxs("span",{className:"mt-0.5 block text-[10.5px] text-ink-3",children:[eQ(J)," · ",tQ(J),Ze?" · 不可选":""]})]}),p.jsxs("button",{type:"button","aria-pressed":J.visible!==!1,"aria-label":`${J.label} 在会话中显示`,disabled:F,onClick:()=>{Ee(ae,J)},className:"flex h-7 items-center gap-1 rounded-lg px-1.5 text-[10.5px] text-ink-3 transition-colors hover:bg-surface-2 hover:text-ink disabled:opacity-50",children:[J.visible===!1?p.jsx(b$,{size:13}):p.jsx(x$,{size:13}),J.visible===!1?"隐藏":"显示"]})]},J.id)})}),p.jsx("footer",{className:"shrink-0 border-t border-line px-4 py-2 text-[10.5px] text-ink-3",children:"点模型名设为新会话默认;眼睛图标控制是否出现在输入框选择器。"})]}):null,i.kind==="add"?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-4 py-2",children:[p.jsx(Se,{size:"sm",variant:"ghost","aria-label":"返回凭据列表",onClick:()=>s({kind:"list"}),children:p.jsx(aa,{size:13})}),p.jsx("span",{className:"text-[12.5px] font-semibold",children:"添加 Key"})]}),p.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto p-4",children:[p.jsx("div",{className:"flex gap-1",children:["deepseek","glm","openai-compatible"].map(J=>p.jsx("button",{type:"button","aria-pressed":h===J,onClick:()=>{g(J),T(J==="glm"?"GLM Key":J==="openai-compatible"?"兼容 Key":"DeepSeek Key")},className:`h-7 rounded-lg px-2.5 text-[10.5px] transition-colors ${h===J?"bg-accent-soft text-accent":"bg-surface-2 text-ink-3 hover:text-ink"}`,children:J==="glm"?"GLM":J==="openai-compatible"?"兼容":"DeepSeek"},J))}),h==="glm"?p.jsxs("label",{className:"block text-[10.5px] font-semibold text-ink-3",children:["端点",p.jsx("select",{"aria-label":"GLM 端点",value:m,onChange:J=>_(J.target.value),className:"mt-1 h-8 w-full rounded-lg border border-line bg-surface-2 px-2 text-[11px] font-normal text-ink outline-none",children:ex.map(J=>p.jsx("option",{value:J.value,children:J.label},J.value))})]}):null,h==="openai-compatible"?p.jsxs(p.Fragment,{children:[p.jsxs("label",{className:"block text-[10.5px] font-semibold text-ink-3",children:["端点 URL",p.jsx("input",{value:b,onChange:J=>x(J.target.value),"aria-label":"兼容端点 URL",placeholder:"https://api.example.com/v1",className:"mt-1 h-8 w-full rounded-lg border border-line bg-surface-2 px-2 font-mono text-[11px] font-normal text-ink outline-none focus:border-accent/40"})]}),p.jsxs("label",{className:"block text-[10.5px] font-semibold text-ink-3",children:["上下文窗口(K)",p.jsx("input",{value:S,onChange:J=>C(J.target.value),"aria-label":"兼容上下文窗口(K)",inputMode:"numeric",className:"mt-1 h-8 w-full rounded-lg border border-line bg-surface-2 px-2 font-mono text-[11px] font-normal text-ink outline-none focus:border-accent/40"})]})]}):null,p.jsxs("label",{className:"block text-[10.5px] font-semibold text-ink-3",children:["名称",p.jsx("input",{value:I,onChange:J=>T(J.target.value),"aria-label":"凭据名称",className:"mt-1 h-8 w-full rounded-lg border border-line bg-surface-2 px-2 text-[11px] font-normal text-ink outline-none focus:border-accent/40"})]}),p.jsxs("label",{className:"block text-[10.5px] font-semibold text-ink-3",children:["API Key",p.jsx("input",{type:"password",value:D,onChange:J=>L(J.target.value),"aria-label":"API Key",placeholder:"sk-…",autoComplete:"off",className:"mt-1 h-8 w-full rounded-lg border border-line bg-surface-2 px-2 font-mono text-[11px] font-normal text-ink outline-none focus:border-accent/40"})]}),p.jsxs(Se,{variant:"primary",size:"sm",disabled:F||!D.trim()||h==="openai-compatible"&&!b.trim(),onClick:()=>{ve()},children:[F?p.jsx(Ss,{size:12,className:"animate-spin"}):null,"添加"]})]})]}):null,W?p.jsxs("p",{className:"flex shrink-0 items-center gap-1.5 px-4 py-2 text-[10.5px] text-ink-3",children:[p.jsx(Ss,{size:11,className:"animate-spin"})," 正在读取…"]}):null]})})}function iQ({open:e,onOpenChange:t}){const n=zn(),[i,s]=w.useState(""),[a,l]=w.useState(""),[u,f]=w.useState(!1),[h,g]=w.useState(null),[m,_]=w.useState(null),[b,x]=w.useState(!1),[S,C]=w.useState(null),k=w.useCallback(async A=>{x(!0),C(null);try{_(await FY(A))}catch(I){C(I instanceof Error?I.message:"无法读取目录")}finally{x(!1)}},[]);w.useEffect(()=>{if(!e){s(""),l(""),g(null),f(!1),_(null),C(null);return}k()},[k,e]);const R=async()=>{if(i.trim()){f(!0),g(null);try{await UY({rootPath:i.trim(),...a.trim()?{name:a.trim()}:{}}),await n.invalidateQueries({queryKey:["workspace"]}),t(!1)}catch(A){g(A instanceof Error?A.message:"添加项目失败")}finally{f(!1)}}},N=()=>{m!==null&&(s(m.path),a.trim()||l(m.path.split(/[\\/]/).filter(Boolean).at(-1)??""))};return p.jsx(xi,{open:e,onOpenChange:t,children:p.jsxs(ui,{className:"w-[min(640px,calc(100vw-40px))]",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-accent-soft text-accent",children:p.jsx(Jj,{size:15})}),p.jsxs("div",{children:[p.jsx(Si,{children:"添加项目"}),p.jsx(wi,{children:"浏览本机目录并选择项目根目录;不会复制或删除源码。"})]})]}),p.jsxs("div",{className:"mt-4 rounded-xl border border-line bg-surface-2/40",children:[p.jsxs("div",{className:"flex items-center gap-1 border-b border-line px-2 py-1.5",children:[p.jsx("button",{type:"button","aria-label":"上一级",title:"上一级",disabled:m===null||m.parent===null||b,onClick:()=>m?.parent&&void k(m.parent),className:"flex h-6 w-6 items-center justify-center rounded text-ink-3 hover:bg-black/[.06] hover:text-ink disabled:opacity-40 dark:hover:bg-white/[.08]",children:p.jsx(m$,{size:13})}),p.jsx("button",{type:"button","aria-label":"主目录",title:"主目录",disabled:b,onClick:()=>{k(m?.home)},className:"flex h-6 w-6 items-center justify-center rounded text-ink-3 hover:bg-black/[.06] hover:text-ink disabled:opacity-40 dark:hover:bg-white/[.08]",children:p.jsx(C$,{size:12})}),p.jsx("button",{type:"button","aria-label":"刷新目录",title:"刷新",disabled:b,onClick:()=>{k(m?.path)},className:"flex h-6 w-6 items-center justify-center rounded text-ink-3 hover:bg-black/[.06] hover:text-ink disabled:opacity-40 dark:hover:bg-white/[.08]",children:p.jsx(xl,{size:12})}),p.jsx("span",{className:"min-w-0 flex-1 truncate px-1 font-mono text-[10.5px] text-ink-2",children:m?.path??"读取中…"})]}),p.jsxs("div",{className:"h-[230px] overflow-auto p-1.5",children:[b?p.jsxs("div",{className:"flex h-full items-center justify-center gap-1.5 text-[11px] text-ink-3",children:[p.jsx(Ss,{size:12,className:"animate-spin"})," 正在读取目录…"]}):S?p.jsx("p",{role:"alert",className:"rounded-lg bg-danger/10 px-2.5 py-2 text-[11px] text-danger",children:S}):m?.entries.length===0?p.jsx("p",{className:"px-2 py-3 text-[11px] text-ink-3",children:"没有子目录"}):m?.entries.map(A=>p.jsxs("button",{type:"button",onClick:()=>{k(A.path)},className:"flex h-8 w-full items-center gap-2 rounded-md px-2 text-left text-[11.5px] text-ink-2 hover:bg-black/[.05] hover:text-ink dark:hover:bg-white/[.07]",children:[p.jsx(Um,{size:13,className:"shrink-0 text-accent/80"}),p.jsx("span",{className:"min-w-0 flex-1 truncate",children:A.name})]},A.path)),m?.truncated?p.jsx("p",{className:"px-2 py-1 text-[10px] text-warning",children:"目录过多,仅显示前 500 项"}):null]}),p.jsxs("div",{className:"flex items-center gap-2 border-t border-line px-2 py-1.5",children:[p.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-ink-3",children:i||"尚未选择项目目录"}),p.jsx(Se,{variant:"secondary",size:"sm",disabled:m===null||b,onClick:N,children:"选择当前目录"})]})]}),p.jsxs("label",{className:"mt-3 block text-[11px] font-medium text-ink-2",children:["项目目录(也可直接粘贴绝对路径)",p.jsx("input",{value:i,onChange:A=>s(A.target.value),"aria-label":"项目目录",placeholder:"/Users/me/project",spellCheck:!1,className:"mt-1.5 h-9 w-full rounded-lg border border-line bg-surface-2 px-2.5 font-mono text-[11.5px] text-ink outline-none focus:border-accent/40"})]}),p.jsxs("label",{className:"mt-2.5 block text-[11px] font-medium text-ink-2",children:["显示名称(可选)",p.jsx("input",{value:a,onChange:A=>l(A.target.value),placeholder:"默认取目录名",className:"mt-1.5 h-9 w-full rounded-lg border border-line bg-surface-2 px-2.5 text-[11.5px] text-ink outline-none focus:border-accent/40"})]}),h?p.jsx("p",{role:"alert",className:"mt-3 rounded-lg bg-danger/10 px-2.5 py-2 text-[11px] text-danger",children:h}):null,p.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[p.jsx(Se,{variant:"secondary",size:"sm",onClick:()=>t(!1),children:"取消"}),p.jsx(Se,{variant:"primary",size:"sm",disabled:u||!i.trim(),onClick:()=>{R()},children:u?"正在添加…":"添加项目"})]})]})})}function rQ({project:e,open:t,onClose:n}){const i=zn(),[s,a]=w.useState(""),[l,u]=w.useState(!1),[f,h]=w.useState(null);w.useEffect(()=>{a(e?.name??""),h(null),u(!1)},[e]);const g=async()=>{if(!(e===null||!s.trim())){u(!0),h(null);try{await $Y(e.id,{name:s.trim()}),await i.invalidateQueries({queryKey:["workspace"]}),n()}catch(m){h(m instanceof Error?m.message:"重命名失败")}finally{u(!1)}}};return p.jsx(xi,{open:t&&e!==null,onOpenChange:m=>m?void 0:n(),children:p.jsxs(ui,{children:[p.jsx(Si,{children:"重命名项目"}),p.jsx(wi,{children:"只改变展示名称,不移动或重命名本地目录。"}),p.jsx("input",{value:s,onChange:m=>a(m.target.value),"aria-label":"项目名称",autoFocus:!0,className:"mt-4 h-9 w-full rounded-lg border border-line bg-surface-2 px-2.5 text-[12px] text-ink outline-none focus:border-accent/40"}),f?p.jsx("p",{role:"alert",className:"mt-2 text-[11px] text-danger",children:f}):null,p.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[p.jsx(Se,{variant:"secondary",size:"sm",onClick:n,children:"取消"}),p.jsx(Se,{variant:"primary",size:"sm",disabled:l||!s.trim(),onClick:()=>{g()},children:l?"正在保存…":"保存"})]})]})})}const er=eu(e=>({draft:"",modelId:"deepseek-flash",credentialProfileId:null,thinking:"medium",policy:"standard",setDraft:t=>e({draft:t}),setModelId:t=>e({modelId:t}),setCredentialProfileId:t=>e({credentialProfileId:t}),setThinking:t=>e({thinking:t}),setPolicy:t=>e({policy:t})})),sQ=["service-ops","services"],oQ=e=>["service-ops","deployments",e],aQ=e=>["service-ops","logs",e];async function lQ(e,t){return XM.parse(await we(`/api/service-ops/services/${encodeURIComponent(e)}/control`,{method:"POST",csrf:!0,body:t}))}async function cQ(){return YZ.parse(await we("/api/service-ops/services"))}async function uQ(e){return(await we(`/api/service-ops/services/${encodeURIComponent(e)}/deployments`)).items}async function dQ(e){return we(`/api/service-ops/services/${encodeURIComponent(e)}/logs`)}const hQ={stopped:"已停止",starting:"启动中",running:"运行中",unhealthy:"不健康",stopping:"停止中",failed:"失败",unknown:"未知"},y_={start:"启动",stop:"停止",restart:"重启"};function fQ({open:e,onOpenChange:t}){const n=zn(),[i,s]=w.useState(null),[a,l]=w.useState(null),[u,f]=w.useState(!1),h=Pt({queryKey:sQ,queryFn:cQ,enabled:e,refetchInterval:e?3e3:!1}),g=h.data?.items.find(({targetId:N})=>N===i);w.useEffect(()=>{h.data&&i&&!h.data.items.some(N=>N.targetId===i)&&(s(null),l(null),f(!1))},[h.data,i]);const m=g?.targetId??"",_=Pt({queryKey:oQ(m),queryFn:()=>uQ(m),enabled:e&&!!g&&g.source!=="pm2-cli"}),b=Pt({queryKey:aQ(m),queryFn:()=>dQ(m),enabled:e&&!!g,refetchInterval:e&&g?3e3:!1}),x=()=>n.invalidateQueries({queryKey:["service-ops"]}),S=wc({mutationFn:({service:N,action:A,requestKey:I})=>lQ(N.targetId,{action:A,requestKey:I,expectedPm2Name:N.pm2Name,confirmed:!0}),retry:!1,onSuccess:()=>{l(null),f(!1)},onError:()=>{l(null),f(!0)},onSettled:()=>{x()}}),C=N=>{if(!g||S.isPending)return;f(!1);const A={service:g,action:N,requestKey:crypto.randomUUID()};N==="start"?S.mutate(A):l(A)},k=N=>{const A=at.getState();(A.projectId!==N.projectId||!A.sessionId)&&A.startDraft(N.projectId);const I=er.getState();I.draft.trim()||I.setDraft(`请检查 PM2 服务 ${N.pm2Name} 的状态和日志。`),A.focusComposer(),t(!1)},R=S.isPending||h.isError||!!g&&["starting","stopping","unknown"].includes(g.observedState);return p.jsx(xi,{open:e,onOpenChange:N=>{N||(s(null),l(null),f(!1)),t(N)},children:p.jsxs(ui,{className:"flex h-[min(660px,calc(100dvh-32px))] w-[min(900px,calc(100vw-32px))] flex-col overflow-hidden p-0","data-testid":"service-ops-dialog",children:[p.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2",children:[p.jsx(Pc,{size:14,className:"text-ink-3"}),p.jsx(Si,{className:"text-[12px] font-semibold",children:"服务运维"}),p.jsx(wi,{className:"sr-only",children:"查看正式服务状态、日志及启停操作"}),p.jsx("span",{className:"rounded bg-surface-2 px-1.5 text-[10px] text-ink-3",children:h.data?.items.length??0}),p.jsx("div",{className:"flex-1"}),p.jsxs(Se,{size:"sm",variant:"ghost",disabled:h.isFetching,onClick:()=>{x()},children:[p.jsx(xl,{size:12,className:h.isFetching?"animate-spin":void 0}),"刷新"]}),p.jsx(S0,{asChild:!0,children:p.jsx(Se,{size:"sm",variant:"ghost","aria-label":"关闭服务运维",children:p.jsx(pa,{size:14})})})]}),h.isError&&p.jsx("p",{role:"alert",className:"border-b border-line px-3 py-2 text-[11px] text-danger",children:h.data?"刷新失败,当前为上次观察结果。":"正式服务不可用,请刷新重试。"}),u&&p.jsx("p",{role:"alert",className:"border-b border-line px-3 py-2 text-[11px] text-danger",children:"操作失败,请刷新状态和日志后再试。"}),h.isPending?p.jsx("p",{role:"status",className:"p-3 text-[11px] text-ink-3",children:"正在读取服务…"}):g?p.jsxs("section",{className:"flex min-h-0 flex-1 flex-col","aria-label":"服务详情",children:[p.jsxs("div",{className:"flex shrink-0 flex-wrap items-start gap-2 border-b border-line px-3 py-2",children:[p.jsx(Se,{size:"sm",variant:"ghost","aria-label":"返回服务列表",onClick:()=>{s(null),f(!1)},children:p.jsx(aa,{size:12})}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("h3",{className:"truncate text-[12.5px] font-semibold",children:g.name}),p.jsx(uR,{service:g})]}),p.jsxs("p",{className:"mt-1 text-[10px] text-ink-3",children:["所属项目 ",g.projectName??g.projectId]})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[p.jsxs(Se,{size:"sm",variant:"secondary",onClick:()=>k(g),children:[p.jsx(r1,{size:12}),"在项目会话中处理"]}),g.observedState!=="running"&&p.jsxs(Se,{size:"sm",variant:"secondary",disabled:R||g.reasonCode==="PM2_MISSING",onClick:()=>C("start"),children:[p.jsx(xz,{size:12}),"启动"]}),p.jsxs(Se,{size:"sm",variant:"secondary",disabled:R||g.observedState==="stopped",onClick:()=>C("restart"),children:[p.jsx(z$,{size:12}),"重启"]}),p.jsxs(Se,{size:"sm",variant:"danger",disabled:R||g.observedState==="stopped",onClick:()=>C("stop"),children:[p.jsx(a1,{size:11}),"停止"]})]})]}),p.jsxs("div",{className:"grid shrink-0 grid-cols-2 gap-2 px-3 py-2 md:grid-cols-4",children:[p.jsx(tp,{label:"PM2 服务",value:g.pm2Name,mono:!0}),p.jsx(tp,{label:"进程 PID",value:g.pid?.toString()??"—",mono:!0}),p.jsx(tp,{label:"健康检查",value:g.lastHealthAt?rl(g.lastHealthAt):"未核验"}),p.jsx(tp,{label:"最近观察",value:rl(g.updatedAt)})]}),S.isPending&&p.jsxs("p",{role:"status",className:"px-3 pb-2 text-[11px] text-ink-3",children:["正在",y_[S.variables.action],",等待 PM2 状态…"]}),g.reasonCode&&g.reasonCode!=="HEALTH_UNVERIFIED"&&p.jsx("p",{className:"px-3 pb-2 text-[11px] text-danger [overflow-wrap:anywhere]",children:g.reasonCode==="PM2_MISSING"?"PM2 中已无此服务,请在项目会话中重新部署。":g.reasonCode}),p.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-1.5 px-3 pb-3",children:[p.jsxs("h3",{className:"flex items-center gap-1.5 text-[10px] uppercase tracking-[0.08em] text-ink-3",children:[p.jsx(B$,{size:11}),"运行日志"]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-auto rounded-lg border border-line bg-[#0f1115] p-2 font-mono text-[10px] leading-5 text-[#c7ccd4]",children:b.isError?p.jsx("p",{role:"alert",className:"text-red-300",children:"日志读取失败,请刷新重试。"}):b.isPending?p.jsx("p",{className:"text-white/35",children:"读取中…"}):p.jsx("pre",{className:"whitespace-pre-wrap break-all",children:b.data.text||"暂无日志"})}),b.data?.truncated&&p.jsx("p",{className:"text-[10px] text-ink-3",children:"仅显示最近日志。"})]}),g.source!=="pm2-cli"&&p.jsxs("details",{className:"max-h-36 shrink-0 overflow-auto border-t border-line px-3 py-2 text-[11px] text-ink-2",children:[p.jsxs("summary",{className:"cursor-pointer",children:["历史发布记录",g.version?` · ${g.version}`:""]}),_.isError?p.jsx("p",{children:"发布记录读取失败"}):_.data?.length?_.data.map(N=>p.jsx(pQ,{deployment:N},N.id)):p.jsx("p",{className:"mt-2",children:"暂无发布记录"})]})]}):p.jsxs("section",{className:"min-h-0 flex-1 overflow-auto p-3","aria-label":"正式服务列表",children:[h.data?.items.length?p.jsx("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2",children:h.data.items.map(N=>p.jsxs("button",{type:"button",className:"min-w-0 rounded-lg border border-line bg-surface p-2.5 text-left transition-colors hover:bg-surface-2",onClick:()=>{s(N.targetId),f(!1)},children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"truncate text-[12px] font-medium",children:N.name}),p.jsx(uR,{service:N}),p.jsx("span",{className:"ml-auto rounded bg-black/[0.04] px-1.5 py-0.5 text-[9px] text-ink-3 dark:bg-white/[0.07]",children:"PM2"})]}),p.jsx("p",{className:"mt-2 truncate text-[11px] text-ink-2",children:N.projectName??N.projectId}),p.jsx("p",{className:"mt-1 truncate font-mono text-[10px] text-ink-3",children:N.pm2Name}),p.jsxs("p",{className:"mt-2 text-[9.5px] text-ink-3",children:[N.pid?`PID ${N.pid} · `:"","观察于"," ",rl(N.updatedAt)]})]},N.targetId))}):!h.isError&&p.jsxs("div",{className:"grid h-full content-center justify-items-center gap-2 text-center",children:[p.jsx(Pc,{size:22,className:"text-ink-3"}),p.jsx("p",{className:"text-[12px] font-medium",children:"暂无正式服务"}),p.jsx("p",{className:"max-w-sm text-[11px] text-ink-3",children:"在项目会话中让 Agent 通过 PM2 部署,运行后即可查看和管理。"})]}),!!h.data?.unassociated.length&&p.jsxs("div",{className:"mt-3 rounded-lg border border-line bg-surface-2/50 p-2.5 text-[11px] text-ink-3",children:[p.jsx("p",{children:"未关联项目的 PM2 服务"}),h.data.unassociated.map(N=>p.jsx("p",{className:"mt-1 font-mono text-[10px] [overflow-wrap:anywhere]",children:N.pm2Name},N.pm2Name))]})]}),h.data?.pm2Home&&p.jsxs("details",{className:"shrink-0 border-t border-line bg-surface-2/30 px-3 py-2 text-[10px] text-ink-3",children:[p.jsx("summary",{className:"cursor-pointer",children:"本机 PM2 查询命令"}),p.jsx("p",{className:"mt-2",children:"终端查询时使用此实例目录,与页面保持一致。"}),p.jsx("code",{className:"mt-1 block select-all break-all font-mono text-ink-2",children:`PM2_HOME='${h.data.pm2Home.replaceAll("'","'\\''")}' pm2 list`})]}),p.jsx(xi,{open:e&&!!a,onOpenChange:N=>{!N&&!S.isPending&&l(null)},children:p.jsxs(ui,{className:"w-[min(400px,calc(100vw-32px))] space-y-3",children:[p.jsxs(Si,{children:[a?y_[a.action]:"操作","服务?"]}),p.jsx(wi,{className:"text-[12px] leading-relaxed",children:a?.action==="stop"?"停止后服务将无法访问,可随时重新启动。":"重启期间服务会短暂中断。"}),p.jsxs("div",{className:"rounded-lg border border-line bg-surface-2/50 p-2.5",children:[p.jsx("p",{className:"text-[12px] font-medium",children:a?.service.name}),p.jsx("p",{className:"mt-1 text-[11px] text-ink-3",children:a?.service.projectName??a?.service.projectId}),p.jsx("p",{className:"mt-1 break-all font-mono text-[10px] text-ink-3",children:a?.service.pm2Name})]}),p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(Se,{size:"sm",variant:"secondary",disabled:S.isPending,onClick:()=>l(null),children:"取消"}),p.jsx(Se,{size:"sm",variant:a?.action==="stop"?"danger":"primary",disabled:S.isPending,onClick:()=>{a&&S.mutate(a)},children:S.isPending?"处理中…":`确认${a?y_[a.action]:"操作"}`})]})]})})]})})}function uR({service:e}){return p.jsx("span",{className:qe("shrink-0 rounded-full border px-1.5 py-[1px] text-[9px]",e.observedState==="running"?"border-success/20 bg-success/10 text-success":e.observedState==="failed"||e.observedState==="unhealthy"?"border-danger/20 bg-danger/10 text-danger":"border-line bg-surface-2 text-ink-3"),children:hQ[e.observedState]})}function tp({label:e,value:t,mono:n}){return p.jsxs("div",{className:"min-w-0 rounded-lg border border-line bg-surface-2/50 px-2 py-1.5",children:[p.jsx("p",{className:"text-[9px] uppercase tracking-[0.08em] text-ink-3",children:e}),p.jsx("p",{className:qe("mt-1 truncate text-[11px]",n&&"font-mono"),title:t,children:t})]})}function pQ({deployment:e}){return p.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-[11px] text-ink-3",children:[p.jsx("span",{children:e.version}),p.jsx("span",{children:e.reasonCode??e.status}),p.jsx("span",{children:rl(e.createdAt)})]})}const L1=eu(e=>({extra:[],create:t=>{const n={id:`ses_local_${Math.random().toString(36).slice(2,9)}`,projectId:t,title:"新会话",status:"idle",updatedAt:Date.now()};return e(i=>({extra:[n,...i.extra]})),n},rename:(t,n)=>e(i=>({extra:i.extra.map(s=>s.id===t?{...s,title:n}:s)}))}));function O3(){const e=L1(s=>s.create),t=at(s=>s.startDraft),n=at(s=>s.selectSession),i=at(s=>s.focusComposer);return w.useCallback(async()=>{const s=at.getState().projectId;t(s),i()},[e,i,n,t])}const Qo=e=>["terminals","detail",e],j3=e=>["EXITED","TERMINATED","INTERRUPTED"].includes(e),B1=e=>e.title??e.role??`Shell ${e.id.slice(-6)}`;async function tu(e){return Gm.parse(await we(`/api/terminals/${encodeURIComponent(e)}`))}async function z3(e,t){return NY.parse(await we(`/api/terminals?limit=50${t&&"projectId"in t?`&projectId=${encodeURIComponent(t.projectId)}`:t&&"sessionId"in t?`&workspaceSessionId=${encodeURIComponent(t.sessionId)}`:"&global=true"}${e?`&cursor=${encodeURIComponent(e)}`:""}`))}async function mQ(e,t){return Gm.parse(await we("/api/terminals",{method:"POST",csrf:!0,headers:{"Idempotency-Key":t},body:{scope:e,riskAcknowledged:!0}}))}async function Ja(e,t,n){const i=Gm.parse(await we(`/api/terminals/${encodeURIComponent(e)}/${t}`,{method:"POST",csrf:!0,body:n}));return qt.setQueryData(Qo(e),i),t==="rename"&&et.setState(s=>({windows:s.windows.map(a=>({...a,tabs:a.tabs.map(l=>l.resourceId===e?{...l,title:B1(i)}:l)}))})),await qt.invalidateQueries({queryKey:["terminals"]}),i}function Qm(e){qt.setQueryData(Qo(e.id),e),et.getState().open({kind:"terminal",resourceId:e.id,title:B1(e),projectId:e.projectId,sessionId:e.projectId?e.sourceSessionId:e.workspaceSessionId,source:e.mode==="dev"?"agent":e.projectId?"project":e.workspaceSessionId?"session":"global"});for(const t of et.getState().windows)if(t.tabs.some(n=>n.resourceId===e.id))for(const n of t.tabs)n.resourceId==="terminal:empty"&&et.getState().closeTab(t.id,n.id)}function gQ(e,t){const n=O1.safeParse(e.resourceTarget);return!n.success||typeof e.originClientSessionId!="string"||e.originClientSessionId!==t?!1:(vQ(n.data),!0)}function vQ(e,t=!1){qt.invalidateQueries({queryKey:["terminals"]}),et.getState().open({kind:"terminal",resourceId:e.terminalId,title:e.role??"终端",projectId:e.projectId,source:"agent",activate:t})}function F1(e){return e.status==="EXITED"||e.status==="TERMINATED"||e.status==="INTERRUPTED"&&e.reasonCode==="NOT_STARTED"}async function M3(e,t){const n=O1.safeParse(e.closedTerminalTarget);if(!n.success||!t||e.originClientSessionId!==t)return!1;const{terminalId:i,projectId:s}=n.data,a=()=>et.getState().windows.flatMap(l=>l.tabs.filter(u=>u.kind==="terminal"&&u.resourceId===i&&u.projectId===s).map(u=>({windowId:l.id,tabId:u.id})));if(!a().length)return!1;try{const l=await tu(i);if(l.id!==i||l.projectId!==s||!F1(l))return!1;qt.setQueryData(Qo(i),l);const u=et.getState().focusedId;for(const f of a())et.getState().closeTab(f.windowId,f.tabId);return u&&et.getState().windows.some(f=>f.id===u)&&et.setState({focusedId:u}),qt.invalidateQueries({queryKey:["terminals"]}),!0}catch{return!1}}function Jm(e){return e.payload??{}}function Tt(e,t){const n=e[t];return typeof n=="string"?n:void 0}function am(e,t){const n=e[t];return typeof n=="number"?n:void 0}function _r(e,t){const n=e.findIndex(s=>s.id===t.id);if(n===-1)return[...e,t];const i=[...e];return i[n]=t,i}function np(e,t,n){return e.map(i=>i.kind==="tool"&&i.id===t?{...i,...n}:i)}function yQ(e,t,n){return e.map(i=>i.kind==="approval"&&i.id===t?{...i,status:n}:i)}function sd(e,t){const n=Tt(t,"toolCallId")??`${e.eventId}_tool`,i=Tt(t,"turnId");return i===void 0?n:`${i}:${n}`}function I3(e,t){const n=e.find(i=>i.kind==="message"&&i.id===t.messageId);return _r(e,{id:t.messageId,kind:"message",role:"assistant",text:`${n?.text??""}${t.text}`,createdAt:n?.createdAt??t.createdAt,...n?.turnId===void 0&&t.turnId===void 0?{}:{turnId:n?.turnId??t.turnId},streaming:!0})}function _Q(e,t){const n=Jm(t),i=Tt(n,"turnId")??t.eventId;switch(t.type){case"user.message":{const s=Tt(n,"text")??"",a=e.filter(l=>!l.id.startsWith("optimistic_user_"));return _r(a,{id:`msg_${i}_user`,kind:"message",role:"user",text:s,createdAt:t.timestamp,turnId:i})}case"assistant.message":{const s=Tt(n,"text")??"",l={id:Tt(n,"messageId")??`msg_${i}_assistant`,kind:"message",role:"assistant",text:s,createdAt:t.timestamp,turnId:i};return _r(e,l)}case"assistant.delta":{const s=Tt(n,"text")??"",a=Tt(n,"messageId")??`msg_${i}_assistant`;return I3(e,{messageId:a,text:s,createdAt:t.timestamp,turnId:i})}case"tool.requested":{const s={id:sd(t,n),kind:"tool",turnId:i,name:Tt(n,"name")??"tool",summary:Tt(n,"argsSummary")??"",args:"",status:"running",createdAt:t.timestamp};return _r(e,s)}case"tool.started":{const s=sd(t,n);return e.some(a=>a.kind==="tool"&&a.id===s)?np(e,s,{status:"running"}):_r(e,{id:s,kind:"tool",turnId:i,name:Tt(n,"name")??"tool",summary:"",args:"",status:"running",createdAt:t.timestamp})}case"tool.command.created":{const s=Tt(n,"commandId"),a=PM.safeParse(n.command);return s&&/^cmd_[a-f0-9-]{36}$/.test(s)?np(e,sd(t,n),{commandId:s,...a.success?{args:JSON.stringify(a.data,null,2)}:{}}):e}case"tool.completed":{const s=sd(t,n),a=bY.safeParse(n.resourceTarget);return np(e,s,{status:"done",output:Tt(n,"resultSummary")??"",...a.success?{resourceTarget:a.data}:{}})}case"tool.failed":{const s=sd(t,n),a=`${Tt(n,"errorCode")??"TOOL_ERROR"}: ${Tt(n,"message")??"tool failed"}`;return np(e,s,{status:"error",output:a})}case"file.changed":{const s=Tt(n,"path")??"file",a=Tt(n,"version")??"",l={id:`file_${i}_${s}_${a}`,kind:"artifact",turnId:i,title:`已修改 ${s}`,description:`文件变更 · ${Tt(n,"changeType")??"modified"}`,meta:a.slice(0,12),createdAt:t.timestamp};return _r(e,l)}case"tool.approval.required":{const s={id:Tt(n,"approvalId")??`approval_${t.eventId}`,kind:"approval",turnId:i,toolName:Tt(n,"toolName"),summary:Tt(n,"summary"),risk:Tt(n,"risk"),scope:n.scope,expiresAt:am(n,"expiresAt"),status:"pending",createdAt:t.timestamp};return _r(e,s)}case"tool.approval.resolved":{const s=Tt(n,"approvalId")??"",l=Tt(n,"decision")==="approved"?"approved":"rejected";return e.some(u=>u.kind==="approval"&&u.id===s)?yQ(e,s,l):e}case"plan.updated":{const s=yY.safeParse(n.plan);return s.success?_r(e,s.data):e}case"artifact.created":{const s=n.artifact;return s===void 0?e:_r(e,s)}case"turn.failed":{const s={id:`error_${i}`,kind:"error",turnId:i,message:`${Tt(n,"errorCode")??"INTERNAL"}: ${Tt(n,"message")??"执行失败"}`,createdAt:t.timestamp};return _r(e,s)}case"turn.interrupted":return _r(e,{id:`interrupted_${i}`,kind:"error",turnId:i,message:"执行已中断,请重新发送任务。",createdAt:t.timestamp});case"turn.cancelled":return _r(e,{id:`cancelled_${i}`,kind:"error",turnId:i,message:"已停止当前执行。",createdAt:t.timestamp});default:return e}}function P3(e,t){const n=_Q(e,t);if(!tx(t))return n;const i=Jm(t),s=B3(t),a=t.type==="turn.completed"?"completed":t.type==="turn.failed"?"failed":t.type==="turn.cancelled"?"cancelled":"interrupted";return n.map(l=>l.turnId===s&&l.kind==="message"?{...l,streaming:!1,...l.role==="user"?{turnOutcome:a,durationMs:am(i,"durationMs")}:{}}:l)}function L3(e){const t={};for(const n of e){if(n.type!=="model.usage")continue;const i=Jm(n),s=Tt(i,"model"),a=am(i,"inputTokens"),l=am(i,"contextWindow");s===void 0||a===void 0||l===void 0||(t[s]={inputTokens:a,contextWindow:l,updatedAt:n.timestamp})}return t}function bQ(e){return e.reduce((t,n)=>P3(t,n),[])}function tx(e){return e.type==="turn.completed"||e.type==="turn.failed"||e.type==="turn.cancelled"||e.type==="turn.interrupted"}function B3(e){return Tt(Jm(e),"turnId")??null}function dR(e){return e.replace(/\s+/g," ").trim().slice(-240).trimStart()}function xQ(e,t){return e.findIndex(i=>i.id===t.id)===-1?[...e,{id:t.id,kind:"reasoning",text:dR(t.text),streaming:!0,createdAt:t.createdAt,...t.turnId===void 0?{}:{turnId:t.turnId}}]:e.map(i=>i.id===t.id&&i.kind==="reasoning"?{...i,text:dR(`${i.text}${t.text}`),streaming:!0}:i)}let hR=null,Ad=null,jp=null,xc=null,__=0,b_=!1;function od(e){return{id:`error_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,kind:"error",message:e,createdAt:Date.now()}}function nx(){jp!==null&&(window.clearTimeout(jp),jp=null),xc=null,Ad?.close(),Ad=null}function SQ(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n?.type!=="context.compressed")continue;return{degraded:(typeof n.payload=="object"&&n.payload!==null?n.payload:{}).degraded===!0,createdAt:n.timestamp}}return null}function wQ(e){for(let t=e.length-1;t>=0;t-=1){const n=e[t];if(n?.type!=="turn.completed")continue;const i=typeof n.payload=="object"&&n.payload!==null?n.payload.usage:null;if(typeof i=="object"&&i!==null){const s=i;if(typeof s.inputTokens=="number")return s.inputTokens;if(typeof s.totalTokens=="number")return s.totalTokens}}return 0}function CQ(e){const t=Dt.getState();e.sessionId===t.sessionId&&Dt.setState({items:I3(t.items,{messageId:e.messageId,text:e.text,createdAt:e.timestamp,turnId:e.turnId}),isStreaming:!0,activeTurnId:t.activeTurnId??e.turnId,turnStartedAt:t.turnStartedAt??e.timestamp})}function kQ(e){const t=Dt.getState();e.sessionId===t.sessionId&&Dt.setState({items:xQ(t.items,{id:`reasoning_${e.turnId}`,turnId:e.turnId,text:e.text,createdAt:e.timestamp}),activeTurnId:t.activeTurnId??e.turnId,turnStartedAt:t.turnStartedAt??e.timestamp})}function F3(e,t=!1){const n=Dt.getState();if(e.sessionId!==void 0&&e.sessionId!==n.sessionId||e.sequence<=n.lastSeq)return;if(e.sequence!==n.lastSeq+1){n.syncEvents();return}const i=e.payload??{},s=B3(e),a=typeof i.status=="string"?i.status:null,l=e.type==="turn.created"||e.type==="turn.status"?s??n.activeTurnId:n.activeTurnId,u=tx(e)?!1:e.type==="turn.created"||a==="QUEUED"||a==="PREPARING"||a==="RUNNING"||a==="WAITING_APPROVAL"||a==="CANCELLING"?!0:n.isStreaming,f=tx(e),h=P3(n.items,e).map(b=>f&&b.kind==="reasoning"?{...b,streaming:!1}:b),g=e.type==="turn.completed"&&typeof i.usage=="object"&&i.usage!==null?i.usage:null,m=typeof g?.inputTokens=="number"?g.inputTokens:typeof g?.totalTokens=="number"?g.totalTokens:n.contextTokens,_=e.type==="model.usage"?{...n.modelUsage,...L3([e])}:n.modelUsage;if(Dt.setState({items:f?h.map(b=>b.kind==="message"?{...b,streaming:!1}:b):h,lastSeq:e.sequence,activeTurnId:f?null:l,isStreaming:u,contextTokens:m,contextNotice:e.type==="context.compressed"?{degraded:i.degraded===!0,createdAt:e.timestamp}:n.contextNotice,modelUsage:_,turnStartedAt:f||u?f?null:n.turnStartedAt??e.timestamp:n.turnStartedAt}),e.type==="tool.completed"){const b=qt.getQueryData(["session"]);M3(i,b?.clientSessionId)}if(t&&e.type==="tool.completed"&&typeof i.originClientSessionId=="string"){qt.invalidateQueries({queryKey:["terminals"]});const b=qt.getQueryData(["session"]);gQ(i,b?.clientSessionId)}}function U3(e){if(typeof window>"u")return;nx(),xc=e;const t=window.location.protocol==="https:"?"wss":"ws",n=new WebSocket(`${t}://${window.location.host}/ws`);Ad=n,n.addEventListener("open",()=>{xc===e&&n.send(JSON.stringify({type:"subscribe",subscriptions:[{topic:"agent",resourceId:e}]}))}),n.addEventListener("message",i=>{if(xc!==e)return;let s;try{s=JSON.parse(String(i.data))}catch{return}if(typeof s!="object"||s===null)return;const a=s;if(a.kind==="subscribed"){(typeof a.currentSequence=="number"?a.currentSequence:0)>Dt.getState().lastSeq&&Dt.getState().syncEvents();return}if(a.kind==="assistant.delta"&&a.topic==="agent"){CQ(a);return}if(a.kind==="assistant.reasoning.delta"&&a.topic==="agent"){kQ(a);return}a.kind==="event"&&a.topic==="agent"&&F3(a,!0)}),n.addEventListener("close",i=>{if(!(Ad!==n||xc!==e)){if(Ad=null,i.code===1008){window.dispatchEvent(new Event("larness:unauthenticated"));return}jp=window.setTimeout(()=>{xc===e&&U3(e)},1e3)}}),n.addEventListener("error",()=>n.close())}const Dt=eu((e,t)=>({sessionId:"",items:[],loading:!1,isStreaming:!1,activeTurnId:null,turnStartedAt:null,contextTokens:0,contextNotice:null,modelUsage:{},lastSeq:0,load:async n=>{const i=++__;if(nx(),hR?.abort(),hR=null,e({sessionId:n,items:[],loading:!!n,isStreaming:!1,activeTurnId:null,turnStartedAt:null,contextTokens:0,contextNotice:null,modelUsage:{},lastSeq:0}),!n){e({loading:!1});return}if(n.startsWith("draft_")){e({loading:!1});return}try{const[s,a]=await Promise.all([y3(n),HN(n,0)]);if(i!==__||t().sessionId!==n)return;e({items:bQ(a),lastSeq:a.at(-1)?.sequence??0,loading:!1,isStreaming:s.activeTurn!==null,activeTurnId:s.activeTurn?.id??null,turnStartedAt:s.activeTurn?.createdAt??null,contextTokens:wQ(a),contextNotice:SQ(a),modelUsage:L3(a)});const l=qt.getQueryData(["session"]);for(const u of a)u.type==="tool.completed"&&typeof u.payload=="object"&&u.payload!==null&&M3(u.payload,l?.clientSessionId);U3(n)}catch(s){if(i!==__)return;const a=s instanceof Error?s.message:"加载会话失败";e({loading:!1,items:[od(a)]})}},disconnect:()=>{nx()},syncEvents:async()=>{const n=t().sessionId;if(!(!n||Bc||b_)){b_=!0;try{const i=await HN(n,t().lastSeq);if(t().sessionId!==n)return;for(const s of i)F3(s)}catch(i){const s=i instanceof Error?i.message:"事件补拉失败";e(a=>({items:[...a.items,od(`事件补拉失败:${s}`)]}))}finally{b_=!1}}},send:async n=>{const i=n.trim();if(!i||t().isStreaming)return;const s=t().sessionId;if(!s)return;const a=er.getState(),l=at.getState().draftSession;if(l!==null&&l.id===s){e({isStreaming:!0,turnStartedAt:Date.now()});try{const f=await JY(l.projectId===null?{}:{projectId:l.projectId});await Yb(f.id,{model:a.modelId,thinking:a.thinking,credentialProfileId:a.credentialProfileId,approvalPolicyId:a.policy}),await UN(f.id,{input:i,model:a.modelId,thinking:a.thinking,...a.credentialProfileId===null?{}:{credentialProfileId:a.credentialProfileId}},crypto.randomUUID()),await qt.invalidateQueries({queryKey:["workspace"]}),at.getState().commitDraft(f.id,f.projectId)}catch(f){const h=f instanceof Error?f.message:"发送失败";e(g=>({isStreaming:!1,turnStartedAt:null,items:[...g.items,od(`发送失败:${h}`)]}))}return}const u={id:`optimistic_user_${Date.now()}`,kind:"message",role:"user",text:i,createdAt:Date.now()};e(f=>({items:[...f.items,u],isStreaming:!0,turnStartedAt:Date.now()}));try{await Yb(s,{model:a.modelId,thinking:a.thinking,credentialProfileId:a.credentialProfileId,approvalPolicyId:a.policy});const f=await UN(s,{input:i,model:a.modelId,thinking:a.thinking,...a.credentialProfileId===null?{}:{credentialProfileId:a.credentialProfileId}},crypto.randomUUID());e({activeTurnId:f.turnId}),await qt.invalidateQueries({queryKey:["workspace"]}),await t().syncEvents()}catch(f){const h=f instanceof Error?f.message:"发送失败";e(g=>({isStreaming:!1,turnStartedAt:null,items:[...g.items.filter(m=>m.id!==u.id),od(`发送失败:${h}`)]})),await t().syncEvents()}},stop:()=>{const n=t().activeTurnId;n!==null&&eX(n).catch(i=>{const s=i instanceof Error?i.message:"停止失败";Dt.setState(a=>({items:[...a.items,od(`停止失败:${s}`)]}))})},resolveApproval:async(n,i)=>{const s=i==="approve"?"approved":"rejected",a=f=>e(h=>({items:h.items.map(g=>g.kind==="approval"&&g.id===n?{...g,status:f}:g)}));if(t().items.find(f=>f.kind==="approval"&&f.id===n)?.status!=="pending")return;const u=t().sessionId;await nX(n,i),t().sessionId===u&&(a(s),await t().syncEvents())}})),EQ=5;function fR({mobile:e=!1}){const{data:t}=qr(),{projectId:n,sessionId:i,draftSession:s,sidebarWidth:a,expandedProjects:l,toggleProject:u,selectSession:f,startDraft:h}=at(),g=L1(re=>re.extra),m=Dt(re=>null),_=O3(),b=LX(),x=zn(),S=at(re=>re.focusComposer),[C,k]=w.useState(""),[R,N]=w.useState({}),[A,I]=w.useState(!1),[T,D]=w.useState(!1),[L,ee]=w.useState(!1),[U,F]=w.useState(!1),[B,W]=w.useState(0),te=Pt({queryKey:T3,queryFn:FX,enabled:!Bc,refetchInterval:15e3}),G=Math.max(0,(te.data?.failedLast24h??0)-B);w.useEffect(()=>{U&&te.data&&W(te.data.failedLast24h)},[U,te.data]);const[P,Z]=w.useState(null),[$,ae]=w.useState(null);w.useEffect(()=>{if(P===null)return;const re=()=>Z(null),he=J=>{J.key==="Escape"&&Z(null)};return window.addEventListener("pointerdown",re),window.addEventListener("keydown",he),window.addEventListener("blur",re),()=>{window.removeEventListener("pointerdown",re),window.removeEventListener("keydown",he),window.removeEventListener("blur",re)}},[P]);const j=(re,he,J,Ie)=>{if(re.preventDefault(),re.stopPropagation(),he==="project"&&J===Gb){Z(null);return}Z({kind:he,id:J,title:Ie,x:re.clientX,y:re.clientY})},_e=w.useMemo(()=>[...t.sessions].sort((re,he)=>he.updatedAt-re.updatedAt),[g,t.sessions]),Le=re=>{h(re===Gb?null:re),S()},z=_e.find(re=>re.id===i),M=n===null&&(!z||z.workspaceKind==="default"),K=C.trim().toLowerCase(),ne=re=>re.status!=="idle"||re.id===m,me=re=>re.id===i?2:ne(re)?1:0,ve=t.projects.map(re=>{const he=re.name.toLowerCase().includes(K);return{...re,matchesName:he,sessions:_e.filter(J=>(re.kind==="default"?J.workspaceKind==="default":J.projectId===re.id)&&(he||J.title.toLowerCase().includes(K)))}}).filter(re=>re.matchesName||re.sessions.length>0),Re=_e.filter(re=>!K||re.title.toLowerCase().includes(K)||re.projectId&&t.projects.find(he=>he.id===re.projectId)?.name.toLowerCase().includes(K)).slice(0,6);return p.jsxs("aside",{className:qe("shrink-0 flex-col bg-surface/45",e?"flex h-full bg-surface":"hidden md:flex"),style:{width:e?268:a},"aria-label":"项目与会话导航",children:[p.jsx("div",{className:"px-2.5 pt-3",children:p.jsxs("button",{type:"button",onClick:_,className:"group flex h-8 w-full items-center gap-2 rounded-[9px] border border-line bg-surface px-2.5 text-[12px] font-medium text-ink shadow-[var(--shadow-card)] transition-colors hover:border-accent/30 hover:bg-accent-soft",children:[p.jsx($r,{size:14,className:"text-accent"}),p.jsx("span",{children:"新建会话"}),p.jsx(lU,{className:"ml-auto group-hover:border-accent/20",children:"⌘K"})]})}),p.jsx("div",{className:"px-2.5 pt-2.5",children:p.jsxs("label",{className:"flex h-7 items-center gap-1.5 rounded-lg bg-black/[.035] px-2 text-ink-3 transition-colors focus-within:bg-surface focus-within:ring-1 focus-within:ring-accent/30 dark:bg-white/[.05]",children:[p.jsx(M$,{size:12.5}),p.jsx("input",{value:C,onChange:re=>k(re.target.value),placeholder:"搜索项目或会话",className:"h-full w-full bg-transparent text-[11.5px] text-ink outline-none placeholder:text-ink-3","aria-label":"搜索项目或会话"})]})}),p.jsxs("div",{className:"mt-3 flex min-h-0 flex-1 flex-col overflow-y-auto px-1.5 pb-2",children:[p.jsxs("div",{className:"flex items-center px-2 pb-1 text-[10px] font-semibold uppercase tracking-[.08em] text-ink-3",children:["项目",p.jsx("button",{type:"button",onClick:()=>I(!0),"aria-label":"添加项目",className:"ml-auto flex h-5 w-5 items-center justify-center rounded-md text-ink-3 hover:bg-black/[.05] hover:text-ink dark:hover:bg-white/[.07]",children:p.jsx(Jj,{size:12})})]}),ve.map(re=>{const he=l[re.id]??!0,J=re.kind==="default",Ie=J?null:re.id,Ze=!K&&s?.projectId===Ie,Ut=EQ-Number(Ze),Et=!K&&re.sessions.length>Ut,tt=R[re.id]??!1;let Lt=re.sessions;if(Et&&!tt){const xt=new Set([...Lt].sort((Bt,Tr)=>me(Tr)-me(Bt)).slice(0,Ut));Lt=Lt.filter(Bt=>xt.has(Bt))}return p.jsxs("div",{"data-project-id":re.id,className:"mb-0.5",children:[p.jsxs("div",{className:"flex items-center gap-0.5",children:[p.jsxs("button",{type:"button","aria-label":J?"默认工作区":void 0,"aria-pressed":J?M:void 0,onClick:()=>{J&&!M?(h(null),S()):u(re.id)},onContextMenu:xt=>j(xt,"project",re.id,re.name),"aria-expanded":he,className:"flex h-[27px] min-w-0 flex-1 items-center gap-1.5 rounded-md px-1.5 text-left text-[11.5px] text-ink-2 hover:bg-black/[.035] hover:text-ink dark:hover:bg-white/[.05]",children:[he?p.jsx(Fm,{size:11,className:"text-ink-3"}):p.jsx(Hr,{size:11,className:"text-ink-3"}),p.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded-[4px]",style:{backgroundColor:`${re.accent}18`,color:re.accent},children:p.jsx(Um,{size:10})}),p.jsx("span",{className:"min-w-0 flex-1 truncate font-medium",children:re.name}),J?p.jsx("span",{className:"text-[9px] text-ink-3",children:"内置"}):re.git?p.jsx("span",{className:"font-mono text-[9px] text-ink-3",children:re.branch??"git"}):p.jsx("span",{className:"text-[9px] text-ink-3",children:"no git"})]}),p.jsx("button",{type:"button","aria-label":`在 ${re.name} 中新建会话`,onClick:()=>Le(re.id),className:"flex h-5 w-5 shrink-0 items-center justify-center rounded text-ink-3 hover:bg-black/[.06] hover:text-ink dark:hover:bg-white/[.08]",children:p.jsx($r,{size:11})})]}),he?p.jsxs("div",{className:"ml-[13px] border-l border-line/70 pl-1",children:[Ze?p.jsx(pR,{title:"新会话",draft:!0,active:s?.id===i,running:!1,onClick:()=>h(Ie)}):null,Lt.length?Lt.map(xt=>p.jsx(pR,{title:xt.title,active:xt.id===i,running:ne(xt),onClick:()=>f(xt.id,Ie),onContextMenu:Bt=>j(Bt,"session",xt.id,xt.title)},xt.id)):Ze?null:p.jsx("div",{className:"px-2 py-1 text-[10.5px] text-ink-3",children:"暂无会话"}),Et?p.jsx("button",{type:"button","aria-expanded":tt,onClick:()=>N(xt=>({...xt,[re.id]:!tt})),className:"flex h-6 w-full items-center rounded-md pl-5 pr-2 text-left text-[10.5px] text-ink-3 hover:bg-black/[.035] hover:text-ink dark:hover:bg-white/[.05]",children:tt?"收起":"展开更多"}):null]}):null]},re.id)}),ve.length===0?p.jsx("div",{className:"mx-1 rounded-lg border border-dashed border-line px-2.5 py-3 text-[10.5px] text-ink-3",children:K?"没有匹配的项目或会话":"还没有登记项目。点击项目标题旁的 + 添加本机目录。"}):null,p.jsxs("div",{className:"mt-3 flex items-center px-2 pb-1 text-[10px] font-semibold uppercase tracking-[.08em] text-ink-3",children:["最近",p.jsx("span",{className:"ml-auto font-normal normal-case tracking-normal text-ink-3/70",children:Re.length})]}),Re.map(re=>{const he=t.projects.find(J=>J.id===re.projectId);return p.jsxs("button",{type:"button",onClick:()=>f(re.id,re.projectId),onContextMenu:J=>j(J,"session",re.id,re.title),className:qe("group flex w-full flex-col gap-0.5 rounded-lg px-2 py-1.5 text-left transition-colors",re.id===i?"bg-accent-soft/70 text-ink":"text-ink-2 hover:bg-black/[.035] dark:hover:bg-white/[.05]"),children:[p.jsxs("span",{className:"flex items-center gap-1.5",children:[ne(re)?p.jsx(H3,{}):p.jsx(v$,{size:11,className:"shrink-0 text-ink-3"}),p.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] font-medium",children:re.title})]}),p.jsxs("span",{className:"flex items-center gap-1.5 pl-[17px] text-[9.5px] text-ink-3",children:[p.jsx("span",{className:"truncate",children:he?.name??(re.workspaceKind==="default"?"默认工作区":"独立会话")}),p.jsx("span",{children:"·"}),p.jsx("span",{className:"shrink-0",children:rl(re.updatedAt)})]})]},`recent_${re.id}`)})]}),p.jsxs("div",{className:"shrink-0 border-t border-line px-2 py-2",children:[p.jsx(x_,{icon:d$,label:"服务运维",onClick:()=>ee(!0)}),p.jsx(x_,{icon:H$,label:"自动化任务",badge:G,onClick:()=>F(!0)}),p.jsx(x_,{icon:I$,label:"设置与模型",onClick:()=>D(!0)}),p.jsxs("div",{className:"mt-1 flex items-center gap-2 rounded-lg px-2 py-1.5 hover:bg-black/[.035] dark:hover:bg-white/[.05]",children:[p.jsxs("div",{className:"relative flex h-6 w-6 items-center justify-center rounded-full bg-gradient-to-br from-[#ffd60a] to-[#ff9f0a] text-[10px] font-semibold text-[#1d1d1f]",children:["B",p.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 h-1.5 w-1.5 rounded-full bg-success ring-2 ring-surface"})]}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"truncate text-[11.5px] font-medium text-ink",children:"bulv"}),p.jsx("div",{className:"truncate text-[9.5px] text-ink-3",children:"本机操作者"})]}),p.jsx("button",{type:"button","aria-label":"退出登录",title:"退出登录","data-testid":"logout-button",onClick:()=>{b()},className:"flex h-6 w-6 items-center justify-center rounded-md text-ink-3 hover:bg-black/[.06] hover:text-danger dark:hover:bg-white/[.08]",children:p.jsx(E$,{size:13})})]})]}),P?p.jsxs("div",{role:"menu","aria-label":"会话或项目操作",onPointerDown:re=>re.stopPropagation(),className:"fixed z-[220] w-[184px] rounded-xl border border-line bg-surface p-1 shadow-[var(--shadow-pop)]",style:{left:Math.min(P.x,window.innerWidth-196),top:Math.min(P.y,window.innerHeight-112)},children:[p.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ae({kind:P.kind==="project"?"rename-project":"rename-session",id:P.id,title:P.title}),Z(null)},className:"flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-[11.5px] text-ink-2 hover:bg-black/[.045] hover:text-ink dark:hover:bg-white/[.07]",children:[p.jsx(A$,{size:13,className:"text-ink-3"}),P.kind==="project"?"重命名项目":"重命名会话"]}),p.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ae({kind:P.kind==="project"?"remove-project":"archive-session",id:P.id,title:P.title}),Z(null)},className:"flex h-8 w-full items-center gap-2 rounded-lg px-2.5 text-left text-[11.5px] text-danger hover:bg-danger/10",children:[P.kind==="project"?p.jsx($m,{size:13}):p.jsx(h$,{size:13}),P.kind==="project"?"移除项目":"归档会话"]})]}):null,p.jsx(R3,{session:$?.kind==="rename-session"?{id:$.id,title:$.title}:null,open:$?.kind==="rename-session",onClose:()=>ae(null)}),p.jsx(rQ,{project:$?.kind==="rename-project"?{id:$.id,name:$.title}:null,open:$?.kind==="rename-project",onClose:()=>ae(null)}),p.jsx(mR,{open:$?.kind==="archive-session",title:"归档会话",description:`“${$?.title??""}”将从列表中隐藏,工作目录与源码不会被删除。`,confirmLabel:"归档",onCancel:()=>ae(null),onConfirm:async()=>{$?.kind==="archive-session"&&(await _3($.id),await x.invalidateQueries({queryKey:["workspace"]}),$.id===i&&f("",null),ae(null))}}),p.jsx(mR,{open:$?.kind==="remove-project",title:"移除项目",description:`仅移除“${$?.title??""}”的登记,不会删除本地源码;项目内会话会变成独立会话。`,confirmLabel:"移除项目",onCancel:()=>ae(null),onConfirm:async()=>{$?.kind==="remove-project"&&(await HY($.id),await x.invalidateQueries({queryKey:["workspace"]}),$.id===n&&f("",null),ae(null))}}),p.jsx(iQ,{open:A,onOpenChange:I}),p.jsx(fQ,{open:L,onOpenChange:ee}),p.jsx(XX,{open:U,onOpenChange:F}),p.jsx(nQ,{open:T,onOpenChange:D})]})}function pR({title:e,active:t,running:n,draft:i=!1,onClick:s,onContextMenu:a}){return p.jsxs("button",{type:"button",onClick:s,onContextMenu:a,"aria-current":t?"true":void 0,"aria-busy":n,className:qe("flex h-[26px] w-full items-center gap-1.5 rounded-md px-2 text-left text-[11px] transition-colors",t?"bg-accent-soft font-medium text-ink":"text-ink-2 hover:bg-black/[.035] hover:text-ink dark:hover:bg-white/[.05]"),children:[p.jsx("span",{className:"flex w-3 shrink-0 items-center justify-center","aria-hidden":"true",children:n?p.jsx(H3,{}):p.jsx(Qb,{tone:t?"info":"idle"})}),p.jsx("span",{className:"min-w-0 flex-1 truncate",children:e}),i?p.jsx("span",{className:"shrink-0 rounded bg-black/[.045] px-1 py-[1px] text-[8.5px] text-ink-3 dark:bg-white/[.07]",children:"草稿"}):null]})}function H3(){return p.jsx(Ss,{size:11,className:"shrink-0 animate-spin text-accent motion-reduce:animate-none","aria-hidden":"true"})}function x_({icon:e,label:t,badge:n,onClick:i}){return p.jsxs("button",{type:"button",onClick:i,disabled:i===void 0,className:"flex h-7 w-full items-center gap-2 rounded-lg px-2 text-[11.5px] text-ink-2 transition-colors hover:bg-black/[.035] hover:text-ink disabled:cursor-default disabled:opacity-60 dark:hover:bg-white/[.05]",children:[p.jsx(e,{size:13.5,strokeWidth:1.75,className:"text-ink-3"}),p.jsx("span",{className:"flex-1 text-left",children:t}),n!==void 0&&n>0?p.jsx("span",{title:`${n} 个失败任务`,className:"rounded-full bg-danger px-1.5 text-[9px] font-semibold leading-4 text-white",children:n>99?"99+":n}):null]})}function mR({open:e,title:t,description:n,confirmLabel:i,onCancel:s,onConfirm:a}){const[l,u]=w.useState(!1),[f,h]=w.useState(null);w.useEffect(()=>{e&&(u(!1),h(null))},[e]);const g=async()=>{u(!0),h(null);try{await a()}catch(m){h(m instanceof Error?m.message:"操作失败"),u(!1)}};return p.jsx(xi,{open:e,onOpenChange:m=>m?void 0:s(),children:p.jsxs(ui,{children:[p.jsx(Si,{children:t}),p.jsx(wi,{children:n}),f?p.jsx("p",{role:"alert",className:"mt-3 rounded-lg bg-danger/10 px-2.5 py-2 text-[11px] text-danger",children:f}):null,p.jsxs("div",{className:"mt-5 flex justify-end gap-2",children:[p.jsx(Se,{variant:"secondary",size:"sm",onClick:s,disabled:l,children:"取消"}),p.jsx(Se,{variant:"danger",size:"sm",disabled:l,onClick:()=>{g()},children:l?"处理中…":i})]})]})})}const gR=(e,t,n)=>Math.min(n,Math.max(t,e));function vR({side:e,label:t,value:n,min:i,max:s,defaultValue:a,onChange:l,className:u}){const f=g=>{g.preventDefault();const m=g.clientX,_=n,b=document.body.style.cursor,x=document.body.style.userSelect;document.body.style.cursor="col-resize",document.body.style.userSelect="none";const S=k=>{const R=e==="left"?k.clientX-m:m-k.clientX;l(gR(_+R,i,s))},C=()=>{document.body.style.cursor=b,document.body.style.userSelect=x,window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",C)};window.addEventListener("pointermove",S),window.addEventListener("pointerup",C)},h=g=>{if(g.key!=="ArrowLeft"&&g.key!=="ArrowRight")return;g.preventDefault();const m=g.shiftKey?64:16,_=g.key==="ArrowRight"?m:-m,b=e==="left"?_:-_;l(gR(n+b,i,s))};return p.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":t,"aria-valuenow":Math.round(n),"aria-valuemin":i,"aria-valuemax":s,tabIndex:0,onPointerDown:f,onDoubleClick:()=>l(a),onKeyDown:h,className:`relative z-30 w-px shrink-0 cursor-col-resize bg-line transition-colors hover:bg-accent/45 focus-visible:bg-accent/60 focus-visible:outline-none ${u??""}`,children:p.jsx("span",{"aria-hidden":!0,className:"absolute inset-y-0 -left-2 -right-2"})})}const $3="larness.theme",q3=w.createContext(null);function NQ(e,t){return e==="system"?t?"dark":"light":e}function RQ(){try{const e=localStorage.getItem($3);if(e==="light"||e==="dark"||e==="system")return e}catch{}return"light"}function TQ({children:e}){const[t,n]=w.useState(RQ),[i,s]=w.useState(!1);w.useEffect(()=>{const f=window.matchMedia("(prefers-color-scheme: dark)");s(f.matches);const h=g=>s(g.matches);return f.addEventListener("change",h),()=>f.removeEventListener("change",h)},[]);const a=NQ(t,i);w.useEffect(()=>{document.documentElement.dataset.theme=a,document.documentElement.style.colorScheme=a;try{localStorage.setItem($3,t)}catch{}},[a,t]);const l=w.useCallback(f=>n(f),[]),u=w.useMemo(()=>({theme:t,resolved:a,setTheme:l}),[t,a,l]);return p.jsx(q3.Provider,{value:u,children:e})}function DQ(){const e=w.useContext(q3);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}function AQ(e){const[t,n]=w.useState(e);return w.useEffect(()=>{n(e)},[e]),w.useEffect(()=>{const i=window.setInterval(()=>{n(s=>({cpuPercent:Math.max(18,Math.min(72,s.cpuPercent+(Math.random()-.5)*4)),memoryUsedGb:Math.max(6,Math.min(s.memoryTotalGb-1,s.memoryUsedGb+(Math.random()-.5)*.12)),memoryTotalGb:s.memoryTotalGb}))},3600);return()=>window.clearInterval(i)},[]),t}function OQ(e){const[t,n]=w.useState(()=>typeof window>"u"?!1:window.matchMedia(e).matches);return w.useEffect(()=>{const i=window.matchMedia(e);n(i.matches);const s=a=>n(a.matches);return i.addEventListener("change",s),()=>i.removeEventListener("change",s)},[e]),t}function jQ(){const{data:e}=qr(),{theme:t,resolved:n,setTheme:i}=DQ(),{projectId:s,sessionId:a,toggleSidebar:l,setMobileSidebar:u}=at(),f=OQ("(max-width: 767px)"),h=Dt(b=>b.items.some(x=>x.kind==="approval"&&x.status==="pending")),g=Dt(b=>b.isStreaming);AQ(e.host);const m=e.projects.find(b=>b.id===s)??null,_=t==="system"?tN:n==="dark"?nN:rN;return p.jsxs("header",{className:"relative z-50 flex h-12 shrink-0 items-center gap-2 border-b border-line bg-surface/70 px-2.5 backdrop-blur-xl",children:[p.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[p.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-[7px] bg-gradient-to-br from-[#3d9bff] to-[#0066d6] text-[11px] font-bold text-white shadow-sm",children:"L"}),p.jsx("span",{className:"shrink-0 text-[12.5px] font-semibold tracking-[-.01em]",children:"Larness"}),p.jsx("span",{className:"shrink-0 rounded-full border border-line bg-surface-2 px-1.5 py-[1px] font-mono text-[9px] text-ink-3",children:"v0.1"})]}),p.jsx(bi,{label:f?"打开导航":"切换侧栏",onClick:()=>f?u(!0):l(),children:p.jsx(T$,{size:15})}),p.jsx("span",{className:"mx-0.5 h-3.5 w-px shrink-0 bg-line"}),p.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[p.jsx("span",{className:"truncate text-[12.5px] font-semibold tracking-[-.01em]",children:m?.name??I1(a,e.sessions)}),p.jsx("span",{className:"text-ink-3",children:"/"}),p.jsxs("span",{className:"flex items-center gap-1.5",children:[p.jsx(Qb,{tone:g?"running":"idle",pulse:g}),p.jsx("span",{className:"text-[11px] text-ink-2",children:g?"Agent 运行中":"空闲"})]}),m?.branch?p.jsxs("span",{className:"ml-1 hidden items-center gap-1 rounded-full border border-line bg-surface-2 px-2 py-[2px] font-mono text-[10px] text-ink-2 md:flex",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-accent/70"}),m.branch]}):null]}),p.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[null,p.jsxs(Oc,{children:[p.jsx(jc,{asChild:!0,children:p.jsx(bi,{label:"外观与主题",children:p.jsx(_,{size:15})})}),p.jsxs(cl,{align:"end",children:[p.jsx(Zp,{children:"外观"}),p.jsxs(TO,{value:t,onValueChange:b=>i(b),children:[p.jsxs(Nd,{value:"light",children:[p.jsx(rN,{size:13})," 浅色"]}),p.jsxs(Nd,{value:"dark",children:[p.jsx(nN,{size:13})," 深色"]}),p.jsxs(Nd,{value:"system",children:[p.jsx(tN,{size:13})," 跟随系统"]})]})]})]}),p.jsxs(Oc,{children:[p.jsx(jc,{asChild:!0,children:p.jsxs(bi,{label:"通知",className:"relative",children:[p.jsx(f$,{size:15}),h?p.jsx("span",{className:"absolute right-1.5 top-1.5 h-1.5 w-1.5 rounded-full bg-danger ring-2 ring-surface"}):null]})}),p.jsxs(cl,{align:"end",className:"w-[280px]",children:[p.jsx(Zp,{children:"通知"}),h?p.jsxs(na,{className:"items-start gap-2 py-2",children:[p.jsx(Qb,{tone:"waiting",className:"mt-1"}),p.jsxs("span",{children:[p.jsx("span",{className:"block text-[12px] font-medium text-ink",children:"部署待批准"}),p.jsx("span",{className:"mt-0.5 block text-[11px] text-ink-3",children:"web-prod 计划切换到 c0f3a2d,等待你的批准。"})]})]}):p.jsx(na,{disabled:!0,children:"暂无新通知"}),p.jsx(B0,{}),p.jsx(na,{disabled:!0,children:p.jsx("span",{className:"text-[11px] text-ink-3",children:"通知仅保留在当前设备"})})]})]})]})]})}var S_={exports:{}},w_,yR;function zQ(){if(yR)return w_;yR=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return w_=e,w_}var C_,_R;function MQ(){if(_R)return C_;_R=1;var e=zQ();function t(){}function n(){}return n.resetWarningCache=t,C_=function(){function i(l,u,f,h,g,m){if(m!==e){var _=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw _.name="Invariant Violation",_}}i.isRequired=i;function s(){return i}var a={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:s,element:i,elementType:i,instanceOf:s,node:i,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:n,resetWarningCache:t};return a.PropTypes=a,a},C_}var bR;function IQ(){return bR||(bR=1,S_.exports=MQ()()),S_.exports}var PQ=IQ();const Je=bm(PQ);var LQ={};function ix(e,t){for(let n=0,i=e.length;n<i;n++)if(t.apply(t,[e[n],n,e]))return e[n]}function xR(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Function]"}function xd(e){return typeof e=="number"&&!isNaN(e)}function li(e){return parseInt(e,10)}function Dc(e,t,n){if(e[t])return new Error(`Invalid prop ${t} passed to ${n} - do not set this, set it on the child.`)}var k_=["Moz","Webkit","O","ms"];function BQ(e="transform"){var t,n;if(typeof window>"u")return"";const i=(n=(t=window.document)==null?void 0:t.documentElement)==null?void 0:n.style;if(!i||e in i)return"";for(let s=0;s<k_.length;s++)if(W3(e,k_[s])in i)return k_[s];return""}function W3(e,t){return t?`${t}${FQ(e)}`:e}function FQ(e){let t="",n=!0;for(let i=0;i<e.length;i++)n?(t+=e[i].toUpperCase(),n=!1):e[i]==="-"?n=!0:t+=e[i];return t}var UQ=BQ(),E_="";function HQ(e,t){var n;E_||(E_=(n=ix(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(s){return xR(e[s])}))!=null?n:"");const i=e[E_];return xR(i)?!!i.call(e,t):!1}function SR(e,t,n){let i=e;do{if(HQ(i,t))return!0;if(i===n)return!1;i=i.parentNode}while(i);return!1}function N_(e,t,n,i){if(!e)return;const s={capture:!0,...i},a=n;e.addEventListener?e.addEventListener(t,a,s):e.attachEvent?e.attachEvent("on"+t,a):e["on"+t]=a}function Ka(e,t,n,i){if(!e)return;const s={capture:!0,...i},a=n;e.removeEventListener?e.removeEventListener(t,a,s):e.detachEvent?e.detachEvent("on"+t,a):e["on"+t]=null}function $Q(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=li(n.borderTopWidth),t+=li(n.borderBottomWidth),t}function qQ(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t+=li(n.borderLeftWidth),t+=li(n.borderRightWidth),t}function WQ(e){let t=e.clientHeight;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=li(n.paddingTop),t-=li(n.paddingBottom),t}function KQ(e){let t=e.clientWidth;const n=e.ownerDocument.defaultView.getComputedStyle(e);return t-=li(n.paddingLeft),t-=li(n.paddingRight),t}function VQ(e,t,n){const s=t===t.ownerDocument.body?{left:0,top:0}:t.getBoundingClientRect(),a=(e.clientX+t.scrollLeft-s.left)/n,l=(e.clientY+t.scrollTop-s.top)/n;return{x:a,y:l}}function GQ(e,t){const n=K3(e,t,"px");return{[W3("transform",UQ)]:n}}function ZQ(e,t){return K3(e,t,"")}function K3({x:e,y:t},n,i){let s=`translate(${e}${i},${t}${i})`;if(n){const a=`${typeof n.x=="string"?n.x:n.x+i}`,l=`${typeof n.y=="string"?n.y:n.y+i}`;s=`translate(${a}, ${l})`+s}return s}function YQ(e,t){return e.targetTouches&&ix(e.targetTouches,n=>t===n.identifier)||e.changedTouches&&ix(e.changedTouches,n=>t===n.identifier)}function XQ(e){if(e.targetTouches&&e.targetTouches[0])return e.targetTouches[0].identifier;if(e.changedTouches&&e.changedTouches[0])return e.changedTouches[0].identifier}function QQ(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0}function JQ(e,t){if(!e)return;let n=e.getElementById("react-draggable-style-el");if(!n){n=e.createElement("style"),n.type="text/css",n.id="react-draggable-style-el";const i=t??QQ();i&&n.setAttribute("nonce",i),n.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
109
- `,n.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
110
- `,e.getElementsByTagName("head")[0].appendChild(n)}e.body&&eJ(e.body,"react-draggable-transparent-selection")}function wR(e){window.requestAnimationFrame?window.requestAnimationFrame(()=>{CR(e)}):CR(e)}function CR(e){if(e)try{e.body&&tJ(e.body,"react-draggable-transparent-selection");const t=e.selection;if(t)t.empty();else{const n=(e.defaultView||window).getSelection();n&&n.type!=="Caret"&&n.removeAllRanges()}}catch{}}function eJ(e,t){e.classList?e.classList.add(t):e.className.match(new RegExp(`(?:^|\\s)${t}(?!\\S)`))||(e.className+=` ${t}`)}function tJ(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp(`(?:^|\\s)${t}(?!\\S)`,"g"),"")}function nJ(e,t,n){if(!e.props.bounds)return[t,n];let{bounds:i}=e.props;i=typeof i=="string"?i:sJ(i);const s=U1(e);if(typeof i=="string"){const{ownerDocument:a}=s,l=a.defaultView;if(!l)throw new Error("Cannot resolve the owner window of the draggable node.");let u;if(i==="parent"?u=s.parentNode:u=s.getRootNode().querySelector(i),!(u instanceof l.HTMLElement))throw new Error('Bounds selector "'+i+'" could not find an element.');const f=u,h=l.getComputedStyle(s),g=l.getComputedStyle(f);i={left:-s.offsetLeft+li(g.paddingLeft)+li(h.marginLeft),top:-s.offsetTop+li(g.paddingTop)+li(h.marginTop),right:KQ(f)-qQ(s)-s.offsetLeft+li(g.paddingRight)-li(h.marginRight),bottom:WQ(f)-$Q(s)-s.offsetTop+li(g.paddingBottom)-li(h.marginBottom)}}return xd(i.right)&&(t=Math.min(t,i.right)),xd(i.bottom)&&(n=Math.min(n,i.bottom)),xd(i.left)&&(t=Math.max(t,i.left)),xd(i.top)&&(n=Math.max(n,i.top)),[t,n]}function kR(e,t,n){const i=Math.round(t/e[0])*e[0],s=Math.round(n/e[1])*e[1];return[i,s]}function iJ(e){return e.props.axis==="both"||e.props.axis==="x"}function rJ(e){return e.props.axis==="both"||e.props.axis==="y"}function R_(e,t,n){const i=typeof t=="number"?YQ(e,t):null;if(typeof t=="number"&&!i)return null;const s=U1(n),a=n.props.offsetParent||s.offsetParent||s.ownerDocument.body;return VQ(i||e,a,n.props.scale)}function T_(e,t,n){const i=!xd(e.lastX),s=U1(e);return i?{node:s,deltaX:0,deltaY:0,lastX:t,lastY:n,x:t,y:n}:{node:s,deltaX:t-e.lastX,deltaY:n-e.lastY,lastX:e.lastX,lastY:e.lastY,x:t,y:n}}function D_(e,t){const n=e.props.scale;return{node:t.node,x:e.state.x+t.deltaX/n,y:e.state.y+t.deltaY/n,deltaX:t.deltaX/n,deltaY:t.deltaY/n,lastX:e.state.x,lastY:e.state.y}}function sJ(e){return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}}function U1(e){const t=e.findDOMNode();if(!t)throw new Error("<DraggableCore>: Unmounted during event!");return t}var oJ=typeof process<"u"&&LQ.DRAGGABLE_DEBUG?console.log.bind(console):function(){},hs=oJ,Pr={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}},Wo=Pr.mouse,nu=class extends w.Component{constructor(){super(...arguments),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,this.touchIdentifier=null,this.mounted=!1,this.handleDragStart=e=>{if(this.props.onMouseDown(e),!this.props.allowAnyClick&&(typeof e.button=="number"&&e.button!==0||e.ctrlKey))return!1;const t=this.findDOMNode();if(!t||!t.ownerDocument||!t.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:n}=t;if(this.props.disabled||!(e.target instanceof n.defaultView.Node)||this.props.handle&&!SR(e.target,this.props.handle,t)||this.props.cancel&&SR(e.target,this.props.cancel,t))return;e.type==="touchstart"&&!this.props.allowMobileScroll&&e.preventDefault();const i=XQ(e);this.touchIdentifier=i;const s=R_(e,i,this);if(s==null)return;const{x:a,y:l}=s,u=T_(this,a,l);hs("DraggableCore: handleDragStart: %j",u),hs("calling",this.props.onStart),!(this.props.onStart(e,u)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&JQ(n,this.props.nonce),this.dragging=!0,this.lastX=a,this.lastY=l,N_(n,Wo.move,this.handleDrag),N_(n,Wo.stop,this.handleDragStop))},this.handleDrag=e=>{const t=R_(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:i}=t;if(Array.isArray(this.props.grid)){let l=n-this.lastX,u=i-this.lastY;if([l,u]=kR(this.props.grid,l,u),!l&&!u)return;n=this.lastX+l,i=this.lastY+u}const s=T_(this,n,i);if(hs("DraggableCore: handleDrag: %j",s),this.props.onDrag(e,s)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const l=document.createEvent("MouseEvents");l.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(l)}return}this.lastX=n,this.lastY=i},this.handleDragStop=e=>{if(!this.dragging)return;const t=R_(e,this.touchIdentifier,this);if(t==null)return;let{x:n,y:i}=t;if(Array.isArray(this.props.grid)){let u=n-this.lastX||0,f=i-this.lastY||0;[u,f]=kR(this.props.grid,u,f),n=this.lastX+u,i=this.lastY+f}const s=T_(this,n,i);if(this.props.onStop(e,s)===!1||this.mounted===!1)return!1;const l=this.findDOMNode();l&&this.props.enableUserSelectHack&&wR(l.ownerDocument),hs("DraggableCore: handleDragStop: %j",s),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,l&&(hs("DraggableCore: Removing handlers"),Ka(l.ownerDocument,Wo.move,this.handleDrag),Ka(l.ownerDocument,Wo.stop,this.handleDragStop))},this.onMouseDown=e=>(Wo=Pr.mouse,this.handleDragStart(e)),this.onMouseUp=e=>(Wo=Pr.mouse,this.handleDragStop(e)),this.onTouchStart=e=>(Wo=Pr.touch,this.handleDragStart(e)),this.onTouchEnd=e=>(Wo=Pr.touch,this.handleDragStop(e))}componentDidMount(){this.mounted=!0;const e=this.findDOMNode();e&&N_(e,Pr.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const e=this.findDOMNode();if(e){const{ownerDocument:t}=e;Ka(t,Pr.mouse.move,this.handleDrag),Ka(t,Pr.touch.move,this.handleDrag),Ka(t,Pr.mouse.stop,this.handleDragStop),Ka(t,Pr.touch.stop,this.handleDragStop),Ka(e,Pr.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&wR(t)}}findDOMNode(){var e;if((e=this.props)!=null&&e.nodeRef)return this.props.nodeRef.current;const t=ZD;return typeof t.findDOMNode=="function"?t.findDOMNode(this):(hs("react-draggable: ReactDOM.findDOMNode is not available in React 19+. You must provide a nodeRef prop. See: https://github.com/react-grid-layout/react-draggable#noderef"),null)}render(){return w.cloneElement(w.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};nu.displayName="DraggableCore";nu.propTypes={allowAnyClick:Je.bool,allowMobileScroll:Je.bool,children:Je.node.isRequired,disabled:Je.bool,enableUserSelectHack:Je.bool,offsetParent:function(e,t){if(e[t]&&e[t].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:Je.arrayOf(Je.number),handle:Je.string,cancel:Je.string,nodeRef:Je.object,nonce:Je.string,onStart:Je.func,onDrag:Je.func,onStop:Je.func,onMouseDown:Je.func,scale:Je.number,className:Dc,style:Dc,transform:Dc};nu.defaultProps={allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1};var eg=class extends w.Component{constructor(e){super(e),this.onDragStart=(t,n)=>{if(hs("Draggable: onDragStart: %j",n),this.props.onStart(t,D_(this,n))===!1)return!1;this.setState({dragging:!0,dragged:!0})},this.onDrag=(t,n)=>{if(!this.state.dragging)return!1;hs("Draggable: onDrag: %j",n);const i=D_(this,n),s={x:i.x,y:i.y,slackX:0,slackY:0};if(this.props.bounds){const{x:l,y:u}=s;s.x+=this.state.slackX,s.y+=this.state.slackY;const[f,h]=nJ(this,s.x,s.y);s.x=f,s.y=h,s.slackX=this.state.slackX+(l-s.x),s.slackY=this.state.slackY+(u-s.y),i.x=s.x,i.y=s.y,i.deltaX=s.x-this.state.x,i.deltaY=s.y-this.state.y}if(this.props.onDrag(t,i)===!1)return!1;this.setState(s)},this.onDragStop=(t,n)=>{if(!this.state.dragging||this.props.onStop(t,D_(this,n))===!1)return!1;hs("Draggable: onDragStop: %j",n);const s={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:l,y:u}=this.props.position;s.x=l,s.y=u}this.setState(s)},this.state={dragging:!1,dragged:!1,x:e.position?e.position.x:e.defaultPosition.x,y:e.position?e.position.y:e.defaultPosition.y,prevPropsPosition:{...e.position},slackX:0,slackY:0,isElementSVG:!1},e.position&&!(e.onDrag||e.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}static getDerivedStateFromProps({position:e},{prevPropsPosition:t}){return e&&(!t||e.x!==t.x||e.y!==t.y)?(hs("Draggable: getDerivedStateFromProps %j",{position:e,prevPropsPosition:t}),{x:e.x,y:e.y,prevPropsPosition:{...e}}):null}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){var e;if((e=this.props)!=null&&e.nodeRef)return this.props.nodeRef.current;const t=ZD;return typeof t.findDOMNode=="function"?t.findDOMNode(this):null}render(){const{axis:e,bounds:t,children:n,defaultPosition:i,defaultClassName:s,defaultClassNameDragging:a,defaultClassNameDragged:l,position:u,positionOffset:f,scale:h,...g}=this.props;let m={},_=null;const x=!!!u||this.state.dragging,S=u||i,C={x:iJ(this)&&x?this.state.x:S.x,y:rJ(this)&&x?this.state.y:S.y};this.state.isElementSVG?_=ZQ(C,f):m=GQ(C,f);const k=w.Children.only(n),R=kD(k.props.className||"",s,{[a]:this.state.dragging,[l]:this.state.dragged});return w.createElement(nu,{...g,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop},w.cloneElement(k,{className:R,style:{...k.props.style,...m},transform:_}))}};eg.displayName="Draggable";eg.propTypes={...nu.propTypes,axis:Je.oneOf(["both","x","y","none"]),bounds:Je.oneOfType([Je.shape({left:Je.number,right:Je.number,top:Je.number,bottom:Je.number}),Je.string,Je.oneOf([!1])]),defaultClassName:Je.string,defaultClassNameDragging:Je.string,defaultClassNameDragged:Je.string,defaultPosition:Je.shape({x:Je.number,y:Je.number}),positionOffset:Je.shape({x:Je.oneOfType([Je.number,Je.string]),y:Je.oneOfType([Je.number,Je.string])}),position:Je.shape({x:Je.number,y:Je.number}),className:Dc,style:Dc,transform:Dc};eg.defaultProps={...nu.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1};var aJ=eg,vn=function(){return vn=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},vn.apply(this,arguments)},ER={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},NR={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},ip={width:"20px",height:"20px",position:"absolute",zIndex:1},lJ={top:vn(vn({},ER),{top:"-5px"}),right:vn(vn({},NR),{left:void 0,right:"-5px"}),bottom:vn(vn({},ER),{top:void 0,bottom:"-5px"}),left:vn(vn({},NR),{left:"-5px"}),topRight:vn(vn({},ip),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:vn(vn({},ip),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:vn(vn({},ip),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:vn(vn({},ip),{left:"-10px",top:"-10px",cursor:"nw-resize"})},cJ=w.memo(function(e){var t=e.onResizeStart,n=e.direction,i=e.children,s=e.replaceStyles,a=e.className,l=w.useCallback(function(h){t(h,n)},[t,n]),u=w.useCallback(function(h){t(h,n)},[t,n]),f=w.useMemo(function(){return vn(vn({position:"absolute",userSelect:"none"},lJ[n]),s??{})},[s,n]);return p.jsx("div",{className:a||void 0,style:f,onMouseDown:l,onTouchStart:u,children:i})}),uJ=(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,s){i.__proto__=s}||function(i,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(i[a]=s[a])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}})(),cs=function(){return cs=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},cs.apply(this,arguments)},dJ={width:"auto",height:"auto"},rp=function(e,t,n){return Math.max(Math.min(e,n),t)},RR=function(e,t,n){var i=Math.round(e/t);return i*t+n*(i-1)},vc=function(e,t){return new RegExp(e,"i").test(t)},sp=function(e){return!!(e.touches&&e.touches.length)},hJ=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},TR=function(e,t,n){n===void 0&&(n=0);var i=t.reduce(function(a,l,u){return Math.abs(l-e)<Math.abs(t[a]-e)?u:a},0),s=Math.abs(t[i]-e);return n===0||s<n?t[i]:e},A_=function(e){return e=e.toString(),e==="auto"||e.endsWith("px")||e.endsWith("%")||e.endsWith("vh")||e.endsWith("vw")||e.endsWith("vmax")||e.endsWith("vmin")?e:"".concat(e,"px")},op=function(e,t,n,i){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var s=Number(e.replace("%",""))/100;return t*s}if(e.endsWith("vw")){var s=Number(e.replace("vw",""))/100;return n*s}if(e.endsWith("vh")){var s=Number(e.replace("vh",""))/100;return i*s}}return e},fJ=function(e,t,n,i,s,a,l){return i=op(i,e.width,t,n),s=op(s,e.height,t,n),a=op(a,e.width,t,n),l=op(l,e.height,t,n),{maxWidth:typeof i>"u"?void 0:Number(i),maxHeight:typeof s>"u"?void 0:Number(s),minWidth:typeof a>"u"?void 0:Number(a),minHeight:typeof l>"u"?void 0:Number(l)}},pJ=function(e){return Array.isArray(e)?e:[e,e]},mJ=["as","ref","style","className","grid","gridGap","snap","bounds","boundsByDirection","size","defaultSize","minWidth","minHeight","maxWidth","maxHeight","lockAspectRatio","lockAspectRatioExtraWidth","lockAspectRatioExtraHeight","enable","handleStyles","handleClasses","handleWrapperStyle","handleWrapperClass","children","onResizeStart","onResize","onResizeStop","handleComponent","scale","resizeRatio","snapGap"],DR="__resizable_base__",gJ=(function(e){uJ(t,e);function t(n){var i,s,a,l,u=e.call(this,n)||this;return u.ratio=1,u.resizable=null,u.parentLeft=0,u.parentTop=0,u.resizableLeft=0,u.resizableRight=0,u.resizableTop=0,u.resizableBottom=0,u.targetLeft=0,u.targetTop=0,u.delta={width:0,height:0},u.appendBase=function(){if(!u.resizable||!u.window)return null;var f=u.parentNode;if(!f)return null;var h=u.window.document.createElement("div");return h.style.width="100%",h.style.height="100%",h.style.position="absolute",h.style.transform="scale(0, 0)",h.style.left="0",h.style.flex="0 0 100%",h.classList?h.classList.add(DR):h.className+=DR,f.appendChild(h),h},u.removeBase=function(f){var h=u.parentNode;h&&h.removeChild(f)},u.state={isResizing:!1,width:(s=(i=u.propsSize)===null||i===void 0?void 0:i.width)!==null&&s!==void 0?s:"auto",height:(l=(a=u.propsSize)===null||a===void 0?void 0:a.height)!==null&&l!==void 0?l:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},u.onResizeStart=u.onResizeStart.bind(u),u.onMouseMove=u.onMouseMove.bind(u),u.onMouseUp=u.onMouseUp.bind(u),u}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||dJ},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,i=0;if(this.resizable&&this.window){var s=this.resizable.offsetWidth,a=this.resizable.offsetHeight,l=this.resizable.style.position;l!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:s,i=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:a,this.resizable.style.position=l}return{width:n,height:i}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,i=this.props.size,s=function(u){var f;if(typeof n.state[u]>"u"||n.state[u]==="auto")return"auto";if(n.propsSize&&n.propsSize[u]&&(!((f=n.propsSize[u])===null||f===void 0)&&f.toString().endsWith("%"))){if(n.state[u].toString().endsWith("%"))return n.state[u].toString();var h=n.getParentSize(),g=Number(n.state[u].toString().replace("px","")),m=g/h[u]*100;return"".concat(m,"%")}return A_(n.state[u])},a=i&&typeof i.width<"u"&&!this.state.isResizing?A_(i.width):s("width"),l=i&&typeof i.height<"u"&&!this.state.isResizing?A_(i.height):s("height");return{width:a,height:l}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var i=!1,s=this.parentNode.style.flexWrap;s!=="wrap"&&(i=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var a={width:n.offsetWidth,height:n.offsetHeight};return i&&(this.parentNode.style.flexWrap=s),this.removeBase(n),a},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,i){var s=this.propsSize&&this.propsSize[i];return this.state[i]==="auto"&&this.state.original[i]===n&&(typeof s>"u"||s==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,i){var s=this.props.boundsByDirection,a=this.state.direction,l=s&&vc("left",a),u=s&&vc("top",a),f,h;if(this.props.bounds==="parent"){var g=this.parentNode;g&&(f=l?this.resizableRight-this.parentLeft:g.offsetWidth+(this.parentLeft-this.resizableLeft),h=u?this.resizableBottom-this.parentTop:g.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(f=l?this.resizableRight:this.window.innerWidth-this.resizableLeft,h=u?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(f=l?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),h=u?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return f&&Number.isFinite(f)&&(n=n&&n<f?n:f),h&&Number.isFinite(h)&&(i=i&&i<h?i:h),{maxWidth:n,maxHeight:i}},t.prototype.calculateNewSizeFromDirection=function(n,i){var s=this.props.scale||1,a=pJ(this.props.resizeRatio||1),l=a[0],u=a[1],f=this.state,h=f.direction,g=f.original,m=this.props,_=m.lockAspectRatio,b=m.lockAspectRatioExtraHeight,x=m.lockAspectRatioExtraWidth,S=g.width,C=g.height,k=b||0,R=x||0;return vc("right",h)&&(S=g.width+(n-g.x)*l/s,_&&(C=(S-R)/this.ratio+k)),vc("left",h)&&(S=g.width-(n-g.x)*l/s,_&&(C=(S-R)/this.ratio+k)),vc("bottom",h)&&(C=g.height+(i-g.y)*u/s,_&&(S=(C-k)*this.ratio+R)),vc("top",h)&&(C=g.height-(i-g.y)*u/s,_&&(S=(C-k)*this.ratio+R)),{newWidth:S,newHeight:C}},t.prototype.calculateNewSizeFromAspectRatio=function(n,i,s,a){var l=this.props,u=l.lockAspectRatio,f=l.lockAspectRatioExtraHeight,h=l.lockAspectRatioExtraWidth,g=typeof a.width>"u"?10:a.width,m=typeof s.width>"u"||s.width<0?n:s.width,_=typeof a.height>"u"?10:a.height,b=typeof s.height>"u"||s.height<0?i:s.height,x=f||0,S=h||0;if(u){var C=(_-x)*this.ratio+S,k=(b-x)*this.ratio+S,R=(g-S)/this.ratio+x,N=(m-S)/this.ratio+x,A=Math.max(g,C),I=Math.min(m,k),T=Math.max(_,R),D=Math.min(b,N);n=rp(n,A,I),i=rp(i,T,D)}else n=rp(n,g,m),i=rp(i,_,b);return{newWidth:n,newHeight:i}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var i=this.parentNode;if(i){var s=i.getBoundingClientRect();this.parentLeft=s.left*n,this.parentTop=s.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var a=this.props.bounds.getBoundingClientRect();this.targetLeft=a.left*n,this.targetTop=a.top*n}if(this.resizable){var l=this.resizable.getBoundingClientRect(),u=l.left,f=l.top,h=l.right,g=l.bottom;this.resizableLeft=u*n,this.resizableRight=h*n,this.resizableTop=f*n,this.resizableBottom=g*n}},t.prototype.onResizeStart=function(n,i){if(!(!this.resizable||!this.window)){var s=0,a=0;if(n.nativeEvent&&hJ(n.nativeEvent)?(s=n.nativeEvent.clientX,a=n.nativeEvent.clientY):n.nativeEvent&&sp(n.nativeEvent)&&(s=n.nativeEvent.touches[0].clientX,a=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var l=this.props.onResizeStart(n,i,this.resizable);if(l===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var u,f=this.window.getComputedStyle(this.resizable);if(f.flexBasis!=="auto"){var h=this.parentNode;if(h){var g=this.window.getComputedStyle(h).flexDirection;this.flexDir=g.startsWith("row")?"row":"column",u=f.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var m={original:{x:s,y:a,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:cs(cs({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:i,flexBasis:u};this.setState(m)}},t.prototype.onMouseMove=function(n){var i=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&sp(n))try{n.preventDefault(),n.stopPropagation()}catch{}var s=this.props,a=s.maxWidth,l=s.maxHeight,u=s.minWidth,f=s.minHeight,h=sp(n)?n.touches[0].clientX:n.clientX,g=sp(n)?n.touches[0].clientY:n.clientY,m=this.state,_=m.direction,b=m.original,x=m.width,S=m.height,C=this.getParentSize(),k=fJ(C,this.window.innerWidth,this.window.innerHeight,a,l,u,f);a=k.maxWidth,l=k.maxHeight,u=k.minWidth,f=k.minHeight;var R=this.calculateNewSizeFromDirection(h,g),N=R.newHeight,A=R.newWidth,I=this.calculateNewMaxFromBoundary(a,l);this.props.snap&&this.props.snap.x&&(A=TR(A,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(N=TR(N,this.props.snap.y,this.props.snapGap));var T=this.calculateNewSizeFromAspectRatio(A,N,{width:I.maxWidth,height:I.maxHeight},{width:u,height:f});if(A=T.newWidth,N=T.newHeight,this.props.grid){var D=RR(A,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),L=RR(N,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),ee=this.props.snapGap||0,U=ee===0||Math.abs(D-A)<=ee?D:A,F=ee===0||Math.abs(L-N)<=ee?L:N;A=U,N=F}var B={width:A-b.width,height:N-b.height};if(this.delta=B,x&&typeof x=="string"){if(x.endsWith("%")){var W=A/C.width*100;A="".concat(W,"%")}else if(x.endsWith("vw")){var te=A/this.window.innerWidth*100;A="".concat(te,"vw")}else if(x.endsWith("vh")){var G=A/this.window.innerHeight*100;A="".concat(G,"vh")}}if(S&&typeof S=="string"){if(S.endsWith("%")){var W=N/C.height*100;N="".concat(W,"%")}else if(S.endsWith("vw")){var te=N/this.window.innerWidth*100;N="".concat(te,"vw")}else if(S.endsWith("vh")){var G=N/this.window.innerHeight*100;N="".concat(G,"vh")}}var P={width:this.createSizeForCssProperty(A,"width"),height:this.createSizeForCssProperty(N,"height")};this.flexDir==="row"?P.flexBasis=P.width:this.flexDir==="column"&&(P.flexBasis=P.height);var Z=this.state.width!==P.width,$=this.state.height!==P.height,ae=this.state.flexBasis!==P.flexBasis,j=Z||$||ae;j&&yl.flushSync(function(){i.setState(P)}),this.props.onResize&&j&&this.props.onResize(n,_,this.resizable,B)}},t.prototype.onMouseUp=function(n){var i,s,a=this.state,l=a.isResizing,u=a.direction;a.original,!(!l||!this.resizable)&&(this.props.onResizeStop&&this.props.onResizeStop(n,u,this.resizable,this.delta),this.props.size&&this.setState({width:(i=this.props.size.width)!==null&&i!==void 0?i:"auto",height:(s=this.props.size.height)!==null&&s!==void 0?s:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:cs(cs({},this.state.backgroundStyle),{cursor:"auto"})}))},t.prototype.updateSize=function(n){var i,s;this.setState({width:(i=n.width)!==null&&i!==void 0?i:"auto",height:(s=n.height)!==null&&s!==void 0?s:"auto"})},t.prototype.renderResizer=function(){var n=this,i=this.props,s=i.enable,a=i.handleStyles,l=i.handleClasses,u=i.handleWrapperStyle,f=i.handleWrapperClass,h=i.handleComponent;if(!s)return null;var g=Object.keys(s).map(function(m){return s[m]!==!1?p.jsx(cJ,{direction:m,onResizeStart:n.onResizeStart,replaceStyles:a&&a[m],className:l&&l[m],children:h&&h[m]?h[m]:null},m):null});return p.jsx("div",{className:f,style:u,children:g})},t.prototype.render=function(){var n=this,i=Object.keys(this.props).reduce(function(l,u){return mJ.indexOf(u)!==-1||(l[u]=n.props[u]),l},{}),s=cs(cs(cs({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(s.flexBasis=this.state.flexBasis);var a=this.props.as||"div";return p.jsxs(a,cs({style:s,className:this.props.className},i,{ref:function(l){l&&(n.resizable=l)},children:[this.state.isResizing&&p.jsx("div",{style:this.state.backgroundStyle}),this.props.children,this.renderResizer()]}))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t})(w.PureComponent);var rx=function(e,t){return rx=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},rx(e,t)};function vJ(e,t){rx(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Dn=function(){return Dn=Object.assign||function(t){for(var n,i=1,s=arguments.length;i<s;i++){n=arguments[i];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Dn.apply(this,arguments)};function yJ(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]]);return n}var _J={width:"auto",height:"auto",display:"inline-block",position:"absolute",top:0,left:0},bJ=function(e){return{bottom:e,bottomLeft:e,bottomRight:e,left:e,right:e,top:e,topLeft:e,topRight:e}},xJ=(function(e){vJ(t,e);function t(n){var i=e.call(this,n)||this;return i.resizingPosition={x:0,y:0},i.offsetFromParent={left:0,top:0},i.resizableElement={current:null},i.originalPosition={x:0,y:0},i.state={resizing:!1,bounds:{top:0,right:0,bottom:0,left:0},maxWidth:n.maxWidth,maxHeight:n.maxHeight},i.onResizeStart=i.onResizeStart.bind(i),i.onResize=i.onResize.bind(i),i.onResizeStop=i.onResizeStop.bind(i),i.onDragStart=i.onDragStart.bind(i),i.onDrag=i.onDrag.bind(i),i.onDragStop=i.onDragStop.bind(i),i.getMaxSizesFromProps=i.getMaxSizesFromProps.bind(i),i}return t.prototype.componentDidMount=function(){this.updateOffsetFromParent();var n=this.offsetFromParent,i=n.left,s=n.top,a=this.getDraggablePosition(),l=a.x,u=a.y;this.draggable.setState({x:l-i,y:u-s}),this.forceUpdate()},t.prototype.getDraggablePosition=function(){var n=this.draggable.state,i=n.x,s=n.y;return{x:i,y:s}},t.prototype.getParent=function(){return this.resizable&&this.resizable.parentNode},t.prototype.getParentSize=function(){return this.resizable.getParentSize()},t.prototype.getMaxSizesFromProps=function(){var n=typeof this.props.maxWidth>"u"?Number.MAX_SAFE_INTEGER:this.props.maxWidth,i=typeof this.props.maxHeight>"u"?Number.MAX_SAFE_INTEGER:this.props.maxHeight;return{maxWidth:n,maxHeight:i}},t.prototype.getSelfElement=function(){return this.resizable&&this.resizable.resizable},t.prototype.getOffsetHeight=function(n){var i=this.props.scale;switch(this.props.bounds){case"window":return window.innerHeight/i;case"body":return document.body.offsetHeight/i;default:return n.offsetHeight}},t.prototype.getOffsetWidth=function(n){var i=this.props.scale;switch(this.props.bounds){case"window":return window.innerWidth/i;case"body":return document.body.offsetWidth/i;default:return n.offsetWidth}},t.prototype.onDragStart=function(n,i){if(this.props.onDragStart&&this.props.onDragStart(n,i)===!1)return!1;var s=this.getDraggablePosition();if(this.originalPosition=s,!!this.props.bounds){var a=this.getParent(),l=this.props.scale,u;if(this.props.bounds==="parent")u=a;else if(this.props.bounds==="body"){var f=a.getBoundingClientRect(),h=f.left,g=f.top,m=document.body.getBoundingClientRect(),_=-(h-a.offsetLeft*l-m.left)/l,b=-(g-a.offsetTop*l-m.top)/l,x=(document.body.offsetWidth-this.resizable.size.width*l)/l+_,S=(document.body.offsetHeight-this.resizable.size.height*l)/l+b;return this.setState({bounds:{top:b,right:x,bottom:S,left:_}})}else if(this.props.bounds==="window"){if(!this.resizable)return;var C=a.getBoundingClientRect(),k=C.left,R=C.top,N=-(k-a.offsetLeft*l)/l,A=-(R-a.offsetTop*l)/l,x=(window.innerWidth-this.resizable.size.width*l)/l+N,S=(window.innerHeight-this.resizable.size.height*l)/l+A;return this.setState({bounds:{top:A,right:x,bottom:S,left:N}})}else typeof this.props.bounds=="string"?u=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(u=this.props.bounds);if(!(!(u instanceof HTMLElement)||!(a instanceof HTMLElement))){var I=u.getBoundingClientRect(),T=I.left,D=I.top,L=a.getBoundingClientRect(),ee=L.left,U=L.top,F=(T-ee)/l,B=D-U;if(this.resizable){this.updateOffsetFromParent();var W=this.offsetFromParent;this.setState({bounds:{top:B-W.top,right:F+(u.offsetWidth-this.resizable.size.width)-W.left/l,bottom:B+(u.offsetHeight-this.resizable.size.height)-W.top,left:F-W.left/l}})}}}},t.prototype.onDrag=function(n,i){if(this.props.onDrag){var s=this.offsetFromParent,a=s.left,l=s.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDrag(n,Dn(Dn({},i),{x:i.x+a,y:i.y+l}));if(this.props.dragAxis==="x")return this.props.onDrag(n,Dn(Dn({},i),{x:i.x+a,y:this.originalPosition.y+l,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDrag(n,Dn(Dn({},i),{x:this.originalPosition.x+a,y:i.y+l,deltaX:0}))}},t.prototype.onDragStop=function(n,i){if(this.props.onDragStop){var s=this.offsetFromParent,a=s.left,l=s.top;if(!this.props.dragAxis||this.props.dragAxis==="both")return this.props.onDragStop(n,Dn(Dn({},i),{x:i.x+a,y:i.y+l}));if(this.props.dragAxis==="x")return this.props.onDragStop(n,Dn(Dn({},i),{x:i.x+a,y:this.originalPosition.y+l,deltaY:0}));if(this.props.dragAxis==="y")return this.props.onDragStop(n,Dn(Dn({},i),{x:this.originalPosition.x+a,y:i.y+l,deltaX:0}))}},t.prototype.onResizeStart=function(n,i,s){if(this.props.onResizeStart&&this.props.onResizeStart(n,i,s)===!1)return!1;n.stopPropagation(),this.setState({resizing:!0});var a=this.props.scale,l=this.offsetFromParent,u=this.getDraggablePosition();if(this.resizingPosition={x:u.x+l.left,y:u.y+l.top},this.originalPosition=u,this.props.bounds){var f=this.getParent(),h=void 0;this.props.bounds==="parent"?h=f:this.props.bounds==="body"?h=document.body:this.props.bounds==="window"?h=window:typeof this.props.bounds=="string"?h=document.querySelector(this.props.bounds):this.props.bounds instanceof HTMLElement&&(h=this.props.bounds);var g=this.getSelfElement();if(g instanceof Element&&(h instanceof HTMLElement||h===window)&&f instanceof HTMLElement){var m=this.getMaxSizesFromProps(),_=m.maxWidth,b=m.maxHeight,x=this.getParentSize();if(_&&typeof _=="string")if(_.endsWith("%")){var S=Number(_.replace("%",""))/100;_=x.width*S}else _.endsWith("px")&&(_=Number(_.replace("px","")));if(b&&typeof b=="string")if(b.endsWith("%")){var S=Number(b.replace("%",""))/100;b=x.height*S}else b.endsWith("px")&&(b=Number(b.replace("px","")));var C=g.getBoundingClientRect(),k=C.left,R=C.top,N=this.props.bounds==="window"?{left:0,top:0}:h.getBoundingClientRect(),A=N.left,I=N.top,T=this.getOffsetWidth(h),D=this.getOffsetHeight(h),L=i.toLowerCase().endsWith("left"),ee=i.toLowerCase().endsWith("right"),U=i.startsWith("top"),F=i.startsWith("bottom");if((L||U)&&this.resizable){var B=(k-A)/a+this.resizable.size.width;this.setState({maxWidth:B>Number(_)?_:B})}if(ee||this.props.lockAspectRatio&&!L&&!U){var B=T+(A-k)/a;this.setState({maxWidth:B>Number(_)?_:B})}if((U||L)&&this.resizable){var B=(R-I)/a+this.resizable.size.height;this.setState({maxHeight:B>Number(b)?b:B})}if(F||this.props.lockAspectRatio&&!U&&!L){var B=D+(I-R)/a;this.setState({maxHeight:B>Number(b)?b:B})}}}else this.setState({maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight})},t.prototype.onResize=function(n,i,s,a){var l=this,u={x:this.originalPosition.x,y:this.originalPosition.y},f=-a.width,h=-a.height,g=["top","left","topLeft","bottomLeft","topRight"];g.includes(i)&&(i==="bottomLeft"?u.x+=f:(i==="topRight"||(u.x+=f),u.y+=h));var m=this.draggable.state;(u.x!==m.x||u.y!==m.y)&&yl.flushSync(function(){l.draggable.setState(u)}),this.updateOffsetFromParent();var _=this.offsetFromParent,b=this.getDraggablePosition().x+_.left,x=this.getDraggablePosition().y+_.top;this.resizingPosition={x:b,y:x},this.props.onResize&&this.props.onResize(n,i,s,a,{x:b,y:x})},t.prototype.onResizeStop=function(n,i,s,a){this.setState({resizing:!1});var l=this.getMaxSizesFromProps(),u=l.maxWidth,f=l.maxHeight;this.setState({maxWidth:u,maxHeight:f}),this.props.onResizeStop&&this.props.onResizeStop(n,i,s,a,this.resizingPosition)},t.prototype.updateSize=function(n){this.resizable&&this.resizable.updateSize({width:n.width,height:n.height})},t.prototype.updatePosition=function(n){this.draggable.setState(n)},t.prototype.updateOffsetFromParent=function(){var n=this.props.scale,i=this.getParent(),s=this.getSelfElement();if(!i||s===null)return{top:0,left:0};var a=i.getBoundingClientRect(),l=a.left,u=a.top,f=s.getBoundingClientRect(),h=this.getDraggablePosition(),g=i.scrollLeft,m=i.scrollTop;this.offsetFromParent={left:f.left-l+g-h.x*n,top:f.top-u+m-h.y*n}},t.prototype.render=function(){var n=this,i=this.props,s=i.disableDragging,a=i.style,l=i.dragHandleClassName,u=i.position,f=i.onMouseDown,h=i.onMouseUp,g=i.dragAxis,m=i.dragGrid,_=i.bounds,b=i.enableUserSelectHack,x=i.cancel,S=i.children;i.onResizeStart,i.onResize,i.onResizeStop,i.onDragStart,i.onDrag,i.onDragStop;var C=i.resizeHandleStyles,k=i.resizeHandleClasses,R=i.resizeHandleComponent,N=i.enableResizing,A=i.resizeGrid,I=i.resizeHandleWrapperClass,T=i.resizeHandleWrapperStyle,D=i.scale,L=i.allowAnyClick,ee=i.dragPositionOffset,U=yJ(i,["disableDragging","style","dragHandleClassName","position","onMouseDown","onMouseUp","dragAxis","dragGrid","bounds","enableUserSelectHack","cancel","children","onResizeStart","onResize","onResizeStop","onDragStart","onDrag","onDragStop","resizeHandleStyles","resizeHandleClasses","resizeHandleComponent","enableResizing","resizeGrid","resizeHandleWrapperClass","resizeHandleWrapperStyle","scale","allowAnyClick","dragPositionOffset"]),F=this.props.default?Dn({},this.props.default):void 0;delete U.default;var B=s||l?{cursor:"auto"}:{cursor:"move"},W=Dn(Dn(Dn({},_J),B),a),te=this.offsetFromParent,G=te.left,P=te.top,Z;u&&(Z={x:u.x-G,y:u.y-P});var $=this.state.resizing?void 0:Z,ae=this.state.resizing?"both":g;return w.createElement(aJ,{ref:function(j){j&&(n.draggable=j)},handle:l?".".concat(l):void 0,defaultPosition:F,onMouseDown:f,onMouseUp:h,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,axis:ae,disabled:s,grid:m,bounds:_?this.state.bounds:void 0,position:$,enableUserSelectHack:b,cancel:x,scale:D,allowAnyClick:L,nodeRef:this.resizableElement,positionOffset:ee},w.createElement(gJ,Dn({},U,{ref:function(j){j&&(n.resizable=j,n.resizableElement.current=j.resizable)},defaultSize:F,size:this.props.size,enable:typeof N=="boolean"?bJ(N):N,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,style:W,minWidth:this.props.minWidth,minHeight:this.props.minHeight,maxWidth:this.state.resizing?this.state.maxWidth:this.props.maxWidth,maxHeight:this.state.resizing?this.state.maxHeight:this.props.maxHeight,grid:A,handleWrapperClass:I,handleWrapperStyle:T,lockAspectRatio:this.props.lockAspectRatio,lockAspectRatioExtraWidth:this.props.lockAspectRatioExtraWidth,lockAspectRatioExtraHeight:this.props.lockAspectRatioExtraHeight,handleStyles:C,handleClasses:k,handleComponent:R,scale:this.props.scale}),S))},t.defaultProps={maxWidth:Number.MAX_SAFE_INTEGER,maxHeight:Number.MAX_SAFE_INTEGER,scale:1,onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},onDragStart:function(){},onDrag:function(){},onDragStop:function(){}},t})(w.PureComponent);function SJ(e,t){return e?e.kind==="services"?t.services.find(n=>n.id===e.resourceId)?.name??e.title:e.kind==="terminal"?t.terminals.find(n=>n.id===e.resourceId)?.title??e.title:e.title:"窗口"}const H1=e=>["services",e],wJ=e=>["services","detail",e],CJ=(e,t)=>["services","logs",e,t];async function kJ(e){return TY.parse(await we(`/api/services?projectId=${encodeURIComponent(e)}&limit=200`)).items}async function EJ(e){return Ym.parse(await we(`/api/services/${encodeURIComponent(e)}`))}async function NJ(e,t=0,n=200){return we(`/api/services/${encodeURIComponent(e)}/logs?after=${t}&limit=${n}`)}async function RJ(e){return j1.parse(await we("/api/services",{method:"POST",csrf:!0,body:e}))}async function AR(e,t){return j1.parse(await we(`/api/resource-actions/${encodeURIComponent(e)}/decision`,{method:"POST",csrf:!0,body:{decision:t}}))}async function TJ(e){return j1.parse(await we(`/api/resource-actions/${encodeURIComponent(e)}/execute`,{method:"POST",csrf:!0,body:{}}))}async function OR(e,t="/",n="embedded"){return we("/api/previews/resolve",{method:"POST",csrf:!0,body:{serviceId:e,path:t,mode:n}})}async function DJ(e){return Ym.parse(await we(`/api/services/${encodeURIComponent(e)}/stop`,{method:"POST",csrf:!0,body:{}}))}async function AJ(e){return Ym.parse(await we(`/api/services/${encodeURIComponent(e)}`,{method:"DELETE",csrf:!0}))}function OJ({tab:e}){return e.browser?p.jsx(jJ,{tab:e}):p.jsx(zJ,{tab:e})}function jR(e){return e instanceof rr||e instanceof Error?e.message:"预览不可用"}function jJ({tab:e}){const t=e.browser,[n,i]=w.useState(null),[s,a]=w.useState(""),[l,u]=w.useState(!0),[f,h]=w.useState(0),[g,m]=w.useState(!1),_=w.useRef(null),b=`preview-${e.id.replace(/[^a-zA-Z0-9_-]/g,"-")}`;w.useEffect(()=>{if(!t)return;let S=!1;const C=f;return u(!0),a(""),i(null),OR(t.serviceId,t.path).then(k=>{S||C!==f||(i(k),u(!1))}).catch(k=>{S||C!==f||(a(jR(k)),u(!1))}),()=>{S=!0}},[t,f]),w.useEffect(()=>{n&&_.current?.submit()},[n]);const x=async()=>{if(!t||g)return;m(!0),a("");const S=window.open("about:blank","_blank");try{if(!S)throw new Error("浏览器阻止了新窗口");S.opener=null;const C=await OR(t.serviceId,t.path,"external"),k=document.createElement("form");k.method="POST",k.action=C.bootstrapUrl,k.target=`preview-external-${Date.now()}`,S.name=k.target,k.style.display="none";for(const[R,N]of[["ticket",C.ticket],["path",t.path]]){const A=document.createElement("input");A.type="hidden",A.name=R,A.value=N,k.append(A)}document.body.append(k),k.submit(),k.remove()}catch(C){S?.close(),a(jR(C))}finally{m(!1)}};return p.jsxs("div",{className:"flex h-full flex-col bg-surface",children:[p.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-b border-line bg-surface-2/45 px-2",children:[p.jsx(bi,{label:"后退",disabled:!0,className:"h-6 w-6",children:p.jsx(aa,{size:13})}),p.jsx(bi,{label:"前进",disabled:!0,className:"h-6 w-6",children:p.jsx(kj,{size:13})}),p.jsx(bi,{label:"刷新预览",onClick:()=>h(S=>S+1),className:"h-6 w-6",children:p.jsx(xl,{size:12,className:l?"animate-spin":void 0})}),p.jsxs("div",{className:"mx-1 flex h-7 min-w-0 flex-1 items-center gap-1.5 rounded-lg border border-line bg-surface px-2",children:[p.jsx(Hm,{size:11,className:"shrink-0 text-success"}),p.jsx("span",{title:"预览地址",className:"h-full min-w-0 flex-1 truncate font-mono text-[10.5px] leading-7 text-ink-2",children:n?`${n.origin}${t?.path??"/"}`:"解析预览来源…"}),l?p.jsx(Ss,{size:11,className:"animate-spin text-ink-3"}):null]}),p.jsx(bi,{label:"在独立来源打开",onClick:()=>{x()},disabled:g,className:"h-6 w-6",children:p.jsx(Wj,{size:12})})]}),p.jsxs("div",{className:"relative min-h-0 flex-1 bg-white",children:[s?p.jsxs("div",{className:"absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 bg-surface text-center",children:[p.jsx("p",{role:"alert",title:s,className:"max-w-[360px] px-4 text-[12px] text-ink-2",children:"无法访问"}),p.jsx("button",{type:"button",className:"text-[11px] text-accent underline",onClick:()=>h(S=>S+1),children:"刷新"})]}):null,p.jsx("form",{ref:_,method:"POST",action:n?.bootstrapUrl??"",target:b,hidden:!0,children:p.jsx("input",{type:"hidden",name:"ticket",value:n?.ticket??"",readOnly:!0})}),p.jsx("iframe",{name:b,title:"项目预览","data-testid":"preview-frame",src:"about:blank",sandbox:"allow-scripts allow-forms allow-same-origin",referrerPolicy:"no-referrer",className:"h-full w-full border-0 bg-white"}),l?p.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-surface/60 text-[11px] text-ink-3",children:"正在建立隔离预览…"}):null]}),p.jsxs("div",{className:"flex h-6 shrink-0 items-center gap-1.5 border-t border-line bg-surface-2/50 px-2 font-mono text-[9px] text-ink-3",children:[p.jsx(Jd,{size:10,className:"shrink-0"}),p.jsx("span",{className:"whitespace-nowrap",children:"独立来源"})]})]})}function zJ({tab:e}){const[t,n]=w.useState(e.resourceId.startsWith("http")?e.resourceId:"http://localhost:5173/dashboard"),[i,s]=w.useState(!1),a=()=>{s(!0),window.setTimeout(()=>s(!1),650)};return p.jsxs("div",{className:"flex h-full flex-col bg-surface",children:[p.jsxs("div",{className:"flex h-10 shrink-0 items-center gap-1 border-b border-line bg-surface-2/45 px-2",children:[p.jsx(bi,{label:"后退",disabled:!0,className:"h-6 w-6",children:p.jsx(aa,{size:13})}),p.jsx(bi,{label:"前进",disabled:!0,className:"h-6 w-6",children:p.jsx(kj,{size:13})}),p.jsx(bi,{label:"刷新",onClick:a,className:"h-6 w-6",children:p.jsx(xl,{size:12,className:i?"animate-spin":void 0})}),p.jsxs("form",{className:"mx-1 flex h-7 min-w-0 flex-1 items-center gap-1.5 rounded-lg border border-line bg-surface px-2",onSubmit:l=>{l.preventDefault(),a()},children:[p.jsx(Hm,{size:11,className:"shrink-0 text-success"}),p.jsx("input",{value:t,onChange:l=>n(l.target.value),"aria-label":"预览地址",className:"h-full min-w-0 flex-1 bg-transparent font-mono text-[10.5px] text-ink-2 outline-none"}),i?p.jsx(Ss,{size:11,className:"animate-spin text-ink-3"}):null]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-auto bg-[#f7f8fa]",children:p.jsx(MJ,{address:t})}),p.jsxs("div",{className:"flex h-6 shrink-0 items-center gap-1.5 border-t border-line bg-surface-2/50 px-2 font-mono text-[9px] text-ink-3",children:[p.jsx(Jd,{size:10,className:"shrink-0"}),p.jsx("span",{className:"whitespace-nowrap",children:"演示预览"})]})]})}function MJ({address:e}){return p.jsxs("div",{className:"min-h-full bg-[#f7f8fa] text-[#1d1d1f]",children:[p.jsx("div",{className:"border-b border-black/[.06] bg-white/80 px-6 py-3 backdrop-blur",children:p.jsxs("div",{className:"mx-auto flex max-w-[900px] items-center gap-3",children:[p.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-lg bg-[#0a84ff] text-[10px] font-bold text-white",children:"L"}),p.jsx("span",{className:"text-[12px] font-semibold",children:"Larness"}),p.jsxs("nav",{className:"ml-4 flex items-center gap-4 text-[10.5px] text-[#6e6e73]",children:[p.jsx("span",{className:"text-[#1d1d1f]",children:"概览"}),p.jsx("span",{children:"项目"}),p.jsx("span",{children:"运行记录"})]}),p.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[p.jsx("span",{className:"rounded-full bg-[#30d158]/10 px-2 py-[2px] text-[9px] font-medium text-[#1f9d48]",children:"dev · healthy"}),p.jsx("div",{className:"h-6 w-6 rounded-full bg-[#ffd60a]"})]})]})}),p.jsxs("div",{className:"mx-auto max-w-[900px] px-6 py-8",children:[p.jsxs("div",{className:"flex items-end justify-between",children:[p.jsxs("div",{children:[p.jsx("p",{className:"text-[10px] font-medium uppercase tracking-[.12em] text-[#86868b]",children:"Workspace overview"}),p.jsx("h2",{className:"mt-2 text-[28px] font-semibold tracking-[-.03em]",children:"你的工作空间,已就绪。"}),p.jsx("p",{className:"mt-1.5 max-w-[520px] text-[12px] leading-5 text-[#6e6e73]",children:"这是 Vite 开发服务的本地预览占位页面。真实项目会在独立来源中加载,不共享管理站的 Cookie。"})]}),p.jsxs("div",{className:"hidden rounded-xl border border-black/[.06] bg-white px-3 py-2 text-right shadow-sm sm:block",children:[p.jsx("div",{className:"font-mono text-[9px] text-[#86868b]",children:e}),p.jsx("div",{className:"mt-1 text-[10px] text-[#1f9d48]",children:"HTTP 200 · 42ms"})]})]}),p.jsx("div",{className:"mt-6 grid grid-cols-3 gap-3",children:[{label:"运行中的服务",value:"3",detail:"+1 今日",tint:"#0a84ff"},{label:"本周部署",value:"12",detail:"全部健康",tint:"#30d158"},{label:"终端会话",value:"2",detail:"1 个空闲",tint:"#ff9f0a"}].map(t=>p.jsxs("div",{className:"rounded-2xl border border-black/[.06] bg-white p-4 shadow-[0_1px_2px_rgba(0,0,0,.03)]",children:[p.jsx("div",{className:"text-[10px] text-[#86868b]",children:t.label}),p.jsxs("div",{className:"mt-2 flex items-end gap-2",children:[p.jsx("span",{className:"text-[26px] font-semibold leading-none tracking-[-.04em]",children:t.value}),p.jsx("span",{className:"pb-0.5 text-[9.5px] text-[#6e6e73]",children:t.detail})]}),p.jsx("div",{className:"mt-3 h-1 rounded-full bg-black/[.05]",children:p.jsx("div",{className:"h-full rounded-full",style:{width:t.label==="运行中的服务"?"62%":"78%",background:t.tint}})})]},t.label))}),p.jsxs("div",{className:"mt-3 grid grid-cols-[1.4fr_1fr] gap-3",children:[p.jsxs("div",{className:"rounded-2xl border border-black/[.06] bg-white p-4",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-[11px] font-semibold",children:"最近活动"}),p.jsx("span",{className:"text-[9.5px] text-[#86868b]",children:"过去 24 小时"})]}),p.jsx("div",{className:"mt-3 flex h-[92px] items-end gap-1.5",children:[38,52,44,66,58,74,62,80,68,86,72,92].map((t,n)=>p.jsx("div",{className:qe("flex-1 rounded-t-[3px]",n===11?"bg-[#0a84ff]":"bg-[#0a84ff]/20"),style:{height:`${t}%`}},n))})]}),p.jsxs("div",{className:"rounded-2xl border border-black/[.06] bg-white p-4",children:[p.jsx("div",{className:"text-[11px] font-semibold",children:"当前会话"}),p.jsx("div",{className:"mt-3 space-y-2",children:[["feat/agent-runtime","feat/agent-runtime","运行中"],["web-prod","PM2 · 8080","待部署"],["preview","localhost:5173","已连接"]].map(([t,n,i])=>p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[#0a84ff]"}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"truncate text-[10.5px] font-medium",children:t}),p.jsx("div",{className:"truncate font-mono text-[9px] text-[#86868b]",children:n})]}),p.jsx("span",{className:"text-[9px] text-[#6e6e73]",children:i})]},t))})]})]})]}),p.jsxs("div",{className:"flex items-center justify-center gap-2 border-t border-black/[.05] py-4 text-[9px] text-[#86868b]",children:[p.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-[#30d158]"}),"这是 S0 视觉 Demo 的静态预览,不加载真实项目页面"]})]})}function IJ({tab:e}){return p.jsx(PJ,{tab:e})}function PJ({tab:e}){const t=e.projectId,n=e.git,i=Pt({queryKey:["git","diff",t,n?.path,n?.staged],queryFn:()=>EX(t??"",n?.path??"",n?.staged===!0),enabled:t!==null&&n!==void 0,retry:!1});if(t===null||n===void 0)return p.jsx("p",{className:"p-4 text-xs text-ink-3",children:"Diff 目标缺少项目或路径,请重新打开。"});if(i.isPending)return p.jsxs("p",{className:"flex items-center gap-2 p-4 text-xs text-ink-3",children:[p.jsx(Ss,{size:12,className:"animate-spin"})," 读取 Diff…"]});if(i.isError)return p.jsx("p",{role:"alert",className:"p-4 text-xs text-danger",children:"Diff 读取失败;文件仍可按当前状态重新打开。"});const s=i.data;return p.jsx(LJ,{data:s})}function LJ({data:e}){const t=e.binary?[]:e.diff.split(`
111
- `);return p.jsxs("div",{className:"flex h-full flex-col bg-surface",children:[p.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2",children:[p.jsx(o1,{size:14,className:"text-ink-3"}),p.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[10.5px] text-ink-2",children:e.path}),p.jsx("span",{className:"rounded-full border border-line bg-surface-2 px-1.5 py-[1px] text-[9px] text-ink-3",children:e.staged?"已暂存":"工作区"})]}),e.binary?p.jsx("p",{className:"p-4 text-xs text-ink-3",children:"二进制文件不显示文本 Diff;仍可按显式路径暂存 / 提交。"}):e.truncated?p.jsx("p",{className:"p-4 text-xs text-warning",children:"Diff 超过 1 MiB,已截断;不自动写入或覆盖文件。"}):p.jsx("div",{className:"min-h-0 flex-1 overflow-auto font-mono text-[10.5px] leading-[19px]",children:t.map((n,i)=>p.jsxs("div",{className:qe("flex min-w-max whitespace-pre",n.startsWith("+")&&!n.startsWith("+++")&&"bg-success/[.08]",n.startsWith("-")&&!n.startsWith("---")&&"bg-danger/[.07]"),children:[p.jsx("span",{className:"w-5 shrink-0 select-none text-center text-ink-3/70",children:n.startsWith("+")&&!n.startsWith("+++")?"+":n.startsWith("-")&&!n.startsWith("---")?"-":" "}),p.jsx("span",{className:"whitespace-pre pr-6 text-ink-2",children:n||" "})]},`${i}_${n.slice(0,16)}`))}),p.jsxs("div",{className:"flex h-8 shrink-0 items-center gap-3 border-t border-line bg-surface-2/40 px-3 text-[10px] text-ink-3",children:[p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx(Ic,{size:11,className:"text-success"}),"只读 Diff"]}),p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx($r,{size:11,className:"text-success"}),"新增"]}),p.jsxs("span",{className:"flex items-center gap-1",children:[p.jsx($m,{size:11,className:"text-danger"}),"删除"]})]})]})}const BJ="modulepreload",FJ=function(e){return"/"+e},zR={},$1=function(t,n,i){let s=Promise.resolve();if(n&&n.length>0){let f=function(h){return Promise.all(h.map(g=>Promise.resolve(g).then(m=>({status:"fulfilled",value:m}),m=>({status:"rejected",reason:m}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),u=l?.nonce||l?.getAttribute("nonce");s=f(n.map(h=>{if(h=FJ(h),h in zR)return;zR[h]=!0;const g=h.endsWith(".css"),m=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${m}`))return;const _=document.createElement("link");if(_.rel=g?"stylesheet":BJ,g||(_.as="script"),_.crossOrigin="",_.href=h,u&&_.setAttribute("nonce",u),document.head.appendChild(_),g)return new Promise((b,x)=>{_.addEventListener("load",b),_.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${h}`)))})}))}function a(l){const u=new Event("vite:preloadError",{cancelable:!0});if(u.payload=l,window.dispatchEvent(u),!u.defaultPrevented)throw l}return s.then(l=>{for(const u of l||[])u.status==="rejected"&&a(u.reason);return t().catch(a)})};w.lazy(()=>$1(()=>import("./FileViewer-Bv5VYaA3.js"),__vite__mapDeps([0,1,2])));const UJ=w.lazy(()=>$1(()=>import("./FileEditor-DpVfk7t3.js"),__vite__mapDeps([3,1,2])));function HJ({tab:e}){return e.file?p.jsx($J,{tab:e,target:e.file},e.id):p.jsx("div",{className:"p-5 text-sm text-ink-3",children:"从右侧文件树打开文件。旧的预览 Tab 请关闭后重新打开。"})}function $J({tab:e,target:t}){const n=Pt({queryKey:sm(t.scope,t.path),queryFn:()=>w3(t.scope,t.path),staleTime:0}),i=It(S=>S.monitoring[co(t.scope)]),s=It(S=>S.drafts[e.resourceId]),a=It(S=>S.saving[e.resourceId]??!1),[l,u]=w.useState(null),[f,h]=w.useState(!1),g=n.data,m=!!s&&!!g&&s.baseVersion!==g.version,_=s?.text??g?.content,b=S=>{g&&(S===g.content&&(!s||s.baseVersion===g.version)?It.getState().discard(e.resourceId):It.getState().edit(e.resourceId,S,s?.baseVersion??g.version))},x=()=>{u(null),om(e).catch(S=>u(il(S)))};return w.useEffect(()=>{const S=C=>{(C.metaKey||C.ctrlKey)&&C.key==="s"&&(C.preventDefault(),!a&&!n.isError&&!m&&(u(null),om(e).catch(k=>u(il(k)))))};return window.addEventListener("keydown",S),()=>window.removeEventListener("keydown",S)},[a,n.isError,m,e]),p.jsxs("div",{className:"flex h-full flex-col text-[11px] text-ink-2",children:[p.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-line p-2",children:[p.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono",title:t.path,children:[t.path,s?" ●":""]}),p.jsx("button",{type:"button","aria-label":"刷新文件",disabled:a,onClick:()=>{u(null),n.refetch()},children:"刷新"}),p.jsx("button",{type:"button","aria-label":"保存文件",disabled:!s||a||m||n.isError,onClick:x,children:a?"保存中…":"保存"})]}),l&&!m||n.isError?p.jsx("div",{role:"alert",className:"shrink-0 p-2 text-danger",children:l??il(n.error)}):null,m?p.jsxs("div",{className:"shrink-0 space-y-2 border-b border-line bg-warning/10 p-2",children:[p.jsx("p",{role:"status",children:"磁盘文件已变化,草稿已保留。"}),p.jsxs("div",{className:"flex gap-4",children:[p.jsx("button",{type:"button",onClick:()=>h(!f),children:f?"返回编辑":"查看差异"}),p.jsx("button",{type:"button",onClick:()=>{It.getState().discard(e.resourceId),h(!1),u(null)},children:"重新加载磁盘"}),p.jsx("button",{type:"button",onClick:()=>{g&&s&&It.getState().edit(e.resourceId,s.text,g.version),h(!1),u(null)},children:"手工合并"})]}),p.jsx("p",{className:"text-ink-3",children:f?"磁盘版本 → 本地草稿":"重载将放弃草稿;手工合并保留草稿,编辑后按当前磁盘版本保存。"})]}):null,p.jsx("div",{className:"min-h-0 flex-1",children:_!==void 0?p.jsx(w.Suspense,{fallback:p.jsx("p",{className:"p-4",children:"正在加载编辑器…"}),children:p.jsx(UJ,{identity:e.resourceId,path:t.path,text:_,original:f&&m?g?.content:void 0,readOnly:a||n.isError,onChange:b},`${e.resourceId}:${f}`)}):p.jsx("p",{className:"p-4",children:n.isPending?"正在读取完整文件…":"文件不可用"})}),p.jsxs("div",{className:"shrink-0 border-t border-line px-3 py-1 text-ink-3",children:["UTF-8 · ",s?"未保存":"已同步",n.isFetching?" · 正在刷新":""," · ",i??"正在连接文件监听…"]})]})}function V3(e){return e==="RUNNING"?"运行中":e==="UNKNOWN"?"不可用":e==="UNREGISTERED"?"已结束":e}function G3(e){return new Date(e).toLocaleString("zh-CN",{hour12:!1})}const qJ=new Set(["PREVIEW_TARGET_INVALID","APPROVAL_INVALID","CONFLICT","RESOURCE_UNAVAILABLE","NOT_FOUND","EXPIRED"]);function ap(e){return e instanceof rr?e.code==="PREVIEW_TARGET_INVALID"?"无法登记:该端口没有可核验、且属于此终端的监听。请确认服务已在该终端启动;能登记但访问不了时,预览会显示不可用。":e.code==="APPROVAL_INVALID"||e.code==="EXPIRED"?"这次登记已结束(执行失败或过期),请重新登记。":e.message:e instanceof Error?e.message:"登记失败"}function MR(e){return e instanceof rr&&(qJ.has(e.code)||e.status===401||e.status===403)}const sx=new Map;function IR(e){return typeof e=="object"&&e!==null&&"serviceId"in e&&typeof e.serviceId=="string"?e.serviceId:null}function WJ({tab:e}){const t=e.projectId;return t?p.jsx(KJ,{projectId:t,tabId:e.id,initialId:e.resourceId.startsWith("svc_")?e.resourceId:sx.get(e.id)??null}):p.jsx("div",{className:"flex h-full items-center justify-center text-xs text-ink-3",children:"选择一个项目后查看服务"})}function KJ({projectId:e,tabId:t,initialId:n}){const[i,s]=w.useState(n),a=g=>{g?sx.set(t,g):sx.delete(t),s(g)},[l,u]=w.useState(!1),f=Pt({queryKey:H1(e),queryFn:()=>kJ(e),refetchInterval:2e3});if(i)return p.jsx(VJ,{id:i,onBack:()=>a(null),onRefresh:()=>{f.refetch()}});const h=f.data??[];return p.jsxs("div",{className:"flex h-full flex-col",children:[p.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-line px-3 py-2",children:[p.jsx(Pc,{size:14,className:"text-ink-3"}),p.jsx("span",{className:"text-[12px] font-semibold text-ink",children:"服务"}),p.jsx("span",{className:"rounded-full bg-surface-2 px-1.5 text-[10px] text-ink-3",children:h.length}),p.jsx(Se,{className:"ml-auto",size:"sm",variant:"secondary",leading:p.jsx($r,{size:12}),onClick:()=>u(!0),children:"登记服务"})]}),p.jsxs("div",{className:"min-h-0 flex-1 overflow-auto p-3",children:[f.isError?p.jsx("p",{role:"alert",className:"text-[11px] text-danger",children:"服务读取失败,请稍后重试。"}):null,h.length===0?p.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 text-center",children:[p.jsx(Pc,{size:22,className:"text-ink-3"}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("p",{className:"text-[12px] font-medium text-ink",children:"当前项目暂无服务"}),p.jsx("p",{className:"max-w-[320px] text-[11px] text-ink-3",children:"在项目终端启动服务后,可按实际监听端口登记。登记不会启动或重启进程。"})]}),p.jsx(Se,{size:"sm",onClick:()=>u(!0),children:"登记服务"})]}):p.jsx("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2",children:h.map(g=>p.jsxs("button",{type:"button",onClick:()=>a(g.id),className:"rounded-lg border border-line bg-surface p-2.5 text-left transition-colors hover:bg-surface-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"truncate text-[12px] font-medium text-ink",children:g.name}),p.jsx("span",{className:qe("rounded-full border px-1.5 py-[1px] text-[9px]",g.status==="RUNNING"?"border-success/20 bg-success/10 text-success":"border-line bg-surface-2 text-ink-3"),children:V3(g.status)}),p.jsx("span",{className:"ml-auto rounded bg-black/[.04] px-1 text-[9px] text-ink-3 dark:bg-white/[.07]",children:"临时"})]}),p.jsxs("div",{className:"mt-1 font-mono text-[10px] text-ink-3",children:[g.endpoint.host,":",g.endpoint.port]}),p.jsxs("div",{className:"mt-0.5 text-[9.5px] text-ink-3",children:["终端 ",g.terminalId.slice(-6)," · ",G3(g.createdAt)]})]},g.id))})]}),p.jsx(GJ,{open:l,projectId:e,onClose:()=>u(!1),onRegistered:g=>{u(!1),a(g)}})]})}function VJ({id:e,onBack:t,onRefresh:n}){const i=Pt({queryKey:wJ(e),queryFn:()=>EJ(e),refetchInterval:2e3}),s=Pt({queryKey:CJ(e,0),queryFn:()=>NJ(e,0),refetchInterval:2e3}),[a,l]=w.useState(""),[u,f]=w.useState(null),[h,g]=w.useState(!1),[m,_]=w.useState(""),b=zn(),x=et(R=>R.open),S=i.data;if(i.isError)return p.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-xs text-ink-3",children:[p.jsx("p",{role:"alert",children:"服务不可用或已移除。"}),p.jsx(Se,{size:"sm",variant:"secondary",onClick:t,children:"返回列表"})]});if(!S)return p.jsx("div",{className:"p-3 text-xs text-ink-3",children:"读取服务…"});const C=S.status!=="RUNNING",k=(s.data?.chunks??[]).map(R=>R.data).join("");return p.jsxs("div",{className:"flex h-full flex-col",children:[p.jsxs("div",{className:"flex shrink-0 items-start gap-2 border-b border-line px-3 py-2",children:[p.jsx(Se,{size:"sm",variant:"ghost",leading:p.jsx(aa,{size:12}),onClick:t,children:"返回"}),p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx("span",{className:"truncate text-[12.5px] font-semibold text-ink",children:S.name}),p.jsx("span",{className:qe("rounded-full border px-1.5 py-[1px] text-[9px]",C?"border-line bg-surface-2 text-ink-3":"border-success/20 bg-success/10 text-success"),children:V3(S.status)})]}),p.jsx("div",{className:"mt-0.5 font-mono text-[10px] text-ink-3",children:`${S.endpoint.protocol}://${S.endpoint.host}:${S.endpoint.port}`})]}),p.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[p.jsx(Se,{size:"sm",variant:"secondary",leading:p.jsx(Lc,{size:12}),onClick:()=>{l(""),tu(S.terminalId).then(Qm).catch(()=>l("所属终端不可用"))},children:"打开终端"}),p.jsx(Se,{size:"sm",leading:p.jsx(Wj,{size:12}),disabled:S.status!=="RUNNING",onClick:()=>x({kind:"browser",resourceId:`browser:${S.id}:/`,browser:{serviceId:S.id,path:"/"},title:`预览 ${S.name}`,projectId:S.projectId,source:"artifact"}),children:"预览"}),p.jsx(Se,{size:"sm",variant:"danger",disabled:S.status!=="RUNNING"||h,onClick:()=>{_(""),f("stop")},children:"停止服务"}),p.jsx(Se,{size:"sm",variant:"ghost",disabled:h,onClick:()=>{_(""),f("delete")},children:"删除登记"})]})]}),C?p.jsx("div",{className:"border-b border-line bg-surface-2/60 px-3 py-2 text-[11px] text-ink-3",children:"服务已结束或暂不可用;登记与预览不会重新启动源进程。"}):null,a?p.jsx("p",{role:"alert",className:"px-3 py-2 text-[11px] text-danger",children:a}):null,m?p.jsx("p",{role:"alert",className:"px-3 py-2 text-[11px] text-danger",children:m}):null,p.jsx(xi,{open:u!==null,onOpenChange:R=>!R&&!h?f(null):void 0,children:p.jsxs(ui,{className:"w-[400px] space-y-3 text-sm",children:[p.jsx(Si,{children:u==="stop"?"停止服务?":"删除登记?"}),p.jsx(wi,{children:u==="stop"?"会终止该监听进程及其子进程,并撤销预览;终端 Shell 和无关进程不受影响。共享同一进程的其他服务也会失效。":"只删除登记并撤销预览,不会停止正在运行的进程;终端可继续使用。"}),p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(Se,{variant:"secondary",disabled:h,onClick:()=>f(null),children:"取消"}),p.jsx(Se,{variant:u==="stop"?"danger":"primary",disabled:h,onClick:()=>{u&&(g(!0),_(""),(u==="stop"?DJ(S.id):AJ(S.id)).then(async()=>{await b.invalidateQueries({queryKey:H1(S.projectId)}),f(null),t()}).catch(R=>{_(R instanceof Error?R.message:u==="stop"?"停止失败":"删除失败")}).finally(()=>g(!1)))},children:u==="stop"?"停止":"删除"})]})]})}),p.jsxs("div",{className:"grid shrink-0 grid-cols-2 gap-2 px-3 py-2 md:grid-cols-4",children:[p.jsx(lp,{label:"终端",value:S.terminalId.slice(-6),mono:!0}),p.jsx(lp,{label:"执行",value:S.terminalExecutionId.slice(-6),mono:!0}),p.jsx(lp,{label:"Generation",value:String(S.endpointGeneration),mono:!0}),p.jsx(lp,{label:"登记时间",value:G3(S.createdAt)})]}),p.jsxs("div",{className:"flex min-h-0 flex-1 flex-col px-3 pb-3",children:[p.jsxs("div",{className:"flex items-center gap-2 text-[10px] font-semibold uppercase tracking-[.08em] text-ink-3",children:["关联终端输出",p.jsx("span",{className:"font-normal normal-case tracking-normal text-ink-3",children:"不是逐条命令的精确日志"})]}),p.jsx("div",{className:"mt-1 min-h-0 flex-1 overflow-auto rounded-lg border border-line bg-[#0f1115] p-2 font-mono text-[10px] leading-5 text-[#c7ccd4]",children:s.isError?p.jsx("p",{role:"alert",className:"text-danger",children:"日志读取失败"}):k?p.jsx("pre",{className:"whitespace-pre-wrap break-all",children:k}):p.jsx("span",{className:"text-white/35",children:"暂无输出"})}),p.jsx("button",{type:"button",className:"mt-1 self-end text-[10px] text-ink-3 hover:text-ink",onClick:()=>{n(),i.refetch(),s.refetch()},children:"刷新"})]})]})}function lp({label:e,value:t,mono:n}){return p.jsxs("div",{className:"rounded-lg border border-line bg-surface-2/50 px-2 py-1.5",children:[p.jsx("div",{className:"text-[9px] uppercase tracking-[.08em] text-ink-3",children:e}),p.jsx("div",{className:qe("mt-0.5 truncate text-[11px] text-ink",n&&"font-mono"),children:t})]})}function GJ({open:e,projectId:t,onClose:n,onRegistered:i}){const s=zn(),a=Pt({queryKey:["terminals","service-picker",t],queryFn:()=>z3(void 0,{projectId:t}),enabled:e}),[l,u]=w.useState(""),[f,h]=w.useState(""),[g,m]=w.useState(""),[_,b]=w.useState(!1),[x,S]=w.useState(""),[C,k]=w.useState(null),R=(a.data?.items??[]).filter(D=>D.status==="RUNNING"),N=async D=>{await s.invalidateQueries({queryKey:H1(t)}),i(D)},A=async()=>{const D=Number(g);if(!l||!f.trim()||!Number.isInteger(D)||D<1||D>65535){S("请选择运行中的终端,并填写 1–80 字名称与有效端口");return}b(!0),S("");try{const L=await RJ({kind:"temporary",terminalId:l,name:f.trim(),endpoint:{host:"127.0.0.1",port:D,protocol:"http"}});if(L.status==="WAITING_APPROVAL")k({id:L.id});else if(L.status==="COMPLETED"){const ee=IR(L.result);ee?await N(ee):S("登记完成但缺少服务标识")}else S(`登记未完成:${L.status}`)}catch(L){S(ap(L))}finally{b(!1)}},I=async()=>{if(C){b(!0),S("");try{const D=await AR(C.id,"approve"),L=await TJ(D.id),ee=IR(L.result);if(L.status!=="COMPLETED"||!ee){k(null),S(`登记未完成:${L.status},请重新登记。`);return}await N(ee)}catch(D){MR(D)&&k(null),S(ap(D))}finally{b(!1)}}},T=async()=>{if(C){b(!0);try{await AR(C.id,"reject"),k(null),n()}catch(D){if(MR(D)){k(null),S(ap(D));return}S(ap(D))}finally{b(!1)}}};return p.jsx(xi,{open:e,onOpenChange:D=>!D&&!_?n():void 0,children:p.jsxs(ui,{className:"w-[420px] space-y-3 text-sm",children:[p.jsx(Si,{children:"登记临时服务"}),p.jsx(wi,{children:"选择当前项目中运行服务的终端并填写服务的监听端口。后端会核验监听是否属于该终端。"}),C?p.jsxs("div",{className:"space-y-3",children:[p.jsx("p",{className:"rounded-md border border-line bg-surface-2/60 p-2 text-[11px] text-ink-2",children:"登记属于 L2 操作,需要审批。批准后会再次核验监听身份并登记。"}),x?p.jsx("p",{role:"alert",className:"text-[11px] text-danger",children:x}):null,p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(Se,{variant:"secondary",disabled:_,onClick:()=>{T()},children:"拒绝"}),p.jsx(Se,{disabled:_,onClick:()=>{I()},children:"批准并登记"})]})]}):p.jsxs(p.Fragment,{children:[p.jsxs("label",{className:"block space-y-1",children:[p.jsx("span",{className:"text-[11px] font-medium text-ink-2",children:"运行中的终端"}),p.jsxs("select",{"aria-label":"选择终端",value:l,onChange:D=>u(D.target.value),className:"w-full rounded border border-line bg-surface px-2 py-1.5 text-[12px]",children:[p.jsx("option",{value:"",children:"选择终端"}),R.map(D=>p.jsxs("option",{value:D.id,children:[D.title??D.role??D.id.slice(-6)," ·"," ",D.id.slice(-6)]},D.id))]})]}),p.jsxs("label",{className:"block space-y-1",children:[p.jsx("span",{className:"text-[11px] font-medium text-ink-2",children:"服务名称"}),p.jsx("input",{"aria-label":"服务名称",value:f,maxLength:80,onChange:D=>h(D.target.value),placeholder:"例如 web",className:"w-full rounded border border-line bg-surface px-2 py-1.5 text-[12px]"})]}),p.jsxs("label",{className:"block space-y-1",children:[p.jsx("span",{className:"text-[11px] font-medium text-ink-2",children:"服务端口"}),p.jsx("input",{"aria-label":"服务端口",value:g,inputMode:"numeric",onChange:D=>m(D.target.value.replace(/[^0-9]/g,"")),placeholder:"例如 5173",className:"w-full rounded border border-line bg-surface px-2 py-1.5 font-mono text-[12px]"})]}),p.jsx("p",{className:"text-[10px] text-ink-3",children:"填写所选终端中服务的实际监听端口。0.0.0.0 和 :: 等监听也可登记,无需改绑定或重启。"}),x?p.jsx("p",{role:"alert",className:"text-[11px] text-danger",children:x}):null,p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(Se,{variant:"secondary",disabled:_,onClick:n,children:"取消"}),p.jsx(Se,{disabled:_,onClick:()=>{A()},children:"继续"})]})]})]})})}var ZJ=2,YJ=1,XJ=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(n.getPropertyValue("height")),s=Math.max(0,parseInt(n.getPropertyValue("width"))),a=window.getComputedStyle(this._terminal.element),l={top:parseInt(a.getPropertyValue("padding-top")),bottom:parseInt(a.getPropertyValue("padding-bottom")),right:parseInt(a.getPropertyValue("padding-right")),left:parseInt(a.getPropertyValue("padding-left"))},u=l.top+l.bottom,f=l.right+l.left,h=i-u,g=s-f-t;return{cols:Math.max(ZJ,Math.floor(g/e.css.cell.width)),rows:Math.max(YJ,Math.floor(h/e.css.cell.height))}}};var Z3=Object.defineProperty,QJ=Object.getOwnPropertyDescriptor,JJ=(e,t)=>{for(var n in t)Z3(e,n,{get:t[n],enumerable:!0})},an=(e,t,n,i)=>{for(var s=i>1?void 0:i?QJ(t,n):t,a=e.length-1,l;a>=0;a--)(l=e[a])&&(s=(i?l(t,n,s):l(s))||s);return i&&s&&Z3(t,n,s),s},ke=(e,t)=>(n,i)=>t(n,i,e),PR="Terminal input",ox={get:()=>PR,set:e=>PR=e},LR="Too much output to announce, navigate to rows manually to read",ax={get:()=>LR,set:e=>LR=e};function eee(e){return e.replace(/\r?\n/g,"\r")}function tee(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function nee(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function iee(e,t,n,i){if(e.stopPropagation(),e.clipboardData){let s=e.clipboardData.getData("text/plain");Y3(s,t,n,i)}}function Y3(e,t,n,i){e=eee(e),e=tee(e,n.decPrivateModes.bracketedPasteMode&&i.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function X3(e,t,n){let i=n.getBoundingClientRect(),s=e.clientX-i.left-10,a=e.clientY-i.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${s}px`,t.style.top=`${a}px`,t.style.zIndex="1000",t.focus()}function BR(e,t,n,i,s){X3(e,t,n),s&&i.rightClickSelect(e),t.value=i.selectionText,t.select()}function Xo(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function tg(e,t=0,n=e.length){let i="";for(let s=t;s<n;++s){let a=e[s];a>65535?(a-=65536,i+=String.fromCharCode((a>>10)+55296)+String.fromCharCode(a%1024+56320)):i+=String.fromCharCode(a)}return i}var ree=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let i=0,s=0;if(this._interim){let a=e.charCodeAt(s++);56320<=a&&a<=57343?t[i++]=(this._interim-55296)*1024+a-56320+65536:(t[i++]=this._interim,t[i++]=a),this._interim=0}for(let a=s;a<n;++a){let l=e.charCodeAt(a);if(55296<=l&&l<=56319){if(++a>=n)return this._interim=l,i;let u=e.charCodeAt(a);56320<=u&&u<=57343?t[i++]=(l-55296)*1024+u-56320+65536:(t[i++]=l,t[i++]=u);continue}l!==65279&&(t[i++]=l)}return i}},see=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let i=0,s,a,l,u,f=0,h=0;if(this.interim[0]){let _=!1,b=this.interim[0];b&=(b&224)===192?31:(b&240)===224?15:7;let x=0,S;for(;(S=this.interim[++x]&63)&&x<4;)b<<=6,b|=S;let C=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,k=C-x;for(;h<k;){if(h>=n)return 0;if(S=e[h++],(S&192)!==128){h--,_=!0;break}else this.interim[x++]=S,b<<=6,b|=S&63}_||(C===2?b<128?h--:t[i++]=b:C===3?b<2048||b>=55296&&b<=57343||b===65279||(t[i++]=b):b<65536||b>1114111||(t[i++]=b)),this.interim.fill(0)}let g=n-4,m=h;for(;m<n;){for(;m<g&&!((s=e[m])&128)&&!((a=e[m+1])&128)&&!((l=e[m+2])&128)&&!((u=e[m+3])&128);)t[i++]=s,t[i++]=a,t[i++]=l,t[i++]=u,m+=4;if(s=e[m++],s<128)t[i++]=s;else if((s&224)===192){if(m>=n)return this.interim[0]=s,i;if(a=e[m++],(a&192)!==128){m--;continue}if(f=(s&31)<<6|a&63,f<128){m--;continue}t[i++]=f}else if((s&240)===224){if(m>=n)return this.interim[0]=s,i;if(a=e[m++],(a&192)!==128){m--;continue}if(m>=n)return this.interim[0]=s,this.interim[1]=a,i;if(l=e[m++],(l&192)!==128){m--;continue}if(f=(s&15)<<12|(a&63)<<6|l&63,f<2048||f>=55296&&f<=57343||f===65279)continue;t[i++]=f}else if((s&248)===240){if(m>=n)return this.interim[0]=s,i;if(a=e[m++],(a&192)!==128){m--;continue}if(m>=n)return this.interim[0]=s,this.interim[1]=a,i;if(l=e[m++],(l&192)!==128){m--;continue}if(m>=n)return this.interim[0]=s,this.interim[1]=a,this.interim[2]=l,i;if(u=e[m++],(u&192)!==128){m--;continue}if(f=(s&7)<<18|(a&63)<<12|(l&63)<<6|u&63,f<65536||f>1114111)continue;t[i++]=f}}return i}},Q3="",Jo=" ",th=class J3{constructor(){this.fg=0,this.bg=0,this.extended=new lm}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 J3;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}},lm=class eI{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new eI(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},kr=class tI extends th{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new lm,this.combinedData=""}static fromCharData(t){let n=new tI;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Xo(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let i=t[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=t[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},FR="di$target",lx="di$dependencies",O_=new Map;function oee(e){return e[lx]||[]}function Kn(e){if(O_.has(e))return O_.get(e);let t=function(n,i,s){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");aee(t,n,s)};return t._id=e,O_.set(e,t),t}function aee(e,t,n){t[FR]===t?t[lx].push({id:e,index:n}):(t[lx]=[{id:e,index:n}],t[FR]=t)}var Ci=Kn("BufferService"),nI=Kn("CoreMouseService"),Sl=Kn("CoreService"),lee=Kn("CharsetService"),q1=Kn("InstantiationService"),iI=Kn("LogService"),ki=Kn("OptionsService"),rI=Kn("OscLinkService"),cee=Kn("UnicodeService"),nh=Kn("DecorationService"),cx=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let i=[],s=this._optionsService.rawOptions.linkHandler,a=new kr,l=n.getTrimmedLength(),u=-1,f=-1,h=!1;for(let g=0;g<l;g++)if(!(f===-1&&!n.hasContent(g))){if(n.loadCell(g,a),a.hasExtendedAttrs()&&a.extended.urlId)if(f===-1){f=g,u=a.extended.urlId;continue}else h=a.extended.urlId!==u;else f!==-1&&(h=!0);if(h||f!==-1&&g===l-1){let m=this._oscLinkService.getLinkData(u)?.uri;if(m){let _={start:{x:f+1,y:e},end:{x:g+(!h&&g===l-1?1:0),y:e}},b=!1;if(!s?.allowNonHttpProtocols)try{let x=new URL(m);["http:","https:"].includes(x.protocol)||(b=!0)}catch{b=!0}b||i.push({text:m,range:_,activate:(x,S)=>s?s.activate(x,S,_):uee(x,S),hover:(x,S)=>s?.hover?.(x,S,_),leave:(x,S)=>s?.leave?.(x,S,_)})}h=!1,a.hasExtendedAttrs()&&a.extended.urlId?(f=g,u=a.extended.urlId):(f=-1,u=-1)}}t(i)}};cx=an([ke(0,Ci),ke(1,ki),ke(2,rI)],cx);function uee(e,t){if(confirm(`Do you want to navigate to ${t}?
112
-
113
- WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var ng=Kn("CharSizeService"),fo=Kn("CoreBrowserService"),W1=Kn("MouseService"),po=Kn("RenderService"),dee=Kn("SelectionService"),sI=Kn("CharacterJoinerService"),iu=Kn("ThemeService"),oI=Kn("LinkProviderService"),hee=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?UR.isErrorNoTelemetry(e)?new UR(e.message+`
114
-
115
- `+e.stack):new Error(e.message+`
116
-
117
- `+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)}},fee=new hee;function zp(e){pee(e)||fee.onUnexpectedError(e)}var ux="Canceled";function pee(e){return e instanceof mee?!0:e instanceof Error&&e.name===ux&&e.message===ux}var mee=class extends Error{constructor(){super(ux),this.name=this.message}};function gee(e){return new Error(`Illegal argument: ${e}`)}var UR=class dx extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof dx)return t;let n=new dx;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},hx=class aI extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,aI.prototype)}};function Xi(e,t=0){return e[e.length-(1+t)]}var vee;(e=>{function t(a){return a<0}e.isLessThan=t;function n(a){return a<=0}e.isLessThanOrEqual=n;function i(a){return a>0}e.isGreaterThan=i;function s(a){return a===0}e.isNeitherLessOrGreaterThan=s,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(vee||={});function yee(e,t){let n=this,i=!1,s;return function(){return i||(i=!0,t||(s=e.apply(n,arguments))),s}}var lI;(e=>{function t(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function i(){return n}e.empty=i;function*s(A){yield A}e.single=s;function a(A){return t(A)?A:s(A)}e.wrap=a;function l(A){return A||n}e.from=l;function*u(A){for(let I=A.length-1;I>=0;I--)yield A[I]}e.reverse=u;function f(A){return!A||A[Symbol.iterator]().next().done===!0}e.isEmpty=f;function h(A){return A[Symbol.iterator]().next().value}e.first=h;function g(A,I){let T=0;for(let D of A)if(I(D,T++))return!0;return!1}e.some=g;function m(A,I){for(let T of A)if(I(T))return T}e.find=m;function*_(A,I){for(let T of A)I(T)&&(yield T)}e.filter=_;function*b(A,I){let T=0;for(let D of A)yield I(D,T++)}e.map=b;function*x(A,I){let T=0;for(let D of A)yield*I(D,T++)}e.flatMap=x;function*S(...A){for(let I of A)yield*I}e.concat=S;function C(A,I,T){let D=T;for(let L of A)D=I(D,L);return D}e.reduce=C;function*k(A,I,T=A.length){for(I<0&&(I+=A.length),T<0?T+=A.length:T>A.length&&(T=A.length);I<T;I++)yield A[I]}e.slice=k;function R(A,I=Number.POSITIVE_INFINITY){let T=[];if(I===0)return[T,A];let D=A[Symbol.iterator]();for(let L=0;L<I;L++){let ee=D.next();if(ee.done)return[T,e.empty()];T.push(ee.value)}return[T,{[Symbol.iterator](){return D}}]}e.consume=R;async function N(A){let I=[];for await(let T of A)I.push(T);return Promise.resolve(I)}e.asyncToArray=N})(lI||={});function fl(e){if(lI.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(i){t.push(i)}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 _ee(...e){return Vt(()=>fl(e))}function Vt(e){return{dispose:yee(()=>{e()})}}var cI=class uI{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{fl(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?uI.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)}};cI.DISABLE_DISPOSED_WARNING=!1;var ia=cI,ot=class{constructor(){this._store=new ia,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)}};ot.None=Object.freeze({dispose(){}});var qc=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e}},Js=typeof window=="object"?window:globalThis,fx=class px{constructor(t){this.element=t,this.next=px.Undefined,this.prev=px.Undefined}};fx.Undefined=new fx(void 0);var Yt=fx,HR=class{constructor(){this._first=Yt.Undefined,this._last=Yt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Yt.Undefined}clear(){let e=this._first;for(;e!==Yt.Undefined;){let t=e.next;e.prev=Yt.Undefined,e.next=Yt.Undefined,e=t}this._first=Yt.Undefined,this._last=Yt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Yt(e);if(this._first===Yt.Undefined)this._first=n,this._last=n;else if(t){let s=this._last;this._last=n,n.prev=s,s.next=n}else{let s=this._first;this._first=n,n.next=s,s.prev=n}this._size+=1;let i=!1;return()=>{i||(i=!0,this._remove(n))}}shift(){if(this._first!==Yt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Yt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Yt.Undefined&&e.next!==Yt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Yt.Undefined&&e.next===Yt.Undefined?(this._first=Yt.Undefined,this._last=Yt.Undefined):e.next===Yt.Undefined?(this._last=this._last.prev,this._last.next=Yt.Undefined):e.prev===Yt.Undefined&&(this._first=this._first.next,this._first.prev=Yt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Yt.Undefined;)yield e.element,e=e.next}},bee=globalThis.performance&&typeof globalThis.performance.now=="function",xee=class dI{static create(t){return new dI(t)}constructor(t){this._now=bee&&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}},ni;(e=>{e.None=()=>ot.None;function t(B,W){return m(B,()=>{},0,void 0,!0,void 0,W)}e.defer=t;function n(B){return(W,te=null,G)=>{let P=!1,Z;return Z=B($=>{if(!P)return Z?Z.dispose():P=!0,W.call(te,$)},null,G),P&&Z.dispose(),Z}}e.once=n;function i(B,W,te){return h((G,P=null,Z)=>B($=>G.call(P,W($)),null,Z),te)}e.map=i;function s(B,W,te){return h((G,P=null,Z)=>B($=>{W($),G.call(P,$)},null,Z),te)}e.forEach=s;function a(B,W,te){return h((G,P=null,Z)=>B($=>W($)&&G.call(P,$),null,Z),te)}e.filter=a;function l(B){return B}e.signal=l;function u(...B){return(W,te=null,G)=>{let P=_ee(...B.map(Z=>Z($=>W.call(te,$))));return g(P,G)}}e.any=u;function f(B,W,te,G){let P=te;return i(B,Z=>(P=W(P,Z),P),G)}e.reduce=f;function h(B,W){let te,G={onWillAddFirstListener(){te=B(P.fire,P)},onDidRemoveLastListener(){te?.dispose()}},P=new be(G);return W?.add(P),P.event}function g(B,W){return W instanceof Array?W.push(B):W&&W.add(B),B}function m(B,W,te=100,G=!1,P=!1,Z,$){let ae,j,_e,Le=0,z,M={leakWarningThreshold:Z,onWillAddFirstListener(){ae=B(ne=>{Le++,j=W(j,ne),G&&!_e&&(K.fire(j),j=void 0),z=()=>{let me=j;j=void 0,_e=void 0,(!G||Le>1)&&K.fire(me),Le=0},typeof te=="number"?(clearTimeout(_e),_e=setTimeout(z,te)):_e===void 0&&(_e=0,queueMicrotask(z))})},onWillRemoveListener(){P&&Le>0&&z?.()},onDidRemoveLastListener(){z=void 0,ae.dispose()}},K=new be(M);return $?.add(K),K.event}e.debounce=m;function _(B,W=0,te){return e.debounce(B,(G,P)=>G?(G.push(P),G):[P],W,void 0,!0,void 0,te)}e.accumulate=_;function b(B,W=(G,P)=>G===P,te){let G=!0,P;return a(B,Z=>{let $=G||!W(Z,P);return G=!1,P=Z,$},te)}e.latch=b;function x(B,W,te){return[e.filter(B,W,te),e.filter(B,G=>!W(G),te)]}e.split=x;function S(B,W=!1,te=[],G){let P=te.slice(),Z=B(j=>{P?P.push(j):ae.fire(j)});G&&G.add(Z);let $=()=>{P?.forEach(j=>ae.fire(j)),P=null},ae=new be({onWillAddFirstListener(){Z||(Z=B(j=>ae.fire(j)),G&&G.add(Z))},onDidAddFirstListener(){P&&(W?setTimeout($):$())},onDidRemoveLastListener(){Z&&Z.dispose(),Z=null}});return G&&G.add(ae),ae.event}e.buffer=S;function C(B,W){return(te,G,P)=>{let Z=W(new R);return B(function($){let ae=Z.evaluate($);ae!==k&&te.call(G,ae)},void 0,P)}}e.chain=C;let k=Symbol("HaltChainable");class R{constructor(){this.steps=[]}map(W){return this.steps.push(W),this}forEach(W){return this.steps.push(te=>(W(te),te)),this}filter(W){return this.steps.push(te=>W(te)?te:k),this}reduce(W,te){let G=te;return this.steps.push(P=>(G=W(G,P),G)),this}latch(W=(te,G)=>te===G){let te=!0,G;return this.steps.push(P=>{let Z=te||!W(P,G);return te=!1,G=P,Z?P:k}),this}evaluate(W){for(let te of this.steps)if(W=te(W),W===k)break;return W}}function N(B,W,te=G=>G){let G=(...ae)=>$.fire(te(...ae)),P=()=>B.on(W,G),Z=()=>B.removeListener(W,G),$=new be({onWillAddFirstListener:P,onDidRemoveLastListener:Z});return $.event}e.fromNodeEventEmitter=N;function A(B,W,te=G=>G){let G=(...ae)=>$.fire(te(...ae)),P=()=>B.addEventListener(W,G),Z=()=>B.removeEventListener(W,G),$=new be({onWillAddFirstListener:P,onDidRemoveLastListener:Z});return $.event}e.fromDOMEventEmitter=A;function I(B){return new Promise(W=>n(B)(W))}e.toPromise=I;function T(B){let W=new be;return B.then(te=>{W.fire(te)},()=>{W.fire(void 0)}).finally(()=>{W.dispose()}),W.event}e.fromPromise=T;function D(B,W){return B(te=>W.fire(te))}e.forward=D;function L(B,W,te){return W(te),B(G=>W(G))}e.runAndSubscribe=L;class ee{constructor(W,te){this._observable=W,this._counter=0,this._hasChanged=!1;let G={onWillAddFirstListener:()=>{W.addObserver(this)},onDidRemoveLastListener:()=>{W.removeObserver(this)}};this.emitter=new be(G),te&&te.add(this.emitter)}beginUpdate(W){this._counter++}handlePossibleChange(W){}handleChange(W,te){this._hasChanged=!0}endUpdate(W){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function U(B,W){return new ee(B,W).emitter.event}e.fromObservable=U;function F(B){return(W,te,G)=>{let P=0,Z=!1,$={beginUpdate(){P++},endUpdate(){P--,P===0&&(B.reportChanges(),Z&&(Z=!1,W.call(te)))},handlePossibleChange(){},handleChange(){Z=!0}};B.addObserver($),B.reportChanges();let ae={dispose(){B.removeObserver($)}};return G instanceof ia?G.add(ae):Array.isArray(G)&&G.push(ae),ae}}e.fromObservableLight=F})(ni||={});var mx=class gx{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${gx._idPool++}`,gx.all.add(this)}start(t){this._stopWatch=new xee,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}}};mx.all=new Set,mx._idPool=0;var See=mx,wee=-1,hI=class fI{constructor(t,n,i=(fI._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(t,n){let i=this.threshold;if(i<=0||n<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;let[a,l]=this.getMostFrequentStack(),u=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${l}):`;console.warn(u),console.warn(a);let f=new Eee(u,a);this._errorHandler(f)}return()=>{let a=this._stacks.get(t.value)||0;this._stacks.set(t.value,a-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[i,s]of this._stacks)(!t||n<s)&&(t=[i,s],n=s);return t}};hI._idPool=1;var Cee=hI,kee=class pI{constructor(t){this.value=t}static create(){let t=new Error;return new pI(t.stack??"")}print(){console.warn(this.value.split(`
118
- `).slice(2).join(`
119
- `))}},Eee=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},Nee=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},Ree=0,j_=class{constructor(e){this.value=e,this.id=Ree++}},Tee=2,Dee,be=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new Cee(e?.onListenerError??zp,this._options?.leakWarningThreshold??wee):void 0,this._perfMon=this._options?._profName?new See(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let l=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(l);let u=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],f=new Nee(`${l}. HINT: Stack shows most frequent listener (${u[1]}-times)`,u[0]);return(this._options?.onListenerError||zp)(f),ot.None}if(this._disposed)return ot.None;t&&(e=e.bind(t));let i=new j_(e),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=kee.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof j_?(this._deliveryQueue??=new Aee,this._listeners=[this._listeners,i]):this._listeners.push(i):(this._options?.onWillAddFirstListener?.(this),this._listeners=i,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=Vt(()=>{s?.(),this._removeListener(i)});return n instanceof ia?n.add(a):Array.isArray(n)&&n.push(a),a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[n]=void 0;let i=this._deliveryQueue.current===this;if(this._size*Tee<=t.length){let s=0;for(let a=0;a<t.length;a++)t[a]?t[s++]=t[a]:i&&(this._deliveryQueue.end--,s<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=s}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||zp;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof j_)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},Aee=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},vx=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new be,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new be,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(i,t),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let i=this.getWindowId(n);this.mapWindowIdToFullScreen.set(i,t),this._onDidChangeFullscreen.fire(i)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};vx.INSTANCE=new vx;var K1=vx;function Oee(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}K1.INSTANCE.onDidChangeZoomLevel;function jee(e){return K1.INSTANCE.getZoomFactor(e)}K1.INSTANCE.onDidChangeFullscreen;var ru=typeof navigator=="object"?navigator.userAgent:"",yx=ru.indexOf("Firefox")>=0,zee=ru.indexOf("AppleWebKit")>=0,V1=ru.indexOf("Chrome")>=0,Mee=!V1&&ru.indexOf("Safari")>=0;ru.indexOf("Electron/")>=0;ru.indexOf("Android")>=0;var z_=!1;if(typeof Js.matchMedia=="function"){let e=Js.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=Js.matchMedia("(display-mode: fullscreen)");z_=e.matches,Oee(Js,e,({matches:n})=>{z_&&t.matches||(z_=n)})}var kc="en",_x=!1,bx=!1,Mp=!1,mI=!1,cp,Ip=kc,$R=kc,Iee,Ys,sl=globalThis,tr;typeof sl.vscode<"u"&&typeof sl.vscode.process<"u"?tr=sl.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(tr=process);var Pee=typeof tr?.versions?.electron=="string",Lee=Pee&&tr?.type==="renderer";if(typeof tr=="object"){_x=tr.platform==="win32",bx=tr.platform==="darwin",Mp=tr.platform==="linux",Mp&&tr.env.SNAP&&tr.env.SNAP_REVISION,tr.env.CI||tr.env.BUILD_ARTIFACTSTAGINGDIRECTORY,cp=kc,Ip=kc;let e=tr.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);cp=t.userLocale,$R=t.osLocale,Ip=t.resolvedLanguage||kc,Iee=t.languagePack?.translationsConfigFile}catch{}mI=!0}else typeof navigator=="object"&&!Lee?(Ys=navigator.userAgent,_x=Ys.indexOf("Windows")>=0,bx=Ys.indexOf("Macintosh")>=0,(Ys.indexOf("Macintosh")>=0||Ys.indexOf("iPad")>=0||Ys.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Mp=Ys.indexOf("Linux")>=0,Ys?.indexOf("Mobi")>=0,Ip=globalThis._VSCODE_NLS_LANGUAGE||kc,cp=navigator.language.toLowerCase(),$R=cp):console.error("Unable to resolve platform.");var gI=_x,ys=bx,Bee=Mp,qR=mI,ks=Ys,Ko=Ip,Fee;(e=>{function t(){return Ko}e.value=t;function n(){return Ko.length===2?Ko==="en":Ko.length>=3?Ko[0]==="e"&&Ko[1]==="n"&&Ko[2]==="-":!1}e.isDefaultVariant=n;function i(){return Ko==="en"}e.isDefault=i})(Fee||={});var Uee=typeof sl.postMessage=="function"&&!sl.importScripts;(()=>{if(Uee){let e=[];sl.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let a=e[i];if(a.id===n.data.vscodeScheduleAsyncWork){e.splice(i,1),a.callback();return}}});let t=0;return n=>{let i=++t;e.push({id:i,callback:n}),sl.postMessage({vscodeScheduleAsyncWork:i},"*")}}return e=>setTimeout(e)})();var Hee=!!(ks&&ks.indexOf("Chrome")>=0);ks&&ks.indexOf("Firefox")>=0;!Hee&&ks&&ks.indexOf("Safari")>=0;ks&&ks.indexOf("Edg/")>=0;ks&&ks.indexOf("Android")>=0;var yc=typeof navigator=="object"?navigator:{};qR||document.queryCommandSupported&&document.queryCommandSupported("copy")||yc&&yc.clipboard&&yc.clipboard.writeText,qR||yc&&yc.clipboard&&yc.clipboard.readText;var G1=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}},M_=new G1,WR=new G1,KR=new G1,$ee=new Array(230),vI;(e=>{function t(u){return M_.keyCodeToStr(u)}e.toString=t;function n(u){return M_.strToKeyCode(u)}e.fromString=n;function i(u){return WR.keyCodeToStr(u)}e.toUserSettingsUS=i;function s(u){return KR.keyCodeToStr(u)}e.toUserSettingsGeneral=s;function a(u){return WR.strToKeyCode(u)||KR.strToKeyCode(u)}e.fromUserSettings=a;function l(u){if(u>=98&&u<=113)return null;switch(u){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return M_.keyCodeToStr(u)}e.toElectronAccelerator=l})(vI||={});var qee=class yI{constructor(t,n,i,s,a){this.ctrlKey=t,this.shiftKey=n,this.altKey=i,this.metaKey=s,this.keyCode=a}equals(t){return t instanceof yI&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",i=this.altKey?"1":"0",s=this.metaKey?"1":"0";return`K${t}${n}${i}${s}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new Wee([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},Wee=class{constructor(e){if(e.length===0)throw gee("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function Kee(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return vI.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(yx)switch(t){case 59:return 85;case 60:if(Bee)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ys)return 57;break}else if(zee&&(ys&&t===93||!ys&&t===92))return 57;return $ee[t]||0}var Vee=ys?256:2048,Gee=512,Zee=1024,Yee=ys?2048:256,VR=class{constructor(e){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=t.getModifierState?.("AltGraph"),this.keyCode=Kee(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|=Vee),this.altKey&&(t|=Gee),this.shiftKey&&(t|=Zee),this.metaKey&&(t|=Yee),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new qee(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},GR=new WeakMap;function Xee(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var Qee=class{static getSameOriginWindowChain(e){let t=GR.get(e);if(!t){t=[],GR.set(e,t);let n=e,i;do i=Xee(n),i?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=i;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,i=0,s=this.getSameOriginWindowChain(e);for(let a of s){let l=a.window.deref();if(n+=l?.scrollY??0,i+=l?.scrollX??0,l===t||!a.iframeElement)break;let u=a.iframeElement.getBoundingClientRect();n+=u.top,i+=u.left}return{top:n,left:i}}},up=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=Qee.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},ZR=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let i=!1;if(V1){let s=navigator.userAgent.match(/Chrome\/(\d+)/);i=(s?parseInt(s[1]):123)<=122}if(e){let s=e,a=e,l=e.view?.devicePixelRatio||1;if(typeof s.wheelDeltaY<"u")i?this.deltaY=s.wheelDeltaY/(120*l):this.deltaY=s.wheelDeltaY/120;else if(typeof a.VERTICAL_AXIS<"u"&&a.axis===a.VERTICAL_AXIS)this.deltaY=-a.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?yx&&!ys?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")Mee&&gI?this.deltaX=-(s.wheelDeltaX/120):i?this.deltaX=s.wheelDeltaX/(120*l):this.deltaX=s.wheelDeltaX/120;else if(typeof a.HORIZONTAL_AXIS<"u"&&a.axis===a.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?yx&&!ys?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(i?this.deltaY=e.wheelDelta/(120*l):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},_I=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),Jee;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof ete?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ni.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:_I})})(Jee||={});var ete=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?_I:(this._emitter||(this._emitter=new be),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Z1=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 hx("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new hx("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},tte=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new hx("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let i=n.setInterval(()=>{e()},t);this.disposable=Vt(()=>{n.clearInterval(i),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},nte;(e=>{async function t(i){let s,a=await Promise.all(i.map(l=>l.then(u=>u,u=>{s||(s=u)})));if(typeof s<"u")throw s;return a}e.settled=t;function n(i){return new Promise(async(s,a)=>{try{await i(s,a)}catch(l){a(l)}})}e.withAsyncBody=n})(nte||={});var YR=class br{static fromArray(t){return new br(n=>{n.emitMany(t)})}static fromPromise(t){return new br(async n=>{n.emitMany(await t)})}static fromPromises(t){return new br(async n=>{await Promise.all(t.map(async i=>n.emitOne(await i)))})}static merge(t){return new br(async n=>{await Promise.all(t.map(async i=>{for await(let s of i)n.emitOne(s)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new be,queueMicrotask(async()=>{let i={emitOne:s=>this.emitOne(s),emitMany:s=>this.emitMany(s),reject:s=>this.reject(s)};try{await Promise.resolve(t(i)),this.resolve()}catch(s){this.reject(s)}finally{i.emitOne=void 0,i.emitMany=void 0,i.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 ni.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new br(async i=>{for await(let s of t)i.emitOne(n(s))})}map(t){return br.map(this,t)}static filter(t,n){return new br(async i=>{for await(let s of t)n(s)&&i.emitOne(s)})}filter(t){return br.filter(this,t)}static coalesce(t){return br.filter(t,n=>!!n)}coalesce(){return br.coalesce(this)}static async toPromise(t){let n=[];for await(let i of t)n.push(i);return n}toPromise(){return br.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())}};YR.EMPTY=YR.fromArray([]);var{getWindow:vs,getWindowId:ite,onDidRegisterWindow:rte}=(function(){let e=new Map,t={window:Js,disposables:new ia};e.set(Js.vscodeWindowId,t);let n=new be,i=new be,s=new be;function a(l,u){return(typeof l=="number"?e.get(l):void 0)??(u?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:s.event,onDidUnregisterWindow:i.event,registerWindow(l){if(e.has(l.vscodeWindowId))return ot.None;let u=new ia,f={window:l,disposables:u.add(new ia)};return e.set(l.vscodeWindowId,f),u.add(Vt(()=>{e.delete(l.vscodeWindowId),i.fire(l)})),u.add($e(l,Fn.BEFORE_UNLOAD,()=>{s.fire(l)})),n.fire(f),u},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(l){return l.vscodeWindowId},hasWindow(l){return e.has(l)},getWindowById:a,getWindow(l){let u=l;if(u?.ownerDocument?.defaultView)return u.ownerDocument.defaultView.window;let f=l;return f?.view?f.view.window:Js},getDocument(l){return vs(l).document}}})(),ste=class{constructor(e,t,n,i){this._node=e,this._type=t,this._handler=n,this._options=i||!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 $e(e,t,n,i){return new ste(e,t,n,i)}var XR=function(e,t,n,i){return $e(e,t,n,i)},Y1,ote=class extends tte{constructor(e){super(),this.defaultTarget=e&&vs(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},QR=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){zp(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,i=new Map,s=a=>{n.set(a,!1);let l=e.get(a)??[];for(t.set(a,l),e.set(a,[]),i.set(a,!0);l.length>0;)l.sort(QR.sort),l.shift().execute();i.set(a,!1)};Y1=(a,l,u=0)=>{let f=ite(a),h=new QR(l,u),g=e.get(f);return g||(g=[],e.set(f,g)),g.push(h),n.get(f)||(n.set(f,!0),a.requestAnimationFrame(()=>s(f))),h}})();function ate(e){let t=e.getBoundingClientRect(),n=vs(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var Fn={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"},lte=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=ji(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=ji(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=ji(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=ji(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=ji(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=ji(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=ji(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=ji(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=ji(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=ji(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=ji(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=ji(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=ji(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=ji(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 ji(e){return typeof e=="number"?`${e}px`:e}function Od(e){return new lte(e)}var bI=class{constructor(){this._hooks=new ia,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,i,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=i,this._onStopCallback=s;let a=e;try{e.setPointerCapture(t),this._hooks.add(Vt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=vs(e)}this._hooks.add($e(a,Fn.POINTER_MOVE,l=>{if(l.buttons!==n){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add($e(a,Fn.POINTER_UP,l=>this.stopMonitoring(!0)))}};function cte(e,t,n){let i=null,s=null;if(typeof n.value=="function"?(i="value",s=n.value,s.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(i="get",s=n.get),!s)throw new Error("not supported");let a=`$memoize$${t}`;n[i]=function(...l){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:s.apply(this,l)}),this[a]}}var ls;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ls||={});var Sd=class ai extends ot{constructor(){super(),this.dispatched=!1,this.targets=new HR,this.ignoreTargets=new HR,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ni.runAndSubscribe(rte,({window:t,disposables:n})=>{n.add($e(t.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),n.add($e(t.document,"touchend",i=>this.onTouchEnd(t,i))),n.add($e(t.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:Js,disposables:this._store}))}static addTarget(t){if(!ai.isTouchDevice())return ot.None;ai.INSTANCE||(ai.INSTANCE=new ai);let n=ai.INSTANCE.targets.push(t);return Vt(n)}static ignoreTarget(t){if(!ai.isTouchDevice())return ot.None;ai.INSTANCE||(ai.INSTANCE=new ai);let n=ai.INSTANCE.ignoreTargets.push(t);return Vt(n)}static isTouchDevice(){return"ontouchstart"in Js||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,s=t.targetTouches.length;i<s;i++){let a=t.targetTouches.item(i);this.activeTouches[a.identifier]={id:a.identifier,initialTarget:a.target,initialTimeStamp:n,initialPageX:a.pageX,initialPageY:a.pageY,rollingTimestamps:[n],rollingPageX:[a.pageX],rollingPageY:[a.pageY]};let l=this.newGestureEvent(ls.Start,a.target);l.pageX=a.pageX,l.pageY=a.pageY,this.dispatchEvent(l)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let i=Date.now(),s=Object.keys(this.activeTouches).length;for(let a=0,l=n.changedTouches.length;a<l;a++){let u=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(u.identifier))){console.warn("move of an UNKNOWN touch",u);continue}let f=this.activeTouches[u.identifier],h=Date.now()-f.initialTimeStamp;if(h<ai.HOLD_DELAY&&Math.abs(f.initialPageX-Xi(f.rollingPageX))<30&&Math.abs(f.initialPageY-Xi(f.rollingPageY))<30){let g=this.newGestureEvent(ls.Tap,f.initialTarget);g.pageX=Xi(f.rollingPageX),g.pageY=Xi(f.rollingPageY),this.dispatchEvent(g)}else if(h>=ai.HOLD_DELAY&&Math.abs(f.initialPageX-Xi(f.rollingPageX))<30&&Math.abs(f.initialPageY-Xi(f.rollingPageY))<30){let g=this.newGestureEvent(ls.Contextmenu,f.initialTarget);g.pageX=Xi(f.rollingPageX),g.pageY=Xi(f.rollingPageY),this.dispatchEvent(g)}else if(s===1){let g=Xi(f.rollingPageX),m=Xi(f.rollingPageY),_=Xi(f.rollingTimestamps)-f.rollingTimestamps[0],b=g-f.rollingPageX[0],x=m-f.rollingPageY[0],S=[...this.targets].filter(C=>f.initialTarget instanceof Node&&C.contains(f.initialTarget));this.inertia(t,S,i,Math.abs(b)/_,b>0?1:-1,g,Math.abs(x)/_,x>0?1:-1,m)}this.dispatchEvent(this.newGestureEvent(ls.End,f.initialTarget)),delete this.activeTouches[u.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let i=document.createEvent("CustomEvent");return i.initEvent(t,!1,!0),i.initialTarget=n,i.tapCount=0,i}dispatchEvent(t){if(t.type===ls.Tap){let n=new Date().getTime(),i=0;n-this._lastSetTapCountTime>ai.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=n,t.tapCount=i}else(t.type===ls.Change||t.type===ls.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let i of this.ignoreTargets)if(i.contains(t.initialTarget))return;let n=[];for(let i of this.targets)if(i.contains(t.initialTarget)){let s=0,a=t.initialTarget;for(;a&&a!==i;)s++,a=a.parentElement;n.push([s,i])}n.sort((i,s)=>i[0]-s[0]);for(let[i,s]of n)s.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,i,s,a,l,u,f,h){this.handle=Y1(t,()=>{let g=Date.now(),m=g-i,_=0,b=0,x=!0;s+=ai.SCROLL_FRICTION*m,u+=ai.SCROLL_FRICTION*m,s>0&&(x=!1,_=a*s*m),u>0&&(x=!1,b=f*u*m);let S=this.newGestureEvent(ls.Change);S.translationX=_,S.translationY=b,n.forEach(C=>C.dispatchEvent(S)),x||this.inertia(t,n,g,s,a,l+_,u,f,h+b)})}onTouchMove(t){let n=Date.now();for(let i=0,s=t.changedTouches.length;i<s;i++){let a=t.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("end of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],u=this.newGestureEvent(ls.Change,l.initialTarget);u.translationX=a.pageX-Xi(l.rollingPageX),u.translationY=a.pageY-Xi(l.rollingPageY),u.pageX=a.pageX,u.pageY=a.pageY,this.dispatchEvent(u),l.rollingPageX.length>3&&(l.rollingPageX.shift(),l.rollingPageY.shift(),l.rollingTimestamps.shift()),l.rollingPageX.push(a.pageX),l.rollingPageY.push(a.pageY),l.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Sd.SCROLL_FRICTION=-.005,Sd.HOLD_DELAY=700,Sd.CLEAR_TAP_COUNT_TIME=400,an([cte],Sd,"isTouchDevice",1);var ute=Sd,X1=class extends ot{onclick(e,t){this._register($e(e,Fn.CLICK,n=>t(new up(vs(e),n))))}onmousedown(e,t){this._register($e(e,Fn.MOUSE_DOWN,n=>t(new up(vs(e),n))))}onmouseover(e,t){this._register($e(e,Fn.MOUSE_OVER,n=>t(new up(vs(e),n))))}onmouseleave(e,t){this._register($e(e,Fn.MOUSE_LEAVE,n=>t(new up(vs(e),n))))}onkeydown(e,t){this._register($e(e,Fn.KEY_DOWN,n=>t(new VR(n))))}onkeyup(e,t){this._register($e(e,Fn.KEY_UP,n=>t(new VR(n))))}oninput(e,t){this._register($e(e,Fn.INPUT,t))}onblur(e,t){this._register($e(e,Fn.BLUR,t))}onfocus(e,t){this._register($e(e,Fn.FOCUS,t))}onchange(e,t){this._register($e(e,Fn.CHANGE,t))}ignoreGesture(e){return ute.ignoreTarget(e)}},JR=11,dte=class extends X1{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=JR+"px",this.domNode.style.height=JR+"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 bI),this._register(XR(this.bgDomNode,Fn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(XR(this.domNode,Fn.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new ote),this._pointerdownScheduleRepeatTimer=this._register(new Z1)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,vs(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},hte=class xx{constructor(t,n,i,s,a,l,u){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,i=i|0,s=s|0,a=a|0,l=l|0,u=u|0),this.rawScrollLeft=s,this.rawScrollTop=u,n<0&&(n=0),s+n>i&&(s=i-n),s<0&&(s=0),a<0&&(a=0),u+a>l&&(u=l-a),u<0&&(u=0),this.width=n,this.scrollWidth=i,this.scrollLeft=s,this.height=a,this.scrollHeight=l,this.scrollTop=u}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new xx(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new xx(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let i=this.width!==t.width,s=this.scrollWidth!==t.scrollWidth,a=this.scrollLeft!==t.scrollLeft,l=this.height!==t.height,u=this.scrollHeight!==t.scrollHeight,f=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:s,scrollLeftChanged:a,heightChanged:l,scrollHeightChanged:u,scrollTopChanged:f}}},fte=class extends ot{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new hte(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){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let i;t?i=new tT(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):i=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=i}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=tT.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},eT=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function I_(e,t){let n=t-e;return function(i){return e+n*gte(i)}}function pte(e,t,n){return function(i){return i<n?e(i/n):t((i-n)/(1-n))}}var tT=class Sx{constructor(t,n,i,s){this.from=t,this.to=n,this.duration=s,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,i){if(Math.abs(t-n)>2.5*i){let s,a;return t<n?(s=t+.75*i,a=n-.75*i):(s=t-.75*i,a=n+.75*i),pte(I_(t,s),I_(a,n),.33)}return I_(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let i=this.scrollLeft(n),s=this.scrollTop(n);return new eT(i,s,!1)}return new eT(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,i){return Sx.start(t,n,i)}static start(t,n,i){i=i+10;let s=Date.now()-10;return new Sx(t,n,s,i)}};function mte(e){return Math.pow(e,3)}function gte(e){return 1-mte(1-e)}var vte=class extends ot{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Z1)}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(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}},yte=140,xI=class extends X1{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 vte(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new bI),this._shouldRender=!0,this.domNode=Od(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($e(this.domNode.domNode,Fn.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new dte(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,i){this.slider=Od(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof i=="number"&&this.slider.setHeight(i),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register($e(this.slider.domNode,Fn.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),i=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);n<=s&&s<=i?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let s=ate(this.domNode.domNode);t=e.pageX-s.left,n=e.pageY-s.top}let i=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(i):this._scrollbarState.getDesiredScrollPositionFromOffset(i)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),i=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,s=>{let a=this._sliderOrthogonalPointerPosition(s),l=Math.abs(a-n);if(gI&&l>yte){this._setDesiredScrollPositionNow(i.getScrollPosition());return}let u=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(i.getDesiredScrollPositionFromDelta(u))},()=>{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()}},SI=class wx{constructor(t,n,i,s,a,l){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(t),this._visibleSize=s,this._scrollSize=a,this._scrollPosition=l,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new wx(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,i,s,a){let l=Math.max(0,i-t),u=Math.max(0,l-2*n),f=s>0&&s>i;if(!f)return{computedAvailableSize:Math.round(l),computedIsNeeded:f,computedSliderSize:Math.round(u),computedSliderRatio:0,computedSliderPosition:0};let h=Math.round(Math.max(20,Math.floor(i*u/s))),g=(u-h)/(s-i),m=a*g;return{computedAvailableSize:Math.round(l),computedIsNeeded:f,computedSliderSize:Math.round(h),computedSliderRatio:g,computedSliderPosition:Math.round(m)}}_refreshComputedValues(){let t=wx._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,i=this._scrollPosition;return n<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},_te=class extends xI{constructor(e,t,n){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new SI(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,i.width,i.scrollWidth,s.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}},bte=class extends xI{constructor(e,t,n){let i=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new SI(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,i.height,i.scrollHeight,s.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}},xte=500,nT=50,Ste=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Cx=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,i=1,s=this._rear;do{let a=s===this._front?t:Math.pow(2,-i);if(t-=a,n+=this._memory[s].score*a,s===this._front)break;s=(this._capacity+s-1)%this._capacity,i++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(V1){let n=vs(t.browserEvent),i=jee(n);this.accept(Date.now(),t.deltaX*i,t.deltaY*i)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,i){let s=null,a=new Ste(t,n,i);this._front===-1&&this._rear===-1?(this._memory[0]=a,this._front=0,this._rear=0):(s=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,s)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(i+=.25),n){let s=Math.abs(t.deltaX),a=Math.abs(t.deltaY),l=Math.abs(n.deltaX),u=Math.abs(n.deltaY),f=Math.max(Math.min(s,l),1),h=Math.max(Math.min(a,u),1),g=Math.max(s,l),m=Math.max(a,u);g%f===0&&m%h===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Cx.INSTANCE=new Cx;var wte=Cx,Cte=class extends X1{constructor(e,t,n){super(),this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new be),this.onWillScroll=this._onWillScroll.event,this._options=Ete(t),this._scrollable=n,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));let i={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new bte(this._scrollable,this._options,i)),this._horizontalScrollbar=this._register(new _te(this._scrollable,this._options,i)),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=Od(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Od(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Od(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,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new Z1),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=fl(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,ys&&(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 ZR(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=fl(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new ZR(n))};this._mouseWheelToDispose.push($e(this._listenOnDomNode,Fn.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=wte.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,a=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&a+s===0?a=s=0:Math.abs(s)>=Math.abs(a)?a=0:s=0),this._options.flipAxes&&([s,a]=[a,s]);let l=!ys&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!a&&(a=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(a=a*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let u=this._scrollable.getFutureScrollPosition(),f={};if(s){let h=nT*s,g=u.scrollTop-(h<0?Math.floor(h):Math.ceil(h));this._verticalScrollbar.writeScrollPosition(f,g)}if(a){let h=nT*a,g=u.scrollLeft-(h<0?Math.floor(h):Math.ceil(h));this._horizontalScrollbar.writeScrollPosition(f,g)}f=this._scrollable.validateScrollPosition(f),(u.scrollLeft!==f.scrollLeft||u.scrollTop!==f.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(f):this._scrollable.setScrollPositionNow(f),n=!0)}let i=n;!i&&this._options.alwaysConsumeMouseWheel&&(i=!0),!i&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(i=!0),i&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,i=n?" left":"",s=t?" top":"",a=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${i}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${s}${i}`)}}_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(),xte)}},kte=class extends Cte{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Ete(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,ys&&(t.className+=" mac"),t}var kx=class extends ot{constructor(e,t,n,i,s,a,l,u){super(),this._bufferService=n,this._optionsService=l,this._renderService=u,this._onRequestScrollLines=this._register(new be),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let f=this._register(new fte({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:h=>Y1(i.window,h)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{f.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new kte(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},f)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(s.onProtocolChange(h=>{this._scrollableElement.updateOptions({handleMouseWheel:!(h&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(ni.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(Vt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=i.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(Vt(()=>this._styleElement.remove())),this._register(ni.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(`
120
- `)})),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(h=>this._handleScroll(h)))}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(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};kx=an([ke(2,Ci),ke(3,fo),ke(4,nI),ke(5,iu),ke(6,ki),ke(7,po)],kx);var Ex=class extends ot{constructor(e,t,n,i,s){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=i,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(a=>this._removeDecoration(a))),this._register(Vt(()=>{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){let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",e?.options?.layer==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Ex=an([ke(1,Ci),ke(2,fo),ke(3,nh),ke(4,po)],Ex);var Nte=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},os={full:0,left:0,center:0,right:0},Vo={full:0,left:0,center:0,right:0},ad={full:0,left:0,center:0,right:0},cm=class extends ot{constructor(e,t,n,i,s,a,l,u){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=i,this._renderService=s,this._optionsService=a,this._themeService=l,this._coreBrowserService=u,this._colorZoneStore=new Nte,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(Vt(()=>this._canvas?.remove()));let f=this._canvas.getContext("2d");if(f)this._ctx=f;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(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Vo.full=this._canvas.width,Vo.left=e,Vo.center=t,Vo.right=e,this._refreshDrawHeightConstants(),ad.full=1,ad.left=1,ad.center=1+Vo.left,ad.right=1+Vo.left+Vo.center}_refreshDrawHeightConstants(){os.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);os.left=t,os.center=t,os.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*os.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*os.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*os.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*os.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(ad[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-os[e.position||"full"]/2),Vo[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+os[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}))}};cm=an([ke(2,Ci),ke(3,nh),ke(4,po),ke(5,ki),ke(6,iu),ke(7,fo)],cm);var fe;(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=`
121
- `,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=""))(fe||={});var Pp;(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="Ÿ"))(Pp||={});var wI;(e=>e.ST=`${fe.ESC}\\`)(wI||={});var Nx=class{constructor(e,t,n,i,s,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=i,this._coreService=s,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 n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${fe.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,i=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,s=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=s+"px",this._compositionView.style.top=i+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let a=this._compositionView.getBoundingClientRect();this._textarea.style.left=s+"px",this._textarea.style.top=i+"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)}}};Nx=an([ke(2,Ci),ke(3,ki),ke(4,Sl),ke(5,po)],Nx);var Un=0,Hn=0,$n=0,nn=0,iT={css:"#00000000",rgba:0},bn;(e=>{function t(s,a,l,u){return u!==void 0?`#${Va(s)}${Va(a)}${Va(l)}${Va(u)}`:`#${Va(s)}${Va(a)}${Va(l)}`}e.toCss=t;function n(s,a,l,u=255){return(s<<24|a<<16|l<<8|u)>>>0}e.toRgba=n;function i(s,a,l,u){return{css:e.toCss(s,a,l,u),rgba:e.toRgba(s,a,l,u)}}e.toColor=i})(bn||={});var Ft;(e=>{function t(f,h){if(nn=(h.rgba&255)/255,nn===1)return{css:h.css,rgba:h.rgba};let g=h.rgba>>24&255,m=h.rgba>>16&255,_=h.rgba>>8&255,b=f.rgba>>24&255,x=f.rgba>>16&255,S=f.rgba>>8&255;Un=b+Math.round((g-b)*nn),Hn=x+Math.round((m-x)*nn),$n=S+Math.round((_-S)*nn);let C=bn.toCss(Un,Hn,$n),k=bn.toRgba(Un,Hn,$n);return{css:C,rgba:k}}e.blend=t;function n(f){return(f.rgba&255)===255}e.isOpaque=n;function i(f,h,g){let m=Lp.ensureContrastRatio(f.rgba,h.rgba,g);if(m)return bn.toColor(m>>24&255,m>>16&255,m>>8&255)}e.ensureContrastRatio=i;function s(f){let h=(f.rgba|255)>>>0;return[Un,Hn,$n]=Lp.toChannels(h),{css:bn.toCss(Un,Hn,$n),rgba:h}}e.opaque=s;function a(f,h){return nn=Math.round(h*255),[Un,Hn,$n]=Lp.toChannels(f.rgba),{css:bn.toCss(Un,Hn,$n,nn),rgba:bn.toRgba(Un,Hn,$n,nn)}}e.opacity=a;function l(f,h){return nn=f.rgba&255,a(f,nn*h/255)}e.multiplyOpacity=l;function u(f){return[f.rgba>>24&255,f.rgba>>16&255,f.rgba>>8&255]}e.toColorRGB=u})(Ft||={});var Xt;(e=>{let t,n;try{let s=document.createElement("canvas");s.width=1,s.height=1;let a=s.getContext("2d",{willReadFrequently:!0});a&&(t=a,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function i(s){if(s.match(/#[\da-f]{3,8}/i))switch(s.length){case 4:return Un=parseInt(s.slice(1,2).repeat(2),16),Hn=parseInt(s.slice(2,3).repeat(2),16),$n=parseInt(s.slice(3,4).repeat(2),16),bn.toColor(Un,Hn,$n);case 5:return Un=parseInt(s.slice(1,2).repeat(2),16),Hn=parseInt(s.slice(2,3).repeat(2),16),$n=parseInt(s.slice(3,4).repeat(2),16),nn=parseInt(s.slice(4,5).repeat(2),16),bn.toColor(Un,Hn,$n,nn);case 7:return{css:s,rgba:(parseInt(s.slice(1),16)<<8|255)>>>0};case 9:return{css:s,rgba:parseInt(s.slice(1),16)>>>0}}let a=s.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 Un=parseInt(a[1]),Hn=parseInt(a[2]),$n=parseInt(a[3]),nn=Math.round((a[5]===void 0?1:parseFloat(a[5]))*255),bn.toColor(Un,Hn,$n,nn);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=s,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[Un,Hn,$n,nn]=t.getImageData(0,0,1,1).data,nn!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:bn.toRgba(Un,Hn,$n,nn),css:s}}e.toColor=i})(Xt||={});var yi;(e=>{function t(i){return n(i>>16&255,i>>8&255,i&255)}e.relativeLuminance=t;function n(i,s,a){let l=i/255,u=s/255,f=a/255,h=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),g=u<=.03928?u/12.92:Math.pow((u+.055)/1.055,2.4),m=f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4);return h*.2126+g*.7152+m*.0722}e.relativeLuminance2=n})(yi||={});var Lp;(e=>{function t(l,u){if(nn=(u&255)/255,nn===1)return u;let f=u>>24&255,h=u>>16&255,g=u>>8&255,m=l>>24&255,_=l>>16&255,b=l>>8&255;return Un=m+Math.round((f-m)*nn),Hn=_+Math.round((h-_)*nn),$n=b+Math.round((g-b)*nn),bn.toRgba(Un,Hn,$n)}e.blend=t;function n(l,u,f){let h=yi.relativeLuminance(l>>8),g=yi.relativeLuminance(u>>8);if(Zs(h,g)<f){if(g<h){let b=i(l,u,f),x=Zs(h,yi.relativeLuminance(b>>8));if(x<f){let S=s(l,u,f),C=Zs(h,yi.relativeLuminance(S>>8));return x>C?b:S}return b}let m=s(l,u,f),_=Zs(h,yi.relativeLuminance(m>>8));if(_<f){let b=i(l,u,f),x=Zs(h,yi.relativeLuminance(b>>8));return _>x?m:b}return m}}e.ensureContrastRatio=n;function i(l,u,f){let h=l>>24&255,g=l>>16&255,m=l>>8&255,_=u>>24&255,b=u>>16&255,x=u>>8&255,S=Zs(yi.relativeLuminance2(_,b,x),yi.relativeLuminance2(h,g,m));for(;S<f&&(_>0||b>0||x>0);)_-=Math.max(0,Math.ceil(_*.1)),b-=Math.max(0,Math.ceil(b*.1)),x-=Math.max(0,Math.ceil(x*.1)),S=Zs(yi.relativeLuminance2(_,b,x),yi.relativeLuminance2(h,g,m));return(_<<24|b<<16|x<<8|255)>>>0}e.reduceLuminance=i;function s(l,u,f){let h=l>>24&255,g=l>>16&255,m=l>>8&255,_=u>>24&255,b=u>>16&255,x=u>>8&255,S=Zs(yi.relativeLuminance2(_,b,x),yi.relativeLuminance2(h,g,m));for(;S<f&&(_<255||b<255||x<255);)_=Math.min(255,_+Math.ceil((255-_)*.1)),b=Math.min(255,b+Math.ceil((255-b)*.1)),x=Math.min(255,x+Math.ceil((255-x)*.1)),S=Zs(yi.relativeLuminance2(_,b,x),yi.relativeLuminance2(h,g,m));return(_<<24|b<<16|x<<8|255)>>>0}e.increaseLuminance=s;function a(l){return[l>>24&255,l>>16&255,l>>8&255,l&255]}e.toChannels=a})(Lp||={});function Va(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Zs(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var Rte=class extends th{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},um=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new kr}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],i=t.translateToString(!0),s=0,a=0,l=0,u=t.getFg(0),f=t.getBg(0);for(let h=0;h<t.getTrimmedLength();h++)if(t.loadCell(h,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==u||this._workCell.bg!==f){if(h-s>1){let g=this._getJoinedRanges(i,l,a,t,s);for(let m=0;m<g.length;m++)n.push(g[m])}s=h,l=a,u=this._workCell.fg,f=this._workCell.bg}a+=this._workCell.getChars().length||Jo.length}if(this._bufferService.cols-s>1){let h=this._getJoinedRanges(i,l,a,t,s);for(let g=0;g<h.length;g++)n.push(h[g])}return n}_getJoinedRanges(e,t,n,i,s){let a=e.substring(t,n),l=[];try{l=this._characterJoiners[0].handler(a)}catch(u){console.error(u)}for(let u=1;u<this._characterJoiners.length;u++)try{let f=this._characterJoiners[u].handler(a);for(let h=0;h<f.length;h++)um._mergeRanges(l,f[h])}catch(f){console.error(f)}return this._stringRangesToCellRanges(l,i,s),l}_stringRangesToCellRanges(e,t,n){let i=0,s=!1,a=0,l=e[i];if(l){for(let u=n;u<this._bufferService.cols;u++){let f=t.getWidth(u),h=t.getString(u).length||Jo.length;if(f!==0){if(!s&&l[0]<=a&&(l[0]=u,s=!0),l[1]<=a){if(l[1]=u,l=e[++i],!l)break;l[0]<=a?(l[0]=u,s=!0):s=!1}a+=h}}l&&(l[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(n){if(t[1]<=s[0])return e[i-1][1]=t[1],e;if(t[1]<=s[1])return e[i-1][1]=Math.max(t[1],s[1]),e.splice(i,1),e;e.splice(i,1),i--}else{if(t[1]<=s[0])return e.splice(i,0,t),e;if(t[1]<=s[1])return s[0]=Math.min(t[0],s[0]),e;t[0]<s[1]&&(s[0]=Math.min(t[0],s[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};um=an([ke(0,Ci)],um);function Tte(e){return 57508<=e&&e<=57558}function Dte(e){return 9472<=e&&e<=9631}function Ate(e){return Tte(e)||Dte(e)}function Ote(){return{css:{canvas:dp(),cell:dp()},device:{canvas:dp(),cell:dp(),char:{width:0,height:0,left:0,top:0}}}}function dp(){return{width:0,height:0}}var Rx=class{constructor(e,t,n,i,s,a,l){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=i,this._coreService=s,this._decorationService=a,this._themeService=l,this._workCell=new kr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,i,s,a,l,u,f,h,g){let m=[],_=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors,x=e.getNoBgTrimmedLength();n&&x<a+1&&(x=a+1);let S,C=0,k="",R=0,N=0,A=0,I=0,T=!1,D=0,L=!1,ee=0,U=0,F=[],B=h!==-1&&g!==-1;for(let W=0;W<x;W++){e.loadCell(W,this._workCell);let te=this._workCell.getWidth();if(te===0)continue;let G=!1,P=W>=U,Z=W,$=this._workCell;if(_.length>0&&W===_[0][0]&&P){let J=_.shift(),Ie=this._isCellInSelection(J[0],t);for(R=J[0]+1;R<J[1];R++)P&&=Ie===this._isCellInSelection(R,t);P&&=!n||a<J[0]||a>=J[1],P?(G=!0,$=new Rte(this._workCell,e.translateToString(!0,J[0],J[1]),J[1]-J[0]),Z=J[1]-1,te=$.getWidth()):U=J[1]}let ae=this._isCellInSelection(W,t),j=n&&W===a,_e=B&&W>=h&&W<=g,Le=!1;this._decorationService.forEachDecorationAtCell(W,t,void 0,J=>{Le=!0});let z=$.getChars()||Jo;if(z===" "&&($.isUnderline()||$.isOverline())&&(z=" "),ee=te*u-f.get(z,$.isBold(),$.isItalic()),!S)S=this._document.createElement("span");else if(C&&(ae&&L||!ae&&!L&&$.bg===N)&&(ae&&L&&b.selectionForeground||$.fg===A)&&$.extended.ext===I&&_e===T&&ee===D&&!j&&!G&&!Le&&P){$.isInvisible()?k+=Jo:k+=z,C++;continue}else C&&(S.textContent=k),S=this._document.createElement("span"),C=0,k="";if(N=$.bg,A=$.fg,I=$.extended.ext,T=_e,D=ee,L=ae,G&&a>=W&&a<=Z&&(a=W),!this._coreService.isCursorHidden&&j&&this._coreService.isCursorInitialized){if(F.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&F.push("xterm-cursor-blink"),F.push(i==="bar"?"xterm-cursor-bar":i==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(s)switch(s){case"outline":F.push("xterm-cursor-outline");break;case"block":F.push("xterm-cursor-block");break;case"bar":F.push("xterm-cursor-bar");break;case"underline":F.push("xterm-cursor-underline");break}}if($.isBold()&&F.push("xterm-bold"),$.isItalic()&&F.push("xterm-italic"),$.isDim()&&F.push("xterm-dim"),$.isInvisible()?k=Jo:k=$.getChars()||Jo,$.isUnderline()&&(F.push(`xterm-underline-${$.extended.underlineStyle}`),k===" "&&(k=" "),!$.isUnderlineColorDefault()))if($.isUnderlineColorRGB())S.style.textDecorationColor=`rgb(${th.toColorRGB($.getUnderlineColor()).join(",")})`;else{let J=$.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&$.isBold()&&J<8&&(J+=8),S.style.textDecorationColor=b.ansi[J].css}$.isOverline()&&(F.push("xterm-overline"),k===" "&&(k=" ")),$.isStrikethrough()&&F.push("xterm-strikethrough"),_e&&(S.style.textDecoration="underline");let M=$.getFgColor(),K=$.getFgColorMode(),ne=$.getBgColor(),me=$.getBgColorMode(),Ee=!!$.isInverse();if(Ee){let J=M;M=ne,ne=J;let Ie=K;K=me,me=Ie}let ve,Re,re=!1;this._decorationService.forEachDecorationAtCell(W,t,void 0,J=>{J.options.layer!=="top"&&re||(J.backgroundColorRGB&&(me=50331648,ne=J.backgroundColorRGB.rgba>>8&16777215,ve=J.backgroundColorRGB),J.foregroundColorRGB&&(K=50331648,M=J.foregroundColorRGB.rgba>>8&16777215,Re=J.foregroundColorRGB),re=J.options.layer==="top")}),!re&&ae&&(ve=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,ne=ve.rgba>>8&16777215,me=50331648,re=!0,b.selectionForeground&&(K=50331648,M=b.selectionForeground.rgba>>8&16777215,Re=b.selectionForeground)),re&&F.push("xterm-decoration-top");let he;switch(me){case 16777216:case 33554432:he=b.ansi[ne],F.push(`xterm-bg-${ne}`);break;case 50331648:he=bn.toColor(ne>>16,ne>>8&255,ne&255),this._addStyle(S,`background-color:#${rT((ne>>>0).toString(16),"0",6)}`);break;default:Ee?(he=b.foreground,F.push("xterm-bg-257")):he=b.background}switch(ve||$.isDim()&&(ve=Ft.multiplyOpacity(he,.5)),K){case 16777216:case 33554432:$.isBold()&&M<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(M+=8),this._applyMinimumContrast(S,he,b.ansi[M],$,ve,void 0)||F.push(`xterm-fg-${M}`);break;case 50331648:let J=bn.toColor(M>>16&255,M>>8&255,M&255);this._applyMinimumContrast(S,he,J,$,ve,Re)||this._addStyle(S,`color:#${rT(M.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(S,he,b.foreground,$,ve,Re)||Ee&&F.push("xterm-fg-257")}F.length&&(S.className=F.join(" "),F.length=0),!j&&!G&&!Le&&P?C++:S.textContent=k,ee!==this.defaultSpacing&&(S.style.letterSpacing=`${ee}px`),m.push(S),W=Z}return S&&C&&(S.textContent=k),m}_applyMinimumContrast(e,t,n,i,s,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||Ate(i.getCode()))return!1;let l=this._getContrastCache(i),u;if(!s&&!a&&(u=l.getColor(t.rgba,n.rgba)),u===void 0){let f=this._optionsService.rawOptions.minimumContrastRatio/(i.isDim()?2:1);u=Ft.ensureContrastRatio(s||t,a||n,f),l.setColor((s||t).rgba,(a||n).rgba,u??null)}return u?(this._addStyle(e,`color:${u.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,i=this._selectionEnd;return!n||!i?!1:this._columnSelectMode?n[0]<=i[0]?e>=n[0]&&t>=n[1]&&e<i[0]&&t<=i[1]:e<n[0]&&t>=n[1]&&e>=i[0]&&t<=i[1]:t>n[1]&&t<i[1]||n[1]===i[1]&&t===n[1]&&e>=n[0]&&e<i[0]||n[1]<i[1]&&t===i[1]&&e<i[0]||n[1]<i[1]&&t===n[1]&&e>=n[0]}};Rx=an([ke(1,sI),ke(2,ki),ke(3,fo),ke(4,Sl),ke(5,nh),ke(6,iu)],Rx);function rT(e,t,n){for(;e.length<n;)e=t+e;return e}var jte=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontWeight="bold";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.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=[n,i,s,a],this._container.appendChild(n),this._container.appendChild(i),this._container.appendChild(s),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,n,i){e===this._font&&t===this._fontSize&&n===this._weight&&i===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=i,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${i}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${i}`,this.clear())}get(e,t,n){let i=0;if(!t&&!n&&e.length===1&&(i=e.charCodeAt(0))<256){if(this._flat[i]!==-9999)return this._flat[i];let l=this._measure(e,0);return l>0&&(this._flat[i]=l),l}let s=e;t&&(s+="B"),n&&(s+="I");let a=this._holey.get(s);if(a===void 0){let l=0;t&&(l|=1),n&&(l|=2),a=this._measure(e,l),a>0&&this._holey.set(s,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},zte=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,i=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let s=e.buffers.active.ydisp,a=t[1]-s,l=n[1]-s,u=Math.max(a,0),f=Math.min(l,e.rows-1);if(u>=e.rows||f<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=i,this.viewportStartRow=a,this.viewportEndRow=l,this.viewportCappedStartRow=u,this.viewportCappedEndRow=f,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function Mte(){return new zte}var P_="xterm-dom-renderer-owner-",yr="xterm-rows",hp="xterm-fg-",sT="xterm-bg-",ld="xterm-focus",fp="xterm-selection",Ite=1,Tx=class extends ot{constructor(e,t,n,i,s,a,l,u,f,h,g,m,_,b){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=i,this._viewportElement=s,this._helperContainer=a,this._linkifier2=l,this._charSizeService=f,this._optionsService=h,this._bufferService=g,this._coreService=m,this._coreBrowserService=_,this._themeService=b,this._terminalClass=Ite++,this._rowElements=[],this._selectionRenderModel=Mte(),this.onRequestRedraw=this._register(new be).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(yr),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(fp),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=Ote(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(x=>this._injectCss(x))),this._injectCss(this._themeService.colors),this._rowFactory=u.createInstance(Rx,document),this._element.classList.add(P_+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(x=>this._handleLinkHover(x))),this._register(this._linkifier2.onHideLinkUnderline(x=>this._handleLinkLeave(x))),this._register(Vt(()=>{this._element.classList.remove(P_+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new jte(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${yr} 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} .${yr} { 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} .${yr} .xterm-dim { color: ${Ft.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,i=`blink_bar_${this._terminalClass}`,s=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${i} { 50% { box-shadow: none; }}`,t+=`@keyframes ${s} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${yr}.${ld} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${yr}.${ld} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${yr}.${ld} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${yr} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${fp} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${fp} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${fp} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[a,l]of e.ansi.entries())t+=`${this._terminalSelector} .${hp}${a} { color: ${l.css}; }${this._terminalSelector} .${hp}${a}.xterm-dim { color: ${Ft.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${sT}${a} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${hp}257 { color: ${Ft.opaque(e.background).css}; }${this._terminalSelector} .${hp}257.xterm-dim { color: ${Ft.multiplyOpacity(Ft.opaque(e.background),.5).css}; }${this._terminalSelector} .${sT}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let i=this._document.createElement("div");this._rowContainer.appendChild(i),this._rowElements.push(i)}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(ld),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(ld),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let i=this._selectionRenderModel.viewportStartRow,s=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,u=this._document.createDocumentFragment();if(n){let f=e[0]>t[0];u.appendChild(this._createSelectionElement(a,f?t[0]:e[0],f?e[0]:t[0],l-a+1))}else{let f=i===a?e[0]:0,h=a===s?t[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(a,f,h));let g=l-a-1;if(u.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,g)),a!==l){let m=s===l?t[0]:this._bufferService.cols;u.appendChild(this._createSelectionElement(l,0,m))}}this._selectionContainer.appendChild(u)}_createSelectionElement(e,t,n,i=1){let s=this._document.createElement("div"),a=t*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(n-t);return a+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-a),s.style.height=`${i*this.dimensions.css.cell.height}px`,s.style.top=`${e*this.dimensions.css.cell.height}px`,s.style.left=`${a}px`,s.style.width=`${l}px`,s}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,i=n.ybase+n.y,s=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,u=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=e;f<=t;f++){let h=f+n.ydisp,g=this._rowElements[f],m=n.lines.get(h);if(!g||!m)break;g.replaceChildren(...this._rowFactory.createRow(m,h,h===i,l,u,s,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${P_}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,i,s,a){n<0&&(e=0),i<0&&(t=0);let l=this._bufferService.rows-1;n=Math.max(Math.min(n,l),0),i=Math.max(Math.min(i,l),0),s=Math.min(s,this._bufferService.cols);let u=this._bufferService.buffer,f=u.ybase+u.y,h=Math.min(u.x,s-1),g=this._optionsService.rawOptions.cursorBlink,m=this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let b=n;b<=i;++b){let x=b+u.ydisp,S=this._rowElements[b],C=u.lines.get(x);if(!S||!C)break;S.replaceChildren(...this._rowFactory.createRow(C,x,x===f,m,_,h,g,this.dimensions.css.cell.width,this._widthCache,a?b===n?e:0:-1,a?(b===i?t:s)-1:-1))}}};Tx=an([ke(7,q1),ke(8,ng),ke(9,ki),ke(10,Ci),ke(11,Sl),ke(12,fo),ke(13,iu)],Tx);var Dx=class extends ot{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new be),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Lte(this._optionsService))}catch{this._measureStrategy=this._register(new Pte(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())}};Dx=an([ke(2,ki)],Dx);var CI=class extends ot{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)}},Pte=class extends CI{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},Lte=class extends CI{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}},Bte=class extends ot{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Fte(this._window)),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new be),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(i=>this._screenDprMonitor.setWindow(i))),this._register(ni.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register($e(this._textarea,"focus",()=>this._isFocused=!0)),this._register($e(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}},Fte=class extends ot{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new qc),this._onDprChange=this._register(new be),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(Vt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=$e(this._parentWindow,"resize",()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},Ute=class extends ot{constructor(){super(),this.linkProviders=[],this._register(Vt(()=>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 Q1(e,t,n){let i=n.getBoundingClientRect(),s=e.getComputedStyle(n),a=parseInt(s.getPropertyValue("padding-left")),l=parseInt(s.getPropertyValue("padding-top"));return[t.clientX-i.left-a,t.clientY-i.top-l]}function Hte(e,t,n,i,s,a,l,u,f){if(!a)return;let h=Q1(e,t,n);if(h)return h[0]=Math.ceil((h[0]+(f?l/2:0))/l),h[1]=Math.ceil(h[1]/u),h[0]=Math.min(Math.max(h[0],1),i+(f?1:0)),h[1]=Math.min(Math.max(h[1],1),s),h}var Ax=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,i,s){return Hte(window,e,t,n,i,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,s)}getMouseReportCoords(e,t){let n=Q1(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};Ax=an([ke(0,po),ke(1,ng)],Ax);var $te=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},kI={};JJ(kI,{getSafariVersion:()=>Wte,isChromeOS:()=>TI,isFirefox:()=>EI,isIpad:()=>Kte,isIphone:()=>Vte,isLegacyEdge:()=>qte,isLinux:()=>J1,isMac:()=>dm,isNode:()=>ig,isSafari:()=>NI,isWindows:()=>RI});var ig=typeof process<"u"&&"title"in process,ih=ig?"node":navigator.userAgent,rh=ig?"node":navigator.platform,EI=ih.includes("Firefox"),qte=ih.includes("Edge"),NI=/^((?!chrome|android).)*safari/i.test(ih);function Wte(){if(!NI)return 0;let e=ih.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var dm=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(rh),Kte=rh==="iPad",Vte=rh==="iPhone",RI=["Windows","Win16","Win32","WinCE"].includes(rh),J1=rh.indexOf("Linux")>=0,TI=/\bCrOS\b/.test(ih),DI=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,i=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),s=e.timeRemaining(),n*1.5>s){i-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(i-t))}ms`),this._start();return}i=s}this.clear()}},Gte=class extends DI{_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())}}},Zte=class extends DI{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},hm=!ig&&"requestIdleCallback"in window?Zte:Gte,Yte=class{constructor(){this._queue=new hm}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},Ox=class extends ot{constructor(e,t,n,i,s,a,l,u,f){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=i,this._coreService=s,this._coreBrowserService=u,this._renderer=this._register(new qc),this._pausedResizeTask=new Yte,this._observerDisposable=this._register(new qc),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 be),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new be),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new be),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new $te((h,g)=>this._renderRows(h,g),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Xte(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(Vt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>this._renderer.value?.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(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(f.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(h=>this._registerIntersectionObserver(h,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(i=>this._handleIntersectionChange(i[i.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=Vt(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let i=this._syncOutputHandler.flush();i&&(e=Math.min(e,i.start),t=Math.max(t,i.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};Ox=an([ke(2,ki),ke(3,ng),ke(4,Sl),ke(5,nh),ke(6,Ci),ke(7,fo),ke(8,iu)],Ox);var Xte=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Qte(e,t,n,i){let s=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return tne(s,a,e,t,n,i)+rg(a,t,n,i)+nne(s,a,e,t,n,i);let l;if(a===t)return l=s>e?"D":"C",qd(Math.abs(s-e),$d(l,i));l=a>t?"D":"C";let u=Math.abs(a-t),f=ene(a>t?e:s,n)+(u-1)*n.cols+1+Jte(a>t?s:e);return qd(f,$d(l,i))}function Jte(e,t){return e-1}function ene(e,t){return t.cols-e}function tne(e,t,n,i,s,a){return rg(t,i,s,a).length===0?"":qd(OI(e,t,e,t-pl(t,s),!1,s).length,$d("D",a))}function rg(e,t,n,i){let s=e-pl(e,n),a=t-pl(t,n),l=Math.abs(s-a)-ine(e,t,n);return qd(l,$d(AI(e,t),i))}function nne(e,t,n,i,s,a){let l;rg(t,i,s,a).length>0?l=i-pl(i,s):l=t;let u=i,f=rne(e,t,n,i,s,a);return qd(OI(e,l,n,u,f==="C",s).length,$d(f,a))}function ine(e,t,n){let i=0,s=e-pl(e,n),a=t-pl(t,n);for(let l=0;l<Math.abs(s-a);l++){let u=AI(e,t)==="A"?-1:1;n.buffer.lines.get(s+u*l)?.isWrapped&&i++}return i}function pl(e,t){let n=0,i=t.buffer.lines.get(e),s=i?.isWrapped;for(;s&&e>=0&&e<t.rows;)n++,i=t.buffer.lines.get(--e),s=i?.isWrapped;return n}function rne(e,t,n,i,s,a){let l;return rg(n,i,s,a).length>0?l=i-pl(i,s):l=t,e<n&&l<=i||e>=n&&l<i?"C":"D"}function AI(e,t){return e>t?"A":"B"}function OI(e,t,n,i,s,a){let l=e,u=t,f="";for(;(l!==n||u!==i)&&u>=0&&u<a.buffer.lines.length;)l+=s?1:-1,s&&l>a.cols-1?(f+=a.buffer.translateBufferLineToString(u,!1,e,l),l=0,e=0,u++):!s&&l<0&&(f+=a.buffer.translateBufferLineToString(u,!1,0,e+1),l=a.cols-1,e=l,u--);return f+a.buffer.translateBufferLineToString(u,!1,e,l)}function $d(e,t){let n=t?"O":"[";return fe.ESC+n+e}function qd(e,t){e=Math.floor(e);let n="";for(let i=0;i<e;i++)n+=t;return n}var sne=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 oT(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 L_=50,one=15,ane=50,lne=500,cne=" ",une=new RegExp(cne,"g"),jx=class extends ot{constructor(e,t,n,i,s,a,l,u,f){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=i,this._coreService=s,this._mouseService=a,this._optionsService=l,this._renderService=u,this._coreBrowserService=f,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new kr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new be),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new be),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new be),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=h=>this._handleMouseMove(h),this._mouseUpListener=h=>this._handleMouseUp(h),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(h=>this._handleTrim(h)),this._register(this._bufferService.buffers.onBufferActivate(h=>this._handleBufferActivate(h))),this.enable(),this._model=new sne(this._bufferService),this._activeSelectionMode=0,this._register(Vt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(h=>{h.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,i=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let s=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let l=e[1];l<=t[1];l++){let u=n.translateBufferLineToString(l,!0,s,a);i.push(u)}}else{let s=e[1]===t[1]?t[0]:void 0;i.push(n.translateBufferLineToString(e[1],!0,e[0],s));for(let a=e[1]+1;a<=t[1]-1;a++){let l=n.lines.get(a),u=n.translateBufferLineToString(a,!0);l?.isWrapped?i[i.length-1]+=u:i.push(u)}if(e[1]!==t[1]){let a=n.lines.get(t[1]),l=n.translateBufferLineToString(t[1],!0,0,t[0]);a&&a.isWrapped?i[i.length-1]+=l:i.push(l)}}return i.map(s=>s.replace(une," ")).join(RI?`\r
122
- `:`
123
- `)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),J1&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!n||!i||!t?!1:this._areCoordsInSelection(t,n,i)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,i=this._model.finalSelectionEnd;return!n||!i?!1:this._areCoordsInSelection([e,t],n,i)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){let n=this._linkifier.currentLink?.link?.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=oT(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let i=this._getMouseBufferCoords(e);return i?(this._selectWordAt(i,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=Q1(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-L_),L_),t/=L_,t/Math.abs(t)+Math.round(t*(one-1)))}shouldForceSelection(e){return dm?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(),ane)}_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&&!(dm&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let i=n.lines.get(this._model.selectionEnd[1]);i&&i.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<lne&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let i=Qte(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(i,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let i=0;t>=i;i++){let s=e.loadCell(i,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:s>1&&t!==i&&(n+=s-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,i=!0){if(e[0]>=this._bufferService.cols)return;let s=this._bufferService.buffer,a=s.lines.get(e[1]);if(!a)return;let l=s.translateBufferLineToString(e[1],!1),u=this._convertViewportColToCharacterIndex(a,e[0]),f=u,h=e[0]-u,g=0,m=0,_=0,b=0;if(l.charAt(u)===" "){for(;u>0&&l.charAt(u-1)===" ";)u--;for(;f<l.length&&l.charAt(f+1)===" ";)f++}else{let C=e[0],k=e[0];a.getWidth(C)===0&&(g++,C--),a.getWidth(k)===2&&(m++,k++);let R=a.getString(k).length;for(R>1&&(b+=R-1,f+=R-1);C>0&&u>0&&!this._isCharWordSeparator(a.loadCell(C-1,this._workCell));){a.loadCell(C-1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===0?(g++,C--):N>1&&(_+=N-1,u-=N-1),u--,C--}for(;k<a.length&&f+1<l.length&&!this._isCharWordSeparator(a.loadCell(k+1,this._workCell));){a.loadCell(k+1,this._workCell);let N=this._workCell.getChars().length;this._workCell.getWidth()===2?(m++,k++):N>1&&(b+=N-1,f+=N-1),f++,k++}}f++;let x=u+h-g+_,S=Math.min(this._bufferService.cols,f-u+g+m-_-b);if(!(!t&&l.slice(u,f).trim()==="")){if(n&&x===0&&a.getCodePoint(0)!==32){let C=s.lines.get(e[1]-1);if(C&&a.isWrapped&&C.getCodePoint(this._bufferService.cols-1)!==32){let k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let R=this._bufferService.cols-k.start;x-=R,S+=R}}}if(i&&x+S===this._bufferService.cols&&a.getCodePoint(this._bufferService.cols-1)!==32){let C=s.lines.get(e[1]+1);if(C?.isWrapped&&C.getCodePoint(0)!==32){let k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(S+=k.length)}}return{start:x,length:S}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=oT(n,this._bufferService.cols)}};jx=an([ke(3,Ci),ke(4,Sl),ke(5,W1),ke(6,ki),ke(7,po),ke(8,fo)],jx);var aT=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},lT=class{constructor(){this._color=new aT,this._css=new aT}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},Rn=Object.freeze((()=>{let e=[Xt.toColor("#2e3436"),Xt.toColor("#cc0000"),Xt.toColor("#4e9a06"),Xt.toColor("#c4a000"),Xt.toColor("#3465a4"),Xt.toColor("#75507b"),Xt.toColor("#06989a"),Xt.toColor("#d3d7cf"),Xt.toColor("#555753"),Xt.toColor("#ef2929"),Xt.toColor("#8ae234"),Xt.toColor("#fce94f"),Xt.toColor("#729fcf"),Xt.toColor("#ad7fa8"),Xt.toColor("#34e2e2"),Xt.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let i=t[n/36%6|0],s=t[n/6%6|0],a=t[n%6];e.push({css:bn.toCss(i,s,a),rgba:bn.toRgba(i,s,a)})}for(let n=0;n<24;n++){let i=8+n*10;e.push({css:bn.toCss(i,i,i),rgba:bn.toRgba(i,i,i)})}return e})()),Za=Xt.toColor("#ffffff"),wd=Xt.toColor("#000000"),cT=Xt.toColor("#ffffff"),uT=wd,cd={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},dne=Za,zx=class extends ot{constructor(e){super(),this._optionsService=e,this._contrastCache=new lT,this._halfContrastCache=new lT,this._onChangeColors=this._register(new be),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Za,background:wd,cursor:cT,cursorAccent:uT,selectionForeground:void 0,selectionBackgroundTransparent:cd,selectionBackgroundOpaque:Ft.blend(wd,cd),selectionInactiveBackgroundTransparent:cd,selectionInactiveBackgroundOpaque:Ft.blend(wd,cd),scrollbarSliderBackground:Ft.opacity(Za,.2),scrollbarSliderHoverBackground:Ft.opacity(Za,.4),scrollbarSliderActiveBackground:Ft.opacity(Za,.5),overviewRulerBorder:Za,ansi:Rn.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=Rt(e.foreground,Za),t.background=Rt(e.background,wd),t.cursor=Ft.blend(t.background,Rt(e.cursor,cT)),t.cursorAccent=Ft.blend(t.background,Rt(e.cursorAccent,uT)),t.selectionBackgroundTransparent=Rt(e.selectionBackground,cd),t.selectionBackgroundOpaque=Ft.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Rt(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Ft.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Rt(e.selectionForeground,iT):void 0,t.selectionForeground===iT&&(t.selectionForeground=void 0),Ft.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Ft.opacity(t.selectionBackgroundTransparent,.3)),Ft.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Ft.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Rt(e.scrollbarSliderBackground,Ft.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Rt(e.scrollbarSliderHoverBackground,Ft.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Rt(e.scrollbarSliderActiveBackground,Ft.opacity(t.foreground,.5)),t.overviewRulerBorder=Rt(e.overviewRulerBorder,dne),t.ansi=Rn.slice(),t.ansi[0]=Rt(e.black,Rn[0]),t.ansi[1]=Rt(e.red,Rn[1]),t.ansi[2]=Rt(e.green,Rn[2]),t.ansi[3]=Rt(e.yellow,Rn[3]),t.ansi[4]=Rt(e.blue,Rn[4]),t.ansi[5]=Rt(e.magenta,Rn[5]),t.ansi[6]=Rt(e.cyan,Rn[6]),t.ansi[7]=Rt(e.white,Rn[7]),t.ansi[8]=Rt(e.brightBlack,Rn[8]),t.ansi[9]=Rt(e.brightRed,Rn[9]),t.ansi[10]=Rt(e.brightGreen,Rn[10]),t.ansi[11]=Rt(e.brightYellow,Rn[11]),t.ansi[12]=Rt(e.brightBlue,Rn[12]),t.ansi[13]=Rt(e.brightMagenta,Rn[13]),t.ansi[14]=Rt(e.brightCyan,Rn[14]),t.ansi[15]=Rt(e.brightWhite,Rn[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<n;i++)t.ansi[i+16]=Rt(e.extendedAnsi[i],Rn[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){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()}}};zx=an([ke(0,ki)],zx);function Rt(e,t){if(e!==void 0)try{return Xt.toColor(e)}catch{}return t}var hne=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},fne=class{constructor(){this._services=new hne,this._services.set(q1,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=oee(e).sort((a,l)=>a.index-l.index),i=[];for(let a of n){let l=this._services.get(a.id);if(!l)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id._id}.`);i.push(l)}let s=n.length>0?n[0].index:t.length;if(t.length!==s)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${s+1} conflicts with ${t.length} static arguments`);return new e(...t,...i)}},pne={trace:0,debug:1,info:2,warn:3,error:4,off:5},mne="xterm.js: ",Mx=class extends ot{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=pne[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":mne)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};Mx=an([ke(0,ki)],Mx);var dT=class extends ot{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new be),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new be),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new be),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let i=e;i<this._length-t;i++)this._array[this._getCyclicIndex(i)]=this._array[this._getCyclicIndex(i+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let i=this._length-1;i>=e;i--)this._array[this._getCyclicIndex(i+n.length)]=this._array[this._getCyclicIndex(i)];for(let i=0;i<n.length;i++)this._array[this._getCyclicIndex(e+i)]=n[i];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let i=this._length+n.length-this._maxLength;this._startIndex+=i,this._length=this._maxLength,this.onTrimEmitter.fire(i)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let s=t-1;s>=0;s--)this.set(e+s+n,this.get(e+s));let i=e+t+n-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let i=0;i<t;i++)this.set(e+i+n,this.get(e+i))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},it=3,_n=Object.freeze(new th),pp=0,B_=2,Cd=class jI{constructor(t,n,i=!1){this.isWrapped=i,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*it);let s=n||kr.fromCharData([0,Q3,1,0]);for(let a=0;a<t;++a)this.setCell(a,s);this.length=t}get(t){let n=this._data[t*it+0],i=n&2097151;return[this._data[t*it+1],n&2097152?this._combined[t]:i?Xo(i):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):i]}set(t,n){this._data[t*it+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*it+0]=t|2097152|n[2]<<22):this._data[t*it+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*it+0]>>22}hasWidth(t){return this._data[t*it+0]&12582912}getFg(t){return this._data[t*it+1]}getBg(t){return this._data[t*it+2]}hasContent(t){return this._data[t*it+0]&4194303}getCodePoint(t){let n=this._data[t*it+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*it+0]&2097152}getString(t){let n=this._data[t*it+0];return n&2097152?this._combined[t]:n&2097151?Xo(n&2097151):""}isProtected(t){return this._data[t*it+2]&536870912}loadCell(t,n){return pp=t*it,n.content=this._data[pp+0],n.fg=this._data[pp+1],n.bg=this._data[pp+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*it+0]=n.content,this._data[t*it+1]=n.fg,this._data[t*it+2]=n.bg}setCellFromCodepoint(t,n,i,s){s.bg&268435456&&(this._extendedAttrs[t]=s.extended),this._data[t*it+0]=n|i<<22,this._data[t*it+1]=s.fg,this._data[t*it+2]=s.bg}addCodepointToCell(t,n,i){let s=this._data[t*it+0];s&2097152?this._combined[t]+=Xo(n):s&2097151?(this._combined[t]=Xo(s&2097151)+Xo(n),s&=-2097152,s|=2097152):s=n|1<<22,i&&(s&=-12582913,s|=i<<22),this._data[t*it+0]=s}insertCells(t,n,i){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length-t){let s=new kr;for(let a=this.length-t-n-1;a>=0;--a)this.setCell(t+n+a,this.loadCell(t+a,s));for(let a=0;a<n;++a)this.setCell(t+a,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,i)}deleteCells(t,n,i){if(t%=this.length,n<this.length-t){let s=new kr;for(let a=0;a<this.length-t-n;++a)this.setCell(t+a,this.loadCell(t+n+a,s));for(let a=this.length-n;a<this.length;++a)this.setCell(a,i)}else for(let s=t;s<this.length;++s)this.setCell(s,i);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,i)}replaceCells(t,n,i,s=!1){if(s){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,i),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,i),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,i);t<n&&t<this.length;)this.setCell(t++,i)}resize(t,n){if(t===this.length)return this._data.length*4*B_<this._data.buffer.byteLength;let i=t*it;if(t>this.length){if(this._data.buffer.byteLength>=i*4)this._data=new Uint32Array(this._data.buffer,0,i);else{let s=new Uint32Array(i);s.set(this._data),this._data=s}for(let s=this.length;s<t;++s)this.setCell(s,n)}else{this._data=this._data.subarray(0,i);let s=Object.keys(this._combined);for(let l=0;l<s.length;l++){let u=parseInt(s[l],10);u>=t&&delete this._combined[u]}let a=Object.keys(this._extendedAttrs);for(let l=0;l<a.length;l++){let u=parseInt(a[l],10);u>=t&&delete this._extendedAttrs[u]}}return this.length=t,i*4*B_<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*B_<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let i=0;i<this.length;++i)this.isProtected(i)||this.setCell(i,t);return}this._combined={},this._extendedAttrs={};for(let i=0;i<this.length;++i)this.setCell(i,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new jI(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*it+0]&4194303)return t+(this._data[t*it+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*it+0]&4194303||this._data[t*it+2]&50331648)return t+(this._data[t*it+0]>>22);return 0}copyCellsFrom(t,n,i,s,a){let l=t._data;if(a)for(let f=s-1;f>=0;f--){for(let h=0;h<it;h++)this._data[(i+f)*it+h]=l[(n+f)*it+h];l[(n+f)*it+2]&268435456&&(this._extendedAttrs[i+f]=t._extendedAttrs[n+f])}else for(let f=0;f<s;f++){for(let h=0;h<it;h++)this._data[(i+f)*it+h]=l[(n+f)*it+h];l[(n+f)*it+2]&268435456&&(this._extendedAttrs[i+f]=t._extendedAttrs[n+f])}let u=Object.keys(t._combined);for(let f=0;f<u.length;f++){let h=parseInt(u[f],10);h>=n&&(this._combined[h-n+i]=t._combined[h])}}translateToString(t,n,i,s){n=n??0,i=i??this.length,t&&(i=Math.min(i,this.getTrimmedLength())),s&&(s.length=0);let a="";for(;n<i;){let l=this._data[n*it+0],u=l&2097151,f=l&2097152?this._combined[n]:u?Xo(u):Jo;if(a+=f,s)for(let h=0;h<f.length;++h)s.push(n);n+=l>>22||1}return s&&s.push(n),a}};function gne(e,t,n,i,s,a){let l=[];for(let u=0;u<e.length-1;u++){let f=u,h=e.get(++f);if(!h.isWrapped)continue;let g=[e.get(u)];for(;f<e.length&&h.isWrapped;)g.push(h),h=e.get(++f);if(!a&&i>=u&&i<f){u+=g.length-1;continue}let m=0,_=Wd(g,m,t),b=1,x=0;for(;b<g.length;){let C=Wd(g,b,t),k=C-x,R=n-_,N=Math.min(k,R);g[m].copyCellsFrom(g[b],x,_,N,!1),_+=N,_===n&&(m++,_=0),x+=N,x===C&&(b++,x=0),_===0&&m!==0&&g[m-1].getWidth(n-1)===2&&(g[m].copyCellsFrom(g[m-1],n-1,_++,1,!1),g[m-1].setCell(n-1,s))}g[m].replaceCells(_,n,s);let S=0;for(let C=g.length-1;C>0&&(C>m||g[C].getTrimmedLength()===0);C--)S++;S>0&&(l.push(u+g.length-S),l.push(S)),u+=g.length-1}return l}function vne(e,t){let n=[],i=0,s=t[i],a=0;for(let l=0;l<e.length;l++)if(s===l){let u=t[++i];e.onDeleteEmitter.fire({index:l-a,amount:u}),l+=u-1,a+=u,s=t[++i]}else n.push(l);return{layout:n,countRemoved:a}}function yne(e,t){let n=[];for(let i=0;i<t.length;i++)n.push(e.get(t[i]));for(let i=0;i<n.length;i++)e.set(i,n[i]);e.length=t.length}function _ne(e,t,n){let i=[],s=e.map((f,h)=>Wd(e,h,t)).reduce((f,h)=>f+h),a=0,l=0,u=0;for(;u<s;){if(s-u<n){i.push(s-u);break}a+=n;let f=Wd(e,l,t);a>f&&(a-=f,l++);let h=e[l].getWidth(a-1)===2;h&&a--;let g=h?n-1:n;i.push(g),u+=g}return i}function Wd(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let i=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,s=e[t+1].getWidth(0)===2;return i&&s?n-1:n}var zI=class MI{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=MI._nextId++,this._onDispose=this.register(new be),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),fl(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};zI._nextId=1;var bne=zI,jn={},Ya=jn.B;jn[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:"≥","{":"π","|":"≠","}":"£","~":"·"};jn.A={"#":"£"};jn.B=void 0;jn[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};jn.C=jn[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};jn.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};jn.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};jn.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};jn.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};jn.E=jn[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};jn.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};jn.H=jn[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};jn["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var hT=4294967295,fT=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=_n.clone(),this.savedCharset=Ya,this.markers=[],this._nullCell=kr.fromCharData([0,Q3,1,0]),this._whitespaceCell=kr.fromCharData([0,Jo,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new hm,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new dT(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 lm),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 lm),this._whitespaceCell}getBlankLine(e,t){return new Cd(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>hT?hT:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=_n);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 dT(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(_n),i=0,s=this._getCorrectBufferLength(t);if(s>this.lines.maxLength&&(this.lines.maxLength=s),this.lines.length>0){if(this._cols<e)for(let l=0;l<this.lines.length;l++)i+=+this.lines.get(l).resize(e,n);let a=0;if(this._rows<t)for(let l=this._rows;l<t;l++)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 Cd(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new Cd(e,n)));else for(let l=this._rows;l>t;l--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(s<this.lines.maxLength){let l=this.lines.length-s;l>0&&(this.lines.trimStart(l),this.ybase=Math.max(this.ybase-l,0),this.ydisp=Math.max(this.ydisp-l,0),this.savedY=Math.max(this.savedY-l,0)),this.lines.maxLength=s}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++)i+=+this.lines.get(a).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),i>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,i=gne(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(_n),n);if(i.length>0){let s=vne(this.lines,i);yne(this.lines,s.layout),this._reflowLargerAdjustViewport(e,t,s.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let i=this.getNullCell(_n),s=n;for(;s-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Cd(e,i))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,i=this.getNullCell(_n),s=[],a=0;for(let l=this.lines.length-1;l>=0;l--){let u=this.lines.get(l);if(!u||!u.isWrapped&&u.getTrimmedLength()<=e)continue;let f=[u];for(;u.isWrapped&&l>0;)u=this.lines.get(--l),f.unshift(u);if(!n){let N=this.ybase+this.y;if(N>=l&&N<l+f.length)continue}let h=f[f.length-1].getTrimmedLength(),g=_ne(f,this._cols,e),m=g.length-f.length,_;this.ybase===0&&this.y!==this.lines.length-1?_=Math.max(0,this.y-this.lines.maxLength+m):_=Math.max(0,this.lines.length-this.lines.maxLength+m);let b=[];for(let N=0;N<m;N++){let A=this.getBlankLine(_n,!0);b.push(A)}b.length>0&&(s.push({start:l+f.length+a,newLines:b}),a+=b.length),f.push(...b);let x=g.length-1,S=g[x];S===0&&(x--,S=g[x]);let C=f.length-m-1,k=h;for(;C>=0;){let N=Math.min(k,S);if(f[x]===void 0)break;if(f[x].copyCellsFrom(f[C],k-N,S-N,N,!0),S-=N,S===0&&(x--,S=g[x]),k-=N,k===0){C--;let A=Math.max(C,0);k=Wd(f,A,this._cols)}}for(let N=0;N<f.length;N++)g[N]<e&&f[N].setCell(g[N],i);let R=m-_;for(;R-- >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+m,this.ybase+t-1)}if(s.length>0){let l=[],u=[];for(let S=0;S<this.lines.length;S++)u.push(this.lines.get(S));let f=this.lines.length,h=f-1,g=0,m=s[g];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+a);let _=0;for(let S=Math.min(this.lines.maxLength-1,f+a-1);S>=0;S--)if(m&&m.start>h+_){for(let C=m.newLines.length-1;C>=0;C--)this.lines.set(S--,m.newLines[C]);S++,l.push({index:h+1,amount:m.newLines.length}),_+=m.newLines.length,m=s[++g]}else this.lines.set(S,u[h--]);let b=0;for(let S=l.length-1;S>=0;S--)l[S].index+=b,this.lines.onInsertEmitter.fire(l[S]),b+=l[S].amount;let x=Math.max(0,f+a-this.lines.maxLength);x>0&&this.lines.onTrimEmitter.fire(x)}}translateBufferLineToString(e,t,n=0,i){let s=this.lines.get(e);return s?s.translateToString(t,n,i):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new bne(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},xne=class extends ot{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new be),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 fT(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new fT(!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)}},II=2,PI=1,Ix=class extends ot{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,II),this.rows=Math.max(e.rawOptions.rows||0,PI),this.buffers=this._register(new xne(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,i=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:i})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,i;i=this._cachedBlankLine,(!i||i.length!==this.cols||i.getFg(0)!==e.fg||i.getBg(0)!==e.bg)&&(i=n.getBlankLine(e,t),this._cachedBlankLine=i),i.isWrapped=t;let s=n.ybase+n.scrollTop,a=n.ybase+n.scrollBottom;if(n.scrollTop===0){let l=n.lines.isFull;a===n.lines.length-1?l?n.lines.recycle().copyFrom(i):n.lines.push(i.clone()):n.lines.splice(a+1,0,i.clone()),l?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let l=a-s+1;n.lines.shiftElements(s+1,l-1,-1),n.lines.set(a,i.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let i=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),i!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};Ix=an([ke(0,ki)],Ix);var _c={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:dm,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Sne=["normal","bold","100","200","300","400","500","600","700","800","900"],wne=class extends ot{constructor(e){super(),this._onOptionChange=this._register(new be),this.onOptionChange=this._onOptionChange.event;let t={..._c};for(let n in e)if(n in t)try{let i=e[n];t[n]=this._sanitizeAndValidateOption(n,i)}catch(i){console.error(i)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(Vt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in _c))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,i)=>{if(!(n in _c))throw new Error(`No option with key "${n}"`);i=this._sanitizeAndValidateOption(n,i),this.rawOptions[n]!==i&&(this.rawOptions[n]=i,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let i={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,i)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=_c[e]),!Cne(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=_c[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=Sne.includes(t)?t:_c[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 Cne(e){return e==="block"||e==="underline"||e==="bar"}function kd(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let i in e)n[i]=t<=1?e[i]:e[i]&&kd(e[i],t-1);return n}var pT=Object.freeze({insertMode:!1}),mT=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Px=class extends ot{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new be),this.onData=this._onData.event,this._onUserInput=this._register(new be),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new be),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=kd(pT),this.decPrivateModes=kd(mT)}reset(){this.modes=kd(pT),this.decPrivateModes=kd(mT)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(i=>i.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))}};Px=an([ke(0,Ci),ke(1,iI),ke(2,ki)],Px);var gT={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 F_(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var U_=String.fromCharCode,vT={DEFAULT:e=>{let t=[F_(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${U_(t[0])}${U_(t[1])}${U_(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${F_(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${F_(e,!0)};${e.x};${e.y}${t}`}},Lx=class extends ot{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new be),this.onProtocolChange=this._onProtocolChange.event;for(let i of Object.keys(gT))this.addProtocol(i,gT[i]);for(let i of Object.keys(vT))this.addEncoding(i,vT[i]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let i=t/n,s=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(s/=i+0,Math.abs(e.deltaY)<50&&(s*=.3),this._wheelPartialScroll+=s,s=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(s*=this._bufferService.rows),s}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};Lx=an([ke(0,Ci),ke(1,Sl),ke(2,ki)],Lx);var H_=[[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]],kne=[[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]],Tn;function Ene(e,t){let n=0,i=t.length-1,s;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(s=n+i>>1,e>t[s][1])n=s+1;else if(e<t[s][0])i=s-1;else return!0;return!1}var Nne=class{constructor(){if(this.version="6",!Tn){Tn=new Uint8Array(65536),Tn.fill(1),Tn[0]=0,Tn.fill(0,1,32),Tn.fill(0,127,160),Tn.fill(2,4352,4448),Tn[9001]=2,Tn[9002]=2,Tn.fill(2,11904,42192),Tn[12351]=1,Tn.fill(2,44032,55204),Tn.fill(2,63744,64256),Tn.fill(2,65040,65050),Tn.fill(2,65072,65136),Tn.fill(2,65280,65377),Tn.fill(2,65504,65511);for(let e=0;e<H_.length;++e)Tn.fill(0,H_[e][0],H_[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?Tn[e]:Ene(e,kne)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),i=n===0&&t!==0;if(i){let s=tl.extractWidth(t);s===0?i=!1:s>n&&(n=s)}return tl.createPropertyValue(0,n,i)}},tl=class Bp{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new be,this.onChange=this._onChange.event;let t=new Nne;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,i=!1){return(t&16777215)<<3|(n&3)<<1|(i?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,i=0,s=t.length;for(let a=0;a<s;++a){let l=t.charCodeAt(a);if(55296<=l&&l<=56319){if(++a>=s)return n+this.wcwidth(l);let h=t.charCodeAt(a);56320<=h&&h<=57343?l=(l-55296)*1024+h-56320+65536:n+=this.wcwidth(h)}let u=this.charProperties(l,i),f=Bp.extractWidth(u);Bp.extractShouldJoin(u)&&(f-=Bp.extractWidth(i)),n+=f,i=u}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},Rne=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 yT(e){let t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1)?.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var ud=2147483647,Tne=256,LI=class Bx{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>Tne)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new Bx;if(!t.length)return n;for(let i=Array.isArray(t[0])?1:0;i<t.length;++i){let s=t[i];if(Array.isArray(s))for(let a=0;a<s.length;++a)n.addSubParam(s[a]);else n.addParam(s)}return n}clone(){let t=new Bx(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let i=this._subParamsIdx[n]>>8,s=this._subParamsIdx[n]&255;s-i>0&&t.push(Array.prototype.slice.call(this._subParams,i,s))}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>ud?ud: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>ud?ud:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,i=this._subParamsIdx[t]&255;return i-n>0?this._subParams.subarray(n,i):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let i=this._subParamsIdx[n]>>8,s=this._subParamsIdx[n]&255;s-i>0&&(t[n]=this._subParams.slice(i,s))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let i=this._digitIsSub?this._subParams:this.params,s=i[n-1];i[n-1]=~s?Math.min(s*10+t,ud):t}},dd=[],Dne=class{constructor(){this._state=0,this._active=dd,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,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=dd}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=dd,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||dd,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",tg(e,t,n));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let i=e[t++];if(i===59){this._state=2,this._start();break}if(i<48||57<i){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+i-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&n===!1){for(;i>=0&&(n=this._active[i].end(e),n!==!0);i--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,n;i--}for(;i>=0;i--)if(n=this._active[i].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,n}this._active=dd,this._id=-1,this._state=0}}},Qi=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=tg(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},hd=[],Ane=class{constructor(){this._handlers=Object.create(null),this._active=hd,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=hd}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let i=n.indexOf(t);i!==-1&&n.splice(i,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=hd,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||hd,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",tg(e,t,n));else for(let i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,i=this._active.length-1,s=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,n=t,s=this._stack.fallThrough,this._stack.paused=!1),!s&&n===!1){for(;i>=0&&(n=this._active[i].unhook(e),n!==!0);i--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,n;i--}for(;i>=0;i--)if(n=this._active[i].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,n}this._active=hd,this._ident=0}},Ed=new LI;Ed.addParam(0);var _T=class{constructor(e){this._handler=e,this._data="",this._params=Ed,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():Ed,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=tg(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=Ed,this._data="",this._hitLimit=!1,n));return this._params=Ed,this._data="",this._hitLimit=!1,t}},One=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,i){this.table[t<<8|e]=n<<4|i}addMany(e,t,n,i){for(let s=0;s<e.length;s++)this.table[t<<8|e[s]]=n<<4|i}},Sr=160,jne=(function(){let e=new One(4095),t=Array.apply(null,Array(256)).map((u,f)=>f),n=(u,f)=>t.slice(u,f),i=n(32,127),s=n(0,24);s.push(25),s.push.apply(s,n(28,32));let a=n(0,14),l;e.setDefault(1,0),e.addMany(i,0,2,0);for(l in a)e.addMany([24,26,153,154],l,3,0),e.addMany(n(128,144),l,3,0),e.addMany(n(144,152),l,3,0),e.add(156,l,0,0),e.add(27,l,11,1),e.add(157,l,4,8),e.addMany([152,158,159],l,0,7),e.add(155,l,11,3),e.add(144,l,11,9);return e.addMany(s,0,3,0),e.addMany(s,1,3,1),e.add(127,1,0,1),e.addMany(s,8,0,8),e.addMany(s,3,3,3),e.add(127,3,0,3),e.addMany(s,4,3,4),e.add(127,4,0,4),e.addMany(s,6,3,6),e.addMany(s,5,3,5),e.add(127,5,0,5),e.addMany(s,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(i,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(i,7,0,7),e.addMany(s,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(s,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(s,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(s,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(s,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(s,13,13,13),e.addMany(i,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(Sr,0,2,0),e.add(Sr,8,5,8),e.add(Sr,6,0,6),e.add(Sr,11,0,11),e.add(Sr,13,13,13),e})(),zne=class extends ot{constructor(e=jne){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 LI,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,i)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(Vt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Dne),this._dcsParser=this._register(new Ane),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let s=0;s<e.intermediates.length;++s){let a=e.intermediates.charCodeAt(s);if(32>a||a>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=a}}if(e.final.length!==1)throw new Error("final must be a single byte");let i=e.final.charCodeAt(0);if(t[0]>i||i>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=i,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let i=this._escHandlers[n];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let i=this._csiHandlers[n];return i.push(t),{dispose:()=>{let s=i.indexOf(t);s!==-1&&i.splice(s,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,i,s){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=i,this._parseStack.chunkPos=s}parse(e,t,n){let i=0,s=0,a=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let u=this._parseStack.handlers,f=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&f>-1){for(;f>=0&&(l=u[f](this._params),l!==!0);f--)if(l instanceof Promise)return this._parseStack.handlerPos=f,l}this._parseStack.handlers=[];break;case 4:if(n===!1&&f>-1){for(;f>=0&&(l=u[f](),l!==!0);f--)if(l instanceof Promise)return this._parseStack.handlerPos=f,l}this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(i!==24&&i!==26,n),l)return l;i===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],l=this._oscParser.end(i!==24&&i!==26,n),l)return l;i===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 u=a;u<t;++u){switch(i=e[u],s=this._transitions.table[this.currentState<<8|(i<160?i:Sr)],s>>4){case 2:for(let _=u+1;;++_){if(_>=t||(i=e[_])<32||i>126&&i<Sr){this._printHandler(e,u,_),u=_-1;break}if(++_>=t||(i=e[_])<32||i>126&&i<Sr){this._printHandler(e,u,_),u=_-1;break}if(++_>=t||(i=e[_])<32||i>126&&i<Sr){this._printHandler(e,u,_),u=_-1;break}if(++_>=t||(i=e[_])<32||i>126&&i<Sr){this._printHandler(e,u,_),u=_-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:u,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let f=this._csiHandlers[this._collect<<8|i],h=f?f.length-1:-1;for(;h>=0&&(l=f[h](this._params),l!==!0);h--)if(l instanceof Promise)return this._preserveStack(3,f,h,s,u),l;h<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingJoinState=0;break;case 8:do switch(i){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(i-48)}while(++u<t&&(i=e[u])>47&&i<60);u--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:let g=this._escHandlers[this._collect<<8|i],m=g?g.length-1:-1;for(;m>=0&&(l=g[m](),l!==!0);m--)if(l instanceof Promise)return this._preserveStack(4,g,m,s,u),l;m<0&&this._escHandlerFb(this._collect<<8|i),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|i,this._params);break;case 13:for(let _=u+1;;++_)if(_>=t||(i=e[_])===24||i===26||i===27||i>127&&i<Sr){this._dcsParser.put(e,u,_),u=_-1;break}break;case 14:if(l=this._dcsParser.unhook(i!==24&&i!==26),l)return this._preserveStack(6,[],0,s,u),l;i===27&&(s|=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 _=u+1;;_++)if(_>=t||(i=e[_])<32||i>127&&i<Sr){this._oscParser.put(e,u,_),u=_-1;break}break;case 6:if(l=this._oscParser.end(i!==24&&i!==26),l)return this._preserveStack(5,[],0,s,u),l;i===27&&(s|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=s&15}}},Mne=/^([\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})$/,Ine=/^[\da-f]+$/;function bT(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=Mne.exec(t);if(n){let i=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/i*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/i*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/i*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),Ine.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,i=[0,0,0];for(let s=0;s<3;++s){let a=parseInt(t.slice(n*s,n*s+n),16);i[s]=n===1?a<<4:n===2?a:n===3?a>>4:a>>8}return i}}function $_(e,t){let n=e.toString(16),i=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return i;case 12:return(i+i).slice(0,3);default:return i+i}}function Pne(e,t=16){let[n,i,s]=e;return`rgb:${$_(n,t)}/${$_(i,t)}/${$_(s,t)}`}var Lne={"(":0,")":1,"*":2,"+":3,"-":1,".":2},Go=131072,xT=10;function ST(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 wT=5e3,CT=0,Bne=class extends ot{constructor(e,t,n,i,s,a,l,u,f=new zne){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=i,this._optionsService=s,this._oscLinkService=a,this._coreMouseService=l,this._unicodeService=u,this._parser=f,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new ree,this._utf8Decoder=new see,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=_n.clone(),this._eraseAttrDataInternal=_n.clone(),this._onRequestBell=this._register(new be),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new be),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new be),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new be),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new be),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new be),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new be),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new be),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new be),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new be),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 Fx(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(h=>this._activeBuffer=h.activeBuffer)),this._parser.setCsiHandlerFallback((h,g)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(h),params:g.toArray()})}),this._parser.setEscHandlerFallback(h=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(h)})}),this._parser.setExecuteHandlerFallback(h=>{this._logService.debug("Unknown EXECUTE code: ",{code:h})}),this._parser.setOscHandlerFallback((h,g,m)=>{this._logService.debug("Unknown OSC code: ",{identifier:h,action:g,data:m})}),this._parser.setDcsHandlerFallback((h,g,m)=>{g==="HOOK"&&(m=m.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(h),action:g,payload:m})}),this._parser.setPrintHandler((h,g,m)=>this.print(h,g,m)),this._parser.registerCsiHandler({final:"@"},h=>this.insertChars(h)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},h=>this.scrollLeft(h)),this._parser.registerCsiHandler({final:"A"},h=>this.cursorUp(h)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},h=>this.scrollRight(h)),this._parser.registerCsiHandler({final:"B"},h=>this.cursorDown(h)),this._parser.registerCsiHandler({final:"C"},h=>this.cursorForward(h)),this._parser.registerCsiHandler({final:"D"},h=>this.cursorBackward(h)),this._parser.registerCsiHandler({final:"E"},h=>this.cursorNextLine(h)),this._parser.registerCsiHandler({final:"F"},h=>this.cursorPrecedingLine(h)),this._parser.registerCsiHandler({final:"G"},h=>this.cursorCharAbsolute(h)),this._parser.registerCsiHandler({final:"H"},h=>this.cursorPosition(h)),this._parser.registerCsiHandler({final:"I"},h=>this.cursorForwardTab(h)),this._parser.registerCsiHandler({final:"J"},h=>this.eraseInDisplay(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},h=>this.eraseInDisplay(h,!0)),this._parser.registerCsiHandler({final:"K"},h=>this.eraseInLine(h,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},h=>this.eraseInLine(h,!0)),this._parser.registerCsiHandler({final:"L"},h=>this.insertLines(h)),this._parser.registerCsiHandler({final:"M"},h=>this.deleteLines(h)),this._parser.registerCsiHandler({final:"P"},h=>this.deleteChars(h)),this._parser.registerCsiHandler({final:"S"},h=>this.scrollUp(h)),this._parser.registerCsiHandler({final:"T"},h=>this.scrollDown(h)),this._parser.registerCsiHandler({final:"X"},h=>this.eraseChars(h)),this._parser.registerCsiHandler({final:"Z"},h=>this.cursorBackwardTab(h)),this._parser.registerCsiHandler({final:"`"},h=>this.charPosAbsolute(h)),this._parser.registerCsiHandler({final:"a"},h=>this.hPositionRelative(h)),this._parser.registerCsiHandler({final:"b"},h=>this.repeatPrecedingCharacter(h)),this._parser.registerCsiHandler({final:"c"},h=>this.sendDeviceAttributesPrimary(h)),this._parser.registerCsiHandler({prefix:">",final:"c"},h=>this.sendDeviceAttributesSecondary(h)),this._parser.registerCsiHandler({final:"d"},h=>this.linePosAbsolute(h)),this._parser.registerCsiHandler({final:"e"},h=>this.vPositionRelative(h)),this._parser.registerCsiHandler({final:"f"},h=>this.hVPosition(h)),this._parser.registerCsiHandler({final:"g"},h=>this.tabClear(h)),this._parser.registerCsiHandler({final:"h"},h=>this.setMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"h"},h=>this.setModePrivate(h)),this._parser.registerCsiHandler({final:"l"},h=>this.resetMode(h)),this._parser.registerCsiHandler({prefix:"?",final:"l"},h=>this.resetModePrivate(h)),this._parser.registerCsiHandler({final:"m"},h=>this.charAttributes(h)),this._parser.registerCsiHandler({final:"n"},h=>this.deviceStatus(h)),this._parser.registerCsiHandler({prefix:"?",final:"n"},h=>this.deviceStatusPrivate(h)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},h=>this.softReset(h)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},h=>this.setCursorStyle(h)),this._parser.registerCsiHandler({final:"r"},h=>this.setScrollRegion(h)),this._parser.registerCsiHandler({final:"s"},h=>this.saveCursor(h)),this._parser.registerCsiHandler({final:"t"},h=>this.windowOptions(h)),this._parser.registerCsiHandler({final:"u"},h=>this.restoreCursor(h)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},h=>this.insertColumns(h)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},h=>this.deleteColumns(h)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},h=>this.selectProtected(h)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},h=>this.requestMode(h,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},h=>this.requestMode(h,!1)),this._parser.setExecuteHandler(fe.BEL,()=>this.bell()),this._parser.setExecuteHandler(fe.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(fe.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(fe.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(fe.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(fe.BS,()=>this.backspace()),this._parser.setExecuteHandler(fe.HT,()=>this.tab()),this._parser.setExecuteHandler(fe.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(fe.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Pp.IND,()=>this.index()),this._parser.setExecuteHandler(Pp.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Pp.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Qi(h=>(this.setTitle(h),this.setIconName(h),!0))),this._parser.registerOscHandler(1,new Qi(h=>this.setIconName(h))),this._parser.registerOscHandler(2,new Qi(h=>this.setTitle(h))),this._parser.registerOscHandler(4,new Qi(h=>this.setOrReportIndexedColor(h))),this._parser.registerOscHandler(8,new Qi(h=>this.setHyperlink(h))),this._parser.registerOscHandler(10,new Qi(h=>this.setOrReportFgColor(h))),this._parser.registerOscHandler(11,new Qi(h=>this.setOrReportBgColor(h))),this._parser.registerOscHandler(12,new Qi(h=>this.setOrReportCursorColor(h))),this._parser.registerOscHandler(104,new Qi(h=>this.restoreIndexedColor(h))),this._parser.registerOscHandler(110,new Qi(h=>this.restoreFgColor(h))),this._parser.registerOscHandler(111,new Qi(h=>this.restoreBgColor(h))),this._parser.registerOscHandler(112,new Qi(h=>this.restoreCursorColor(h))),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 h in jn)this._parser.registerEscHandler({intermediates:"(",final:h},()=>this.selectCharset("("+h)),this._parser.registerEscHandler({intermediates:")",final:h},()=>this.selectCharset(")"+h)),this._parser.registerEscHandler({intermediates:"*",final:h},()=>this.selectCharset("*"+h)),this._parser.registerEscHandler({intermediates:"+",final:h},()=>this.selectCharset("+"+h)),this._parser.registerEscHandler({intermediates:"-",final:h},()=>this.selectCharset("-"+h)),this._parser.registerEscHandler({intermediates:".",final:h},()=>this.selectCharset("."+h)),this._parser.registerEscHandler({intermediates:"/",final:h},()=>this.selectCharset("/"+h));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(h=>(this._logService.error("Parsing error: ",h),h)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new _T((h,g)=>this.requestStatusString(h,g)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,i){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=i}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),wT))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${wT} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,i=this._activeBuffer.x,s=this._activeBuffer.y,a=0,l=this._parseStack.paused;if(l){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;i=this._parseStack.cursorStartX,s=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>Go&&(a=this._parseStack.position+Go)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,h=>String.fromCharCode(h)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(h=>h.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<Go&&(this._parseBuffer=new Uint32Array(Math.min(e.length,Go))),l||this._dirtyRowTracker.clearRange(),e.length>Go)for(let h=a;h<e.length;h+=Go){let g=h+Go<e.length?h+Go:e.length,m=typeof e=="string"?this._stringDecoder.decode(e.substring(h,g),this._parseBuffer):this._utf8Decoder.decode(e.subarray(h,g),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,m))return this._preserveStack(i,s,m,h),this._logSlowResolvingAsync(n),n}else if(!l){let h=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,h))return this._preserveStack(i,s,h,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==i||this._activeBuffer.y!==s)&&this._onCursorMove.fire();let u=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),f=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);f<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(f,this._bufferService.rows-1),end:Math.min(u,this._bufferService.rows-1)})}print(e,t,n){let i,s,a=this._charsetService.charset,l=this._optionsService.rawOptions.screenReaderMode,u=this._bufferService.cols,f=this._coreService.decPrivateModes.wraparound,h=this._coreService.modes.insertMode,g=this._curAttrData,m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,g);let _=this._parser.precedingJoinState;for(let b=t;b<n;++b){if(i=e[b],i<127&&a){let k=a[String.fromCharCode(i)];k&&(i=k.charCodeAt(0))}let x=this._unicodeService.charProperties(i,_);s=tl.extractWidth(x);let S=tl.extractShouldJoin(x),C=S?tl.extractWidth(_):0;if(_=x,l&&this._onA11yChar.fire(Xo(i)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+s-C>u){if(f){let k=m,R=this._activeBuffer.x-C;for(this._activeBuffer.x=C,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),C>0&&m instanceof Cd&&m.copyCellsFrom(k,R,0,C,!1);R<u;)k.setCellFromCodepoint(R++,0,1,g)}else if(this._activeBuffer.x=u-1,s===2)continue}if(S&&this._activeBuffer.x){let k=m.getWidth(this._activeBuffer.x-1)?1:2;m.addCodepointToCell(this._activeBuffer.x-k,i,s);for(let R=s-C;--R>=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,g);continue}if(h&&(m.insertCells(this._activeBuffer.x,s-C,this._activeBuffer.getNullCell(g)),m.getWidth(u-1)===2&&m.setCellFromCodepoint(u-1,0,1,g)),m.setCellFromCodepoint(this._activeBuffer.x++,i,s,g),s>0)for(;--s;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,g)}this._parser.precedingJoinState=_,this._activeBuffer.x<u&&n-t>0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,g),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>ST(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new _T(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new Qi(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)?.isWrapped){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,i=!1,s=!1){let a=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);a.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),s),i&&(a.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!this._activeBuffer.lines.get(this._activeBuffer.ybase+n)?.getTrimmedLength(););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-i+1;for(;t--;)this._activeBuffer.lines.splice(s-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,i;for(i=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-i;t--;)this._activeBuffer.lines.splice(n,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}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(_n));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let i=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);i.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),i.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,i=tl.extractWidth(t),s=this._activeBuffer.x-i,a=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(s),l=new Uint32Array(a.length*n),u=0;for(let h=0;h<a.length;){let g=a.codePointAt(h)||0;l[u++]=g,h+=g>65535?2:1}let f=u;for(let h=1;h<n;++h)l.copyWithin(f,0,u),f+=u;return this.print(l,0,f),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(fe.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(fe.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(fe.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(fe.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(fe.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,Ya),this._charsetService.setgCharset(1,Ya),this._charsetService.setgCharset(2,Ya),this._charsetService.setgCharset(3,Ya);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){let n;(S=>(S[S.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",S[S.SET=1]="SET",S[S.RESET=2]="RESET",S[S.PERMANENTLY_SET=3]="PERMANENTLY_SET",S[S.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(n||={});let i=this._coreService.decPrivateModes,{activeProtocol:s,activeEncoding:a}=this._coreMouseService,l=this._coreService,{buffers:u,cols:f}=this._bufferService,{active:h,alt:g}=u,m=this._optionsService.rawOptions,_=(S,C)=>(l.triggerDataEvent(`${fe.ESC}[${t?"":"?"}${S};${C}$y`),!0),b=S=>S?1:2,x=e.params[0];return t?x===2?_(x,4):x===4?_(x,b(l.modes.insertMode)):x===12?_(x,3):x===20?_(x,b(m.convertEol)):_(x,0):x===1?_(x,b(i.applicationCursorKeys)):x===3?_(x,m.windowOptions.setWinLines?f===80?2:f===132?1:0:0):x===6?_(x,b(i.origin)):x===7?_(x,b(i.wraparound)):x===8?_(x,3):x===9?_(x,b(s==="X10")):x===12?_(x,b(m.cursorBlink)):x===25?_(x,b(!l.isCursorHidden)):x===45?_(x,b(i.reverseWraparound)):x===66?_(x,b(i.applicationKeypad)):x===67?_(x,4):x===1e3?_(x,b(s==="VT200")):x===1002?_(x,b(s==="DRAG")):x===1003?_(x,b(s==="ANY")):x===1004?_(x,b(i.sendFocus)):x===1005?_(x,4):x===1006?_(x,b(a==="SGR")):x===1015?_(x,4):x===1016?_(x,b(a==="SGR_PIXELS")):x===1048?_(x,1):x===47||x===1047||x===1049?_(x,b(h===g)):x===2004?_(x,b(i.bracketedPasteMode)):x===2026?_(x,b(i.synchronizedOutput)):_(x,0)}_updateAttrColor(e,t,n,i,s){return t===2?(e|=50331648,e&=-16777216,e|=th.fromColorRGB([n,i,s])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let i=[0,0,-1,0,0,0],s=0,a=0;do{if(i[a+s]=e.params[t+a],e.hasSubParams(t+a)){let l=e.getSubParams(t+a),u=0;do i[1]===5&&(s=1),i[a+u+1+s]=l[u];while(++u<l.length&&u+a+1+s<i.length);break}if(i[1]===5&&a+s>=2||i[1]===2&&a+s>=5)break;i[1]&&(s=1)}while(++a+t<e.length&&a+s<i.length);for(let l=2;l<i.length;++l)i[l]===-1&&(i[l]=0);switch(i[0]){case 38:n.fg=this._updateAttrColor(n.fg,i[1],i[3],i[4],i[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,i[1],i[3],i[4],i[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,i[1],i[3],i[4],i[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=_n.fg,e.bg=_n.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,i=this._curAttrData;for(let s=0;s<t;s++)n=e.params[s],n>=30&&n<=37?(i.fg&=-50331904,i.fg|=16777216|n-30):n>=40&&n<=47?(i.bg&=-50331904,i.bg|=16777216|n-40):n>=90&&n<=97?(i.fg&=-50331904,i.fg|=16777216|n-90|8):n>=100&&n<=107?(i.bg&=-50331904,i.bg|=16777216|n-100|8):n===0?this._processSGR0(i):n===1?i.fg|=134217728:n===3?i.bg|=67108864:n===4?(i.fg|=268435456,this._processUnderline(e.hasSubParams(s)?e.getSubParams(s)[0]:1,i)):n===5?i.fg|=536870912:n===7?i.fg|=67108864:n===8?i.fg|=1073741824:n===9?i.fg|=2147483648:n===2?i.bg|=134217728:n===21?this._processUnderline(2,i):n===22?(i.fg&=-134217729,i.bg&=-134217729):n===23?i.bg&=-67108865:n===24?(i.fg&=-268435457,this._processUnderline(0,i)):n===25?i.fg&=-536870913:n===27?i.fg&=-67108865:n===28?i.fg&=-1073741825:n===29?i.fg&=2147483647:n===39?(i.fg&=-67108864,i.fg|=_n.fg&16777215):n===49?(i.bg&=-67108864,i.bg|=_n.bg&16777215):n===38||n===48||n===58?s+=this._extractColor(e,s,i):n===53?i.bg|=1073741824:n===55?i.bg&=-1073741825:n===59?(i.extended=i.extended.clone(),i.extended.underlineColor=-1,i.updateExtended()):n===100?(i.fg&=-67108864,i.fg|=_n.fg&16777215,i.bg&=-67108864,i.bg|=_n.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${fe.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${fe.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){if(e.params[0]===6){let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${fe.ESC}[?${t};${n}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=_n.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!ST(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(`${fe.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>xT&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>xT&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let i=n.shift(),s=n.shift();if(/^\d+$/.exec(i)){let a=parseInt(i);if(kT(a))if(s==="?")t.push({type:0,index:a});else{let l=bT(s);l&&t.push({type:1,index:a,color:l})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),i=e.slice(t+1);return i?this._createHyperlink(n,i):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),i,s=n.findIndex(a=>a.startsWith("id="));return s!==-1&&(i=n[s].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:i,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let i=0;i<n.length&&!(t>=this._specialColors.length);++i,++t)if(n[i]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let s=bT(n[i]);s&&this._onColor.fire([{type:1,index:this._specialColors[t],color:s}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let i=0;i<n.length;++i)if(/^\d+$/.exec(n[i])){let s=parseInt(n[i]);kT(s)&&t.push({type:2,index:s})}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,Ya),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(Lne[e[0]],jn[e[1]]||Ya),!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=_n.clone(),this._eraseAttrDataInternal=_n.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 kr;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,i=this._activeBuffer.lines.get(n);i&&(i.fill(e),i.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=l=>(this._coreService.triggerDataEvent(`${fe.ESC}${l}${fe.ESC}\\`),!0),i=this._bufferService.buffer,s=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${i.scrollTop+1};${i.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[s.cursorStyle]-(s.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},Fx=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&&(CT=e,e=t,t=CT),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};Fx=an([ke(0,Ci)],Fx);function kT(e){return 0<=e&&e<256}var Fne=5e7,ET=12,Une=50,Hne=class extends ot{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 be),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(t!==void 0&&this._syncCalls>t){this._syncCalls=0;return}if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let n;for(;n=this._writeBuffer.shift();){this._action(n);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Fne)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput){this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){let n=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,t);if(s){let l=u=>performance.now()-n>=ET?setTimeout(()=>this._innerWrite(0,u)):this._innerWrite(n,u);s.catch(u=>(queueMicrotask(()=>{throw u}),Promise.resolve(!1))).then(l);return}let a=this._callbacks[this._bufferOffset];if(a&&a(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-n>=ET)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Une&&(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()}},Ux=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 u=t.addMarker(t.ybase+t.y),f={data:e,id:this._nextId++,lines:[u]};return u.onDispose(()=>this._removeMarkerFromLink(f,u)),this._dataByLinkId.set(f.id,f),f.id}let n=e,i=this._getEntryIdKey(n),s=this._entriesWithId.get(i);if(s)return this.addLineToLink(s.id,t.ybase+t.y),s.id;let a=t.addMarker(t.ybase+t.y),l={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(l,a)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(i=>i.line!==t)){let i=this._bufferService.buffer.addMarker(t);n.lines.push(i),i.onDispose(()=>this._removeMarkerFromLink(n,i))}}getLinkData(e){return this._dataByLinkId.get(e)?.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};Ux=an([ke(0,Ci)],Ux);var NT=!1,$ne=class extends ot{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new qc),this._onBinary=this._register(new be),this.onBinary=this._onBinary.event,this._onData=this._register(new be),this.onData=this._onData.event,this._onLineFeed=this._register(new be),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new be),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new be),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new be),this._instantiationService=new fne,this.optionsService=this._register(new wne(e)),this._instantiationService.setService(ki,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Ix)),this._instantiationService.setService(Ci,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Mx)),this._instantiationService.setService(iI,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Px)),this._instantiationService.setService(Sl,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(Lx)),this._instantiationService.setService(nI,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(tl)),this._instantiationService.setService(cee,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Rne),this._instantiationService.setService(lee,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(Ux),this._instantiationService.setService(rI,this._oscLinkService),this._inputHandler=this._register(new Bne(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(ni.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(ni.forward(this._bufferService.onResize,this._onResize)),this._register(ni.forward(this.coreService.onData,this._onData)),this._register(ni.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 Hne((t,n)=>this._inputHandler.parse(t,n))),this._register(ni.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new be),this._onScroll.event(e=>{this._onScrollApi?.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(let t in e)this.optionsService.options[t]=e[t]}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=3&&!NT&&(this._logService.warn("writeSync is unreliable and will be removed soon."),NT=!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,II),t=Math.max(t,PI),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(yT.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(yT(this._bufferService),!1))),this._windowsWrappingHeuristics.value=Vt(()=>{for(let t of e)t.dispose()})}}},qne={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 Wne(e,t,n,i){let s={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?s.key=fe.ESC+"OA":s.key=fe.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?s.key=fe.ESC+"OD":s.key=fe.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?s.key=fe.ESC+"OC":s.key=fe.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?s.key=fe.ESC+"OB":s.key=fe.ESC+"[B");break;case 8:s.key=e.ctrlKey?"\b":fe.DEL,e.altKey&&(s.key=fe.ESC+s.key);break;case 9:if(e.shiftKey){s.key=fe.ESC+"[Z";break}s.key=fe.HT,s.cancel=!0;break;case 13:s.key=e.altKey?fe.ESC+fe.CR:fe.CR,s.cancel=!0;break;case 27:s.key=fe.ESC,e.altKey&&(s.key=fe.ESC+fe.ESC),s.cancel=!0;break;case 37:if(e.metaKey)break;a?s.key=fe.ESC+"[1;"+(a+1)+"D":t?s.key=fe.ESC+"OD":s.key=fe.ESC+"[D";break;case 39:if(e.metaKey)break;a?s.key=fe.ESC+"[1;"+(a+1)+"C":t?s.key=fe.ESC+"OC":s.key=fe.ESC+"[C";break;case 38:if(e.metaKey)break;a?s.key=fe.ESC+"[1;"+(a+1)+"A":t?s.key=fe.ESC+"OA":s.key=fe.ESC+"[A";break;case 40:if(e.metaKey)break;a?s.key=fe.ESC+"[1;"+(a+1)+"B":t?s.key=fe.ESC+"OB":s.key=fe.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(s.key=fe.ESC+"[2~");break;case 46:a?s.key=fe.ESC+"[3;"+(a+1)+"~":s.key=fe.ESC+"[3~";break;case 36:a?s.key=fe.ESC+"[1;"+(a+1)+"H":t?s.key=fe.ESC+"OH":s.key=fe.ESC+"[H";break;case 35:a?s.key=fe.ESC+"[1;"+(a+1)+"F":t?s.key=fe.ESC+"OF":s.key=fe.ESC+"[F";break;case 33:e.shiftKey?s.type=2:e.ctrlKey?s.key=fe.ESC+"[5;"+(a+1)+"~":s.key=fe.ESC+"[5~";break;case 34:e.shiftKey?s.type=3:e.ctrlKey?s.key=fe.ESC+"[6;"+(a+1)+"~":s.key=fe.ESC+"[6~";break;case 112:a?s.key=fe.ESC+"[1;"+(a+1)+"P":s.key=fe.ESC+"OP";break;case 113:a?s.key=fe.ESC+"[1;"+(a+1)+"Q":s.key=fe.ESC+"OQ";break;case 114:a?s.key=fe.ESC+"[1;"+(a+1)+"R":s.key=fe.ESC+"OR";break;case 115:a?s.key=fe.ESC+"[1;"+(a+1)+"S":s.key=fe.ESC+"OS";break;case 116:a?s.key=fe.ESC+"[15;"+(a+1)+"~":s.key=fe.ESC+"[15~";break;case 117:a?s.key=fe.ESC+"[17;"+(a+1)+"~":s.key=fe.ESC+"[17~";break;case 118:a?s.key=fe.ESC+"[18;"+(a+1)+"~":s.key=fe.ESC+"[18~";break;case 119:a?s.key=fe.ESC+"[19;"+(a+1)+"~":s.key=fe.ESC+"[19~";break;case 120:a?s.key=fe.ESC+"[20;"+(a+1)+"~":s.key=fe.ESC+"[20~";break;case 121:a?s.key=fe.ESC+"[21;"+(a+1)+"~":s.key=fe.ESC+"[21~";break;case 122:a?s.key=fe.ESC+"[23;"+(a+1)+"~":s.key=fe.ESC+"[23~";break;case 123:a?s.key=fe.ESC+"[24;"+(a+1)+"~":s.key=fe.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?s.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?s.key=fe.NUL:e.keyCode>=51&&e.keyCode<=55?s.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?s.key=fe.DEL:e.keyCode===219?s.key=fe.ESC:e.keyCode===220?s.key=fe.FS:e.keyCode===221&&(s.key=fe.GS);else if((!n||i)&&e.altKey&&!e.metaKey){let l=qne[e.keyCode]?.[e.shiftKey?1:0];if(l)s.key=fe.ESC+l;else if(e.keyCode>=65&&e.keyCode<=90){let u=e.ctrlKey?e.keyCode-64:e.keyCode+32,f=String.fromCharCode(u);e.shiftKey&&(f=f.toUpperCase()),s.key=fe.ESC+f}else if(e.keyCode===32)s.key=fe.ESC+(e.ctrlKey?fe.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let u=e.code.slice(3,4);e.shiftKey||(u=u.toLowerCase()),s.key=fe.ESC+u,s.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(s.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?s.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(s.key=fe.US),e.key==="@"&&(s.key=fe.NUL));break}return s}var cn=0,Kne=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new hm,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new hm,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((s,a)=>this._getKey(s)-this._getKey(a)),t=0,n=0,i=new Array(this._array.length+this._insertedValues.length);for(let s=0;s<i.length;s++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(i[s]=e[t],t++):i[s]=this._array[n++];this._array=i,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||(cn=this._search(t),cn===-1)||this._getKey(this._array[cn])!==t)return!1;do if(this._array[cn]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(cn),!0;while(++cn<this._array.length&&this._getKey(this._array[cn])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((s,a)=>s-a),t=0,n=new Array(this._array.length-e.length),i=0;for(let s=0;s<this._array.length;s++)e[t]===s?t++:n[i++]=this._array[s];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(cn=this._search(e),!(cn<0||cn>=this._array.length)&&this._getKey(this._array[cn])===e))do yield this._array[cn];while(++cn<this._array.length&&this._getKey(this._array[cn])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(cn=this._search(e),!(cn<0||cn>=this._array.length)&&this._getKey(this._array[cn])===e))do t(this._array[cn]);while(++cn<this._array.length&&this._getKey(this._array[cn])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let i=t+n>>1,s=this._getKey(this._array[i]);if(s>e)n=i-1;else if(s<e)t=i+1;else{for(;i>0&&this._getKey(this._array[i-1])===e;)i--;return i}}return t}},q_=0,RT=0,Vne=class extends ot{constructor(){super(),this._decorations=new Kne(e=>e?.marker.line),this._onDecorationRegistered=this._register(new be),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new be),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(Vt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new Gne(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),i=t.onDispose(()=>{i.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let i=0,s=0;for(let a of this._decorations.getKeyIterator(t))i=a.options.x??0,s=i+(a.options.width??1),e>=i&&e<s&&(!n||(a.options.layer??"bottom")===n)&&(yield a)}forEachDecorationAtCell(e,t,n,i){this._decorations.forEachByKey(t,s=>{q_=s.options.x??0,RT=q_+(s.options.width??1),e>=q_&&e<RT&&(!n||(s.options.layer??"bottom")===n)&&i(s)})}},Gne=class extends ia{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new be),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new be),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=Xt.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Xt.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Zne=1e3,Yne=class{constructor(e,t=Zne){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let i=performance.now();if(i-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=i,this._innerRefresh();else if(!this._additionalRefreshRequested){let s=i-this._lastRefreshMs,a=this._debounceThresholdMS-s;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)}},TT=20,fm=class extends ot{constructor(e,t,n,i){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=i,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let s=this._coreBrowserService.mainDocument;this._accessibilityContainer=s.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=s.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=s.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Yne(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(`
124
- `))),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($e(s,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(Vt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<TT+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
125
- `&&(this._liveRegionLineCount++,this._liveRegionLineCount===TT+1&&(this._liveRegion.textContent+=ax.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,i=n.lines.length.toString();for(let s=e;s<=t;s++){let a=n.lines.get(n.ydisp+s),l=[],u=a?.translateToString(!0,void 0,void 0,l)||"",f=(n.ydisp+s+1).toString(),h=this._rowElements[s];h&&(u.length===0?(h.textContent=" ",this._rowColumns.set(h,[0,1])):(h.textContent=u,this._rowColumns.set(h,l)),h.setAttribute("aria-posinset",f),h.setAttribute("aria-setsize",i),this._alignRowWidth(h))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,i=this._rowElements[t===0?1:this._rowElements.length-2],s=n.getAttribute("aria-posinset"),a=t===0?"1":`${this._terminal.buffer.lines.length}`;if(s===a||e.relatedTarget!==i)return;let l,u;if(t===0?(l=n,u=this._rowElements.pop(),this._rowContainer.removeChild(u)):(l=this._rowElements.shift(),u=n,this._rowContainer.removeChild(l)),l.removeEventListener("focus",this._topBoundaryFocusListener),u.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let f=this._createAccessibilityTreeNode();this._rowElements.unshift(f),this._rowContainer.insertAdjacentElement("afterbegin",f)}else{let f=this._createAccessibilityTreeNode();this._rowElements.push(f),this._rowContainer.appendChild(f)}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(){if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let i=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(i)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:i,offset:i.textContent?.length??0}),!this._rowContainer.contains(n.node))return;let s=({node:u,offset:f})=>{let h=u instanceof Text?u.parentNode:u,g=parseInt(h?.getAttribute("aria-posinset"),10)-1;if(isNaN(g))return console.warn("row is invalid. Race condition?"),null;let m=this._rowColumns.get(h);if(!m)return console.warn("columns is null. Race condition?"),null;let _=f<m.length?m[f]:m.slice(-1)[0]+1;return _>=this._terminal.cols&&(++g,_=0),{row:g,column:_}},a=s(t),l=s(n);if(!(!a||!l)){if(a.row>l.row||a.row===l.row&&a.column>=l.column)throw new Error("invalid range");this._terminal.select(a.column,a.row,(l.row-a.row)*this._terminal.cols-a.column+l.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){e.style.transform="";let t=e.getBoundingClientRect().width,n=this._rowColumns.get(e)?.slice(-1)?.[0];if(!n)return;let i=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${i/t})`}};fm=an([ke(1,q1),ke(2,fo),ke(3,po)],fm);var Hx=class extends ot{constructor(e,t,n,i,s){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=i,this._linkProviderService=s,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new be),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new be),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(Vt(()=>{fl(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register($e(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register($e(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register($e(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register($e(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let i=0;i<n.length;i++){let s=n[i];if(s.classList.contains("xterm"))break;if(s.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){(!this._activeProviderReplies||!t)&&(this._activeProviderReplies?.forEach(i=>{i?.forEach(s=>{s.link.dispose&&s.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[i,s]of this._linkProviderService.linkProviders.entries())t?this._activeProviderReplies?.get(i)&&(n=this._checkLinkProviderResult(i,e,n)):s.provideLinks(e.y,a=>{if(this._isMouseOut)return;let l=a?.map(u=>({link:u}));this._activeProviderReplies?.set(i,l),n=this._checkLinkProviderResult(i,e,n),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let i=0;i<t.size;i++){let s=t.get(i);if(s)for(let a=0;a<s.length;a++){let l=s[a],u=l.link.range.start.y<e?0:l.link.range.start.x,f=l.link.range.end.y>e?this._bufferService.cols:l.link.range.end.x;for(let h=u;h<=f;h++){if(n.has(h)){s.splice(a--,1);break}n.add(h)}}}}_checkLinkProviderResult(e,t,n){if(!this._activeProviderReplies)return n;let i=this._activeProviderReplies.get(e),s=!1;for(let a=0;a<e;a++)(!this._activeProviderReplies.has(a)||this._activeProviderReplies.get(a))&&(s=!0);if(!s&&i){let a=i.find(l=>this._linkAtPosition(l.link,t));a&&(n=!0,this._handleNewLink(a))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let a=0;a<this._activeProviderReplies.size;a++){let l=this._activeProviderReplies.get(a)?.find(u=>this._linkAtPosition(u.link,t));if(l){n=!0,this._handleNewLink(l);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&Xne(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,fl(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:()=>this._currentLink?.state?.decorations.pointerCursor,set:n=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:n=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let i=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,s=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=s&&(this._clearCurrentLink(i,s),this._lastMouseEvent)){let a=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);a&&this._askForLink(a,!1)}})))}_linkHover(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,i=this._bufferService.buffer.ydisp,s=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-i-1,n.end.x,n.end.y-i-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(s)}_linkLeave(e,t,n){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,i=e.range.end.y*this._bufferService.cols+e.range.end.x,s=t.y*this._bufferService.cols+t.x;return n<=s&&s<=i}_positionFromMouseEvent(e,t,n){let i=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(i)return{x:i[0],y:i[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,i,s){return{x1:e,y1:t,x2:n,y2:i,cols:this._bufferService.cols,fg:s}}};Hx=an([ke(1,W1),ke(2,po),ke(3,Ci),ke(4,oI)],Hx);function Xne(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 Qne=class extends $ne{constructor(e={}){super(e),this._linkifier=this._register(new qc),this.browser=kI,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new qc),this._onCursorMove=this._register(new be),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new be),this.onKey=this._onKey.event,this._onRender=this._register(new be),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new be),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new be),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new be),this.onBell=this._onBell.event,this._onFocus=this._register(new be),this._onBlur=this._register(new be),this._onA11yCharEmitter=this._register(new be),this._onA11yTabEmitter=this._register(new be),this._onWillOpen=this._register(new be),this._setup(),this._decorationService=this._instantiationService.createInstance(Vne),this._instantiationService.setService(nh,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Ute),this._instantiationService.setService(oI,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(cx)),this._register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this._register(this._inputHandler.onRequestRefreshRows(t=>this.refresh(t?.start??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(ni.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(ni.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(ni.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(ni.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(Vt(()=>{this._customKeyEventHandler=void 0,this.element?.parentNode?.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,i="";switch(t.index){case 256:n="foreground",i="10";break;case 257:n="background",i="11";break;case 258:n="cursor",i="12";break;default:n="ansi",i="4;"+t.index}switch(t.type){case 0:let s=Ft.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${fe.ESC}]${i};${Pne(s)}${wI.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(a=>a.ansi[t.index]=bn.toColor(...t.color));else{let a=n;this._themeService.modifyColors(l=>l[a]=bn.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(fm,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(fe.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){return this.textarea?.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(fe.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),i=this._renderService.dimensions.css.cell.height,s=t.getWidth(n),a=this._renderService.dimensions.css.cell.width*s,l=this.buffer.y*this._renderService.dimensions.css.cell.height,u=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=u+"px",this.textarea.style.top=l+"px",this.textarea.style.width=a+"px",this.textarea.style.height=i+"px",this.textarea.style.lineHeight=i+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register($e(this.element,"copy",t=>{this.hasSelection()&&nee(t,this._selectionService)}));let e=t=>iee(t,this.textarea,this.coreService,this.optionsService);this._register($e(this.textarea,"paste",e)),this._register($e(this.element,"paste",e)),EI?this._register($e(this.element,"mousedown",t=>{t.button===2&&BR(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register($e(this.element,"contextmenu",t=>{BR(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),J1&&this._register($e(this.element,"auxclick",t=>{t.button===1&&X3(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register($e(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register($e(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register($e(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register($e(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register($e(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register($e(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register($e(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){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"),this.element?.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($e(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",ox.get()),TI||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(Bte,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(fo,this._coreBrowserService),this._register($e(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register($e(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Dx,this._document,this._helperContainer),this._instantiationService.setService(ng,this._charSizeService),this._themeService=this._instantiationService.createInstance(zx),this._instantiationService.setService(iu,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(um),this._instantiationService.setService(sI,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Ox,this.rows,this.screenElement)),this._instantiationService.setService(po,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(Nx,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Ax),this._instantiationService.setService(W1,this._mouseService);let i=this._linkifier.value=this._register(this._instantiationService.createInstance(Hx,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(kx,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(jx,this.element,this.screenElement,i)),this._instantiationService.setService(dee,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(ni.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{this._selectionService.refresh(),this._viewport?.queueSync()})),this._register(this._instantiationService.createInstance(Ex,this.screenElement)),this._register($e(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(fm,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(cm,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(cm,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(Tx,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(a){let l=e._mouseService.getMouseReportCoords(a,e.screenElement);if(!l)return!1;let u,f;switch(a.overrideType||a.type){case"mousemove":f=32,a.buttons===void 0?(u=3,a.button!==void 0&&(u=a.button<3?a.button:3)):u=a.buttons&1?0:a.buttons&4?1:a.buttons&2?2:3;break;case"mouseup":f=0,u=a.button<3?a.button:3;break;case"mousedown":f=1,u=a.button<3?a.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(a)===!1)return!1;let h=a.deltaY;if(h===0||e.coreMouseService.consumeWheelEvent(a,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return!1;f=h<0?0:1,u=4;break;default:return!1}return f===void 0||u===void 0||u>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:u,action:f,ctrl:a.ctrlKey,alt:a.altKey,shift:a.shiftKey})}let i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},s={mouseup:a=>(n(a),a.buttons||(this._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.removeEventListener("mousemove",i.mousedrag)),this.cancel(a)),wheel:a=>(n(a),this.cancel(a,!0)),mousedrag:a=>{a.buttons&&n(a)},mousemove:a=>{a.buttons||n(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?i.mousemove||(t.addEventListener("mousemove",s.mousemove),i.mousemove=s.mousemove):(t.removeEventListener("mousemove",i.mousemove),i.mousemove=null),a&16?i.wheel||(t.addEventListener("wheel",s.wheel,{passive:!1}),i.wheel=s.wheel):(t.removeEventListener("wheel",i.wheel),i.wheel=null),a&2?i.mouseup||(i.mouseup=s.mouseup):(this._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),a&4?i.mousedrag||(i.mousedrag=s.mousedrag):(this._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register($e(t,"mousedown",a=>{if(a.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(a)))return n(a),i.mouseup&&this._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&this._document.addEventListener("mousemove",i.mousedrag),this.cancel(a)})),this._register($e(t,"wheel",a=>{if(!i.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,e._renderService?.dimensions?.device?.cell?.height,e._coreBrowserService?.dpr)===0)return this.cancel(a,!0);let l=fe.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(a.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(l,!0),this.cancel(a,!0)}}},{passive:!1}))}refresh(e,t){this._renderService?.refreshRows(e,t)}updateCursorStyle(e){this._selectionService?.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){Y3(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){this._selectionService?.clearSelection()}selectAll(){this._selectionService?.selectAll()}selectLines(e,t){this._selectionService?.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=Wne(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let i=this.rows-1;return this.scrollLines(n.type===2?-i:i),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===fe.ETX||n.key===fe.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Jne(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){this._charSizeService?.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(_n));this._onScroll.fire({position:this.buffer.ydisp}),this.refresh(0,this.rows-1)}}reset(){this.options.rows=this.rows,this.options.cols=this.cols;let e=this._customKeyEventHandler;this._setup(),super.reset(),this._selectionService?.reset(),this._decorationService.reset(),this._customKeyEventHandler=e,this.refresh(0,this.rows-1)}clearTextureAtlas(){this._renderService?.clearTextureAtlas()}_reportFocus(){this.element?.classList.contains("focus")?this.coreService.triggerDataEvent(fe.ESC+"[I"):this.coreService.triggerDataEvent(fe.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${fe.ESC}[4;${n};${t}t`);break;case 1:let i=this._renderService.dimensions.css.cell.width.toFixed(0),s=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${fe.ESC}[6;${s};${i}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Jne(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var eie=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},tie=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 kr)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},DT=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 tie(t)}getNullCell(){return new kr}},nie=class extends ot{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new be),this.onBufferChange=this._onBufferChange.event,this._normal=new DT(this._core.buffers.normal,"normal"),this._alternate=new DT(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)}},iie=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,i)=>t(n,i.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)}},rie=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}},sie=["cols","rows"],as=0,oie=class extends ot{constructor(e){super(),this._core=this._register(new Qne(e)),this._addonManager=this._register(new eie),this._publicOptions={...this._core.options};let t=i=>this._core.options[i],n=(i,s)=>{this._checkReadonlyOptions(i),this._core.options[i]=s};for(let i in this._core.options){let s={get:t.bind(this,i),set:n.bind(this,i)};Object.defineProperty(this._publicOptions,i,s)}}_checkReadonlyOptions(e){if(sie.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 iie(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new rie(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 nie(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
126
- `,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 ox.get()},set promptLabel(e){ox.set(e)},get tooMuchOutput(){return ax.get()},set tooMuchOutput(e){ax.set(e)}}}_verifyIntegers(...e){for(as of e)if(as===1/0||isNaN(as)||as%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(as of e)if(as&&(as===1/0||isNaN(as)||as%1!==0||as<0))throw new Error("This API only accepts positive integers")}};const BI=w.createContext(null);function aie({children:e,windows:t}){const[n]=w.useState(()=>new Map);return w.useEffect(()=>{if(!n.size)return;const i=new Set(t.flatMap(s=>s.tabs.map(a=>a.id)));for(const[s,a]of n)i.has(s)||(a.terminal.dispose(),n.delete(s))},[n,t]),w.useEffect(()=>()=>{for(const i of n.values())i.terminal.dispose();n.clear()},[n]),p.jsx(BI.Provider,{value:n,children:e})}function lie(){const e=w.useContext(BI);if(!e)throw new Error("Terminal screen provider is missing");return e}function cie(){const e=new oie({fontSize:12,fontFamily:"ui-monospace, Menlo, monospace",cursorBlink:!0,scrollback:2e3,disableStdin:!0,theme:{background:"#0f1115",foreground:"#d7dae0"}}),t=new XJ;return e.loadAddon(t),{terminal:e,fit:t,cursor:0,log:"",gap:!1,ready:!1,pendingWrite:Promise.resolve()}}const uie={CREATED:"正在创建",RUNNING:"运行中",STOPPING:"正在终止",EXITED:"已退出",TERMINATED:"已终止",INTERRUPTED:"已中断"};function die({id:e,tabId:t,visible:n}){const i=lie(),s=Pt({queryKey:Qo(e),queryFn:()=>tu(e),enabled:n,staleTime:0,refetchOnMount:"always",refetchInterval:2e3}),a=s.data?j3(s.data.status):!1,l=s.isFetchedAfterMount&&s.isSuccess,[u,f]=w.useState(!1);w.useEffect(()=>{l&&f(!0)},[l]);const h=(l||u)&&!!s.data&&!a,g=s.data?B1(s.data):null;w.useEffect(()=>{if(g===null)return;const z=et.getState();z.windows.some(M=>M.tabs.some(K=>K.resourceId===e&&K.title!==g))&&et.setState({windows:z.windows.map(M=>({...M,tabs:M.tabs.map(K=>K.resourceId===e&&K.title!==g?{...K,title:g}:K)}))})},[e,g]);const m=w.useRef(s.data);m.current=s.data;const _=w.useRef(null),b=w.useRef(null),x=w.useRef(null),S=w.useRef(!1),[C,k]=w.useState(null);w.useEffect(()=>{k(document.getElementById(`terminal-controls-${t}`))},[t]);const[R,N]=w.useState(!1),[A,I]=w.useState(null),[T,D]=w.useState(""),[L,ee]=w.useState(!1),[U,F]=w.useState(""),[B,W]=w.useState(!0),[te,G]=w.useState(!1),[P,Z]=w.useState(Date.now()),$=s.data?.lease,ae=n&&!!A&&$?.ownerConnectionId===A&&$.expiresAt>P&&s.data?.status==="RUNNING"&&!s.isError,j=ae&&R,_e=$?.ownerType==="agent"&&$.expiresAt>P&&s.data?.status==="RUNNING"&&!s.isError;w.useLayoutEffect(()=>{if(a){i.get(t)?.terminal.dispose(),i.delete(t),F("");return}const z=_.current;if(!h||!z)return;const M=i.get(t)??cie();i.set(t,M),b.current=M;const K=M.terminal;return K.element?z.appendChild(K.element):K.open(z),ee(M.gap),F(M.ready?M.log:""),W(!M.ready),()=>{b.current=null,K.element?.remove()}},[i,h,t,a]),w.useLayoutEffect(()=>{I(null),N(!1);const z=_.current,M=b.current;if(!n||!h||!z||!M)return;const{terminal:K,fit:ne}=M;K.options.cursorBlink=!0,S.current=!1;let me=!1,Ee=!1,ve=500,Re,re,he=null,J=null,Ie=0,Ze=null,Ut=null,Et=[],tt=0;D("");const Lt=()=>me?Promise.resolve():qt.invalidateQueries({queryKey:Qo(e)}),xt=()=>{const Be=m.current;return!!he&&!!J&&Be?.status==="RUNNING"&&Be.lease?.ownerConnectionId===he&&Be.lease.generation===J&&Be.lease.expiresAt>Date.now()&&Re?.readyState===WebSocket.OPEN},Bt=()=>{J=null,N(!1),Ut=null,Et=[],tt=0,K.options.disableStdin=!0},Tr=()=>{if(!xt()||Ut!==null||!Et.length)return;const Be=Et.shift();Be!==void 0&&(tt-=new TextEncoder().encode(Be).length,Ut=++Ie,Re?.send(JSON.stringify({type:"terminal.input",terminalId:e,leaseGeneration:J,inputSequence:Ut,data:Be})))},go=K.onData(Be=>{if(!xt())return;const Ye=new TextEncoder().encode(Be).length;if(Ye>8192||tt+Ye>32768){D("输入过大,请分段粘贴(单次最多 8 KiB)。");return}Et.push(Be),tt+=Ye,Tr()}),Dr=()=>{M.ready||(M.ready=!0,F(M.log),W(!1))},Wr=async()=>{if(!(Ee||me)){Ee=!0;try{await M.pendingWrite;for(let Be=0;Be<8&&!me;Be++){const Ye=wY.parse(await we(`/api/terminals/${encodeURIComponent(e)}/output?after=${M.cursor}&limit=100`));if(me)return;M.gap||=Ye.resyncRequired||Ye.truncated;let kn=M.cursor;const hn=[];for(const _t of Ye.chunks)_t.cursor<=kn||(_t.cursor!==kn+1&&(M.gap=!0),hn.push(_t.data),kn=_t.cursor);M.gap&&ee(!0);const Ei=Math.max(kn,Ye.nextCursor);if(!hn.length){M.cursor=Ei,Dr();break}const Vr=hn.join("");M.pendingWrite=new Promise(_t=>{K.write(Vr,()=>{M.cursor=Ei,M.log=(M.log+Vr).slice(-16384),_t()})}),await M.pendingWrite,!me&&M.ready&&F(M.log)}}catch{me||(D("输出读取失败,正在重试;历史可能不完整。"),Dr())}finally{Ee=!1}}};let Kr;const le=()=>{clearTimeout(Kr),Kr=setTimeout(()=>{me||!z.clientWidth||!z.clientHeight||(ne.fit(),xt()&&Ja(e,"resize",{connectionId:he,leaseGeneration:J,cols:Math.max(2,Math.min(500,K.cols)),rows:Math.max(1,Math.min(300,K.rows))}).catch(()=>{me||(Bt(),Lt(),D("尺寸同步失败,请重新获取输入权。"))}))},100)},ye=new ResizeObserver(le);ye.observe(z),le();const Pe=()=>{if(me)return;const Be=new URL("/ws",location.href);Be.protocol=Be.protocol==="https:"?"wss:":"ws:";const Ye=new WebSocket(Be);Re=Ye,Ye.onopen=()=>Ye.send(JSON.stringify({type:"subscribe",subscriptions:[{topic:"terminal",resourceId:e,after:0}]})),Ye.onmessage=kn=>{if(me||Re!==Ye)return;let hn;try{hn=JSON.parse(String(kn.data))}catch{Bt(),D("终端响应无效,请刷新。");return}const Ei=CY.safeParse(hn);if(Ei.success&&Ei.data.subscription.resourceId===e){he=Ei.data.connectionId,ve=500,Lt().then(()=>{!me&&Re===Ye&&Ye.readyState===WebSocket.OPEN&&I(he)}),Wr();return}const Vr=kY.safeParse(hn);if(Vr.success&&Ut===Vr.data.inputSequence){Ut=null,Tr();return}const _t=l3.safeParse(hn);if(_t.success&&_t.data.resourceId===e){(_t.data.payload.lease?.generation!==J||_t.data.payload.lease?.ownerConnectionId!==he||_t.data.payload.status!=="RUNNING")&&Bt(),Lt(),Wr();return}if(xY.safeParse(hn).success){Wr();return}const Mn=EY.safeParse(hn);Mn.success&&(Bt(),Lt(),D(`终端操作被拒绝(${Mn.data.code}),请重新获取输入权。`))},Ye.onclose=()=>{me||(he=null,I(null),Bt(),Lt(),D("连接已断开,正在重连;不会重放输入。"),re=setTimeout(Pe,ve),ve=Math.min(ve*2,1e4))}},He=Be=>{Be.lease&&(m.current=Be,qt.setQueryData(Qo(e),Be),J=Be.lease.generation,Ze!==J&&(Ie=0),Ze=J,N(!0),Ut=null,K.options.disableStdin=!1,K.focus(),le(),D(""))};x.current={acquire:async()=>{if(!he)throw new Error("Disconnected");const Be=he,Ye=await Ja(e,"lease",{action:"acquire",connectionId:Be});me||he!==Be||Ye.lease?.ownerConnectionId!==Be||He(Ye)},takeover:async()=>{if(!he)throw new Error("Disconnected");const Be=he,Ye=await Ja(e,"takeover",{connectionId:Be});me||he!==Be||Ye.lease?.ownerConnectionId!==Be||He(Ye)},release:async()=>{const Be=m.current?.lease,Ye=Be?.ownerConnectionId===he?Be?.generation:J;Bt(),he&&Ye&&await Ja(e,"lease",{action:"release",connectionId:he,leaseGeneration:Ye})}};const dn=setInterval(()=>{if(!xt())return;const Be=he,Ye=J;Ja(e,"lease",{action:"renew",connectionId:he,leaseGeneration:J}).then(kn=>{!me&&Be===he&&Ye===J&&(m.current=kn,qt.setQueryData(Qo(e),kn))}).catch(()=>{me||(Bt(),Lt(),D("输入租约续期失败,请重新获取输入权。"))})},1e4),St=setInterval(()=>{Z(Date.now()),K.options.disableStdin=!xt(),xt()||N(!1),Wr()},1e3);return Pe(),()=>{me=!0,x.current=null,clearTimeout(re),clearTimeout(Kr),clearInterval(dn),clearInterval(St),ye.disconnect(),go.dispose(),Re?.close(),K.options.disableStdin=!0,K.options.cursorBlink=!1,K.blur()}},[e,h,n]),w.useEffect(()=>{if(!n||B||!A||!s.data||s.data.status!=="RUNNING"||s.isError||S.current||(S.current=!0,s.data.mode!=="shell"||s.data.lease&&s.data.lease.expiresAt>Date.now()))return;let z=!1;return G(!0),x.current?.acquire().catch(()=>{z||qt.invalidateQueries({queryKey:Qo(e)})}).finally(()=>{z||G(!1)}),()=>{z=!0,G(!1)}},[A,e,s.data,s.isError,B,n]);const Le=async z=>{G(!0),D("");try{await z()}catch{D("终端操作失败,请刷新状态后重试。")}finally{G(!1)}};return p.jsxs("div",{"data-testid":"live-terminal","data-terminal-id":e,"data-input-state":j?"active":_e?"agent":"inactive",className:"flex h-full min-h-0 flex-col bg-[#0f1115] text-white/80",children:[C?yl.createPortal(p.jsxs(Oc,{children:[p.jsx(jc,{asChild:!0,children:p.jsx("button",{type:"button","aria-label":"终端操作",title:"终端操作",className:"flex w-7 items-center justify-center text-ink-3 hover:bg-surface-2 hover:text-ink",children:p.jsx($j,{size:14})})}),p.jsx(cl,{onCloseAutoFocus:z=>{z.preventDefault(),j&&_.current?.querySelector(".xterm-helper-textarea")?.focus()},children:p.jsx(na,{"aria-label":ae?"释放输入权":_e?"接管控制":"获取输入权",disabled:te||B||!A||!s.data||s.isError||s.data.status!=="RUNNING"||!ae&&!_e&&!!$&&$.expiresAt>P,onSelect:()=>{Le(async()=>{ae?await x.current?.release():_e?await x.current?.takeover():await x.current?.acquire()})},children:ae?"交给 AI":_e?"接管控制":"输入终端"})})]}),C):null,s.data&&s.data.status!=="RUNNING"?p.jsx("p",{role:"status",className:"px-2 text-xs",children:uie[s.data.status]}):null,s.data?.reasonCode?p.jsxs("p",{className:"px-2 text-xs",children:["状态原因:",s.data.reasonCode]}):null,s.data?.exitCode!==null&&s.data?.exitCode!==void 0?p.jsxs("p",{className:"px-2 text-xs",children:["退出码 ",s.data.exitCode]}):null,!a&&L?p.jsx("p",{role:"status",className:"px-2 text-xs text-amber-300",children:"部分历史输出已过期或缺失,当前回放不完整。"}):null,s.isError||!a&&T?p.jsx("p",{role:"alert",className:"px-2 text-xs text-red-300",children:!a&&T||"终端不可用,请刷新核对;不会自动重建。"}):null,h?p.jsxs(p.Fragment,{children:[B?p.jsx("p",{role:"status",className:"px-2 pt-2 text-xs text-white/60",children:"正在恢复终端输出…"}):null,p.jsx("div",{ref:_,role:"application","aria-label":"交互终端",className:qe("min-h-0 flex-1 p-2",B&&"invisible"),onPointerDown:()=>{!ae&&!_e&&A&&!te&&(!$||$.expiresAt<=Date.now())&&s.data?.status==="RUNNING"&&Le(async()=>{await x.current?.acquire()})}}),p.jsx("pre",{role:"log","aria-label":"终端输出","aria-live":"off",className:"sr-only",children:U})]}):null]})}function $x({scope:e,label:t="新建终端",children:n,className:i}){const[s,a]=w.useState(null),[l,u]=w.useState(!1),[f,h]=w.useState("");return p.jsxs(p.Fragment,{children:[p.jsx("button",{type:"button","aria-label":t,title:"新建终端",className:i,onClick:()=>{h(""),a({key:crypto.randomUUID(),scope:e})},children:n??"新建终端"}),p.jsx(xi,{open:s!==null,onOpenChange:g=>{!g&&!l&&a(null)},children:p.jsxs(ui,{className:"max-w-sm",children:[p.jsx(Si,{children:"创建终端确认"}),p.jsx(wi,{children:"终端以本机账户运行,项目目录不是沙箱。"}),f?p.jsx("p",{role:"alert",className:"mt-3 text-xs text-danger",children:f}):null,p.jsxs("div",{className:"mt-4 flex justify-end gap-2",children:[p.jsx(Se,{variant:"ghost",disabled:l,onClick:()=>a(null),children:"取消"}),p.jsx(Se,{disabled:l,onClick:async()=>{if(!(!s||l)){u(!0),h("");try{const g=await mQ(s.scope,s.key);Qm(g),a(null),qt.invalidateQueries({queryKey:["terminals"]})}catch{h("创建结果未确认,请重试核对;重试不会重复创建。")}finally{u(!1)}}},children:l?"正在创建…":"确认创建"})]})]})})]})}function AT(e,t){return"projectId"in t&&t.projectId!==Gb?e.projectId===t.projectId:"sessionId"in t?e.workspaceSessionId===t.sessionId:!e.projectId&&!e.workspaceSessionId}async function hie(e,t){const n=[],i=new Set;let s;do{t.throwIfAborted();const a=await z3(s,e);if(n.push(...a.items.filter(l=>l.status==="RUNNING"&&AT(l,e))),s=a.nextCursor??void 0,s){if(i.has(s))throw new Error("Repeated terminal cursor");i.add(s)}}while(s);for(const a of n.reverse()){t.throwIfAborted();const l=await tu(a.id).catch(u=>{if(u instanceof rr&&u.status===404)return null;throw u});if(l){if(l.id!==a.id||!AT(l,e))throw new Error("Terminal scope changed");if(l.status==="RUNNING")return l}}return null}function fie({projectId:e,sessionId:t,visible:n=!0}){const i=e?{projectId:e}:t?{sessionId:t}:{workspace:"default"},{data:s,isFetchedAfterMount:a,isError:l,isFetching:u,refetch:f}=Pt({queryKey:["terminals","restore",e,t],queryFn:({signal:h})=>hie(i,h),enabled:n,staleTime:0,refetchOnMount:"always",refetchOnWindowFocus:!1});return w.useEffect(()=>{n&&s&&a&&!l&&!u&&Qm(s)},[s,a,l,u,n]),p.jsx("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-3 text-[12px] text-ink",children:l&&!u?p.jsxs(p.Fragment,{children:[p.jsx("p",{role:"alert",className:"text-ink-3",children:"无法恢复终端,请重试。"}),p.jsx("button",{type:"button",className:"text-accent",onClick:()=>{f()},children:"重试"}),p.jsx($x,{scope:i,className:"text-accent"})]}):!a||u||s?p.jsx("p",{role:"status",className:"text-ink-3",children:"正在读取终端…"}):p.jsxs(p.Fragment,{children:[p.jsx(Lc,{size:24,"aria-hidden":"true",className:"text-ink-3/50"}),p.jsx("p",{className:"text-ink-3",children:"暂无运行中的终端"}),p.jsx($x,{scope:i,className:"rounded-lg bg-accent px-3 py-1.5 text-white"})]})})}function pie({tab:e,visible:t}){return e.resourceId==="terminal:empty"?p.jsx(fie,{projectId:e.projectId,sessionId:e.sourceSessionId??void 0,visible:t}):p.jsx(die,{id:e.resourceId,tabId:e.id,visible:t},e.id)}function mie({tab:e,visible:t}){if(!e)return null;switch(e.kind){case"files":return p.jsx(HJ,{tab:e});case"terminal":return p.jsx(pie,{tab:e,visible:t});case"services":return p.jsx(WJ,{tab:e});case"browser":return p.jsx(OJ,{tab:e});case"git-diff":return p.jsx(IJ,{tab:e});default:return null}}function gie({kind:e}){const t=e==="terminal"?Lc:e==="services"?Pc:e==="browser"?Jd:e==="git-diff"?o1:s1;return p.jsx(t,{size:11.5,className:"shrink-0 text-ink-3"})}function vie(e,t,n){return e?n??e:t==="session"?"独立会话":"默认工作区"}function yie({window:e}){const[t,n]=w.useState(null),[i,s]=w.useState(""),a=It(N=>N.saving),l=It(N=>N.drafts),u=et(N=>N.setActiveTab),f=et(N=>N.closeTab),{data:h}=qr(),g=Dd(e.tabs,e.filter),m=Rc(g,e.activeTabId)?.id,_=g.filter(N=>N.kind!=="terminal"||N.resourceId!=="terminal:empty"),b=e.tabs[0]?.kind,x=w.useRef(null),[S,C]=w.useState(!1),[k,R]=w.useState(null);return w.useEffect(()=>{const N=x.current;if(!N||!e.tabs.length)return;const A=()=>C(N.scrollWidth>N.clientWidth+1),I=new ResizeObserver(A);return I.observe(N),A(),N.querySelector(`[data-tab-id="${m}"]`)?.scrollIntoView?.({block:"nearest",inline:"nearest"}),()=>I.disconnect()},[e.tabs,m]),p.jsxs("div",{className:"relative flex h-8 shrink-0 items-stretch border-b border-line bg-surface-2/35",children:[i?p.jsx("p",{role:"alert",className:"absolute top-full left-0 z-50 rounded bg-surface p-2 text-xs text-danger",children:i}):null,S?p.jsx("button",{type:"button","aria-label":"向左滚动 Tab",className:"shrink-0 px-1 text-ink-3 hover:text-ink",onClick:()=>x.current?.scrollBy({left:-180,behavior:"smooth"}),children:p.jsx(Qp,{size:13})}):null,p.jsx("div",{ref:x,role:"tablist","aria-label":"窗口 Tab",onKeyDown:N=>{if(!(N.target instanceof HTMLElement)||N.target.getAttribute("role")!=="tab")return;const A=_.findIndex(D=>D.id===m),I=N.key==="ArrowRight"?(A+1)%_.length:N.key==="ArrowLeft"?(A-1+_.length)%_.length:N.key==="Home"?0:N.key==="End"?_.length-1:-1,T=_[I];T&&(N.preventDefault(),u(e.id,T.id),x.current?.querySelector(`[data-tab-id="${T.id}"]`)?.focus())},className:"window-tabs-scroll flex h-8 min-w-0 flex-1 items-end gap-0.5 overflow-x-auto overflow-y-hidden px-2",onWheel:N=>{x.current&&Math.abs(N.deltaY)>Math.abs(N.deltaX)&&(x.current.scrollLeft+=N.deltaY)},children:_.map(N=>{const A=N.id===m,I=h.projects.find(D=>D.id===N.projectId)??null,T=vie(N.projectId,N.originType,I?.name);return p.jsx("div",{className:"flex shrink-0 items-end",children:p.jsxs("div",{className:qe("group flex h-7 max-w-[220px] shrink-0 items-center gap-1.5 rounded-t-[8px] border border-b-0 px-2.5 text-[10.5px] transition-colors",A?"border-line bg-surface text-ink":"border-transparent text-ink-3 hover:bg-black/[.03] hover:text-ink-2 dark:hover:bg-white/[.04]"),children:[k?.id===N.id?p.jsx("form",{onSubmit:async D=>{D.preventDefault();try{await Ja(N.resourceId,"rename",{title:k.title}),R(null)}catch{s("改名失败,请重试。")}},children:p.jsx("input",{ref:D=>D?.focus(),"aria-label":"终端名称",maxLength:80,value:k.title,onChange:D=>R({...k,title:D.target.value}),onKeyDown:D=>{D.key==="Escape"&&R(null)},className:"w-32 rounded border border-accent/40 bg-surface px-1 text-[11px] outline-none"})}):p.jsxs("button",{type:"button","data-tab-id":N.id,role:"tab","aria-selected":A,onDoubleClick:()=>{N.kind==="terminal"&&N.resourceId.startsWith("term_")&&R({id:N.id,title:N.title})},onKeyDown:D=>{D.key==="F2"&&N.kind==="terminal"&&N.resourceId.startsWith("term_")&&(D.preventDefault(),R({id:N.id,title:N.title}))},onClick:()=>u(e.id,N.id),title:`${T} · ${N.title}${N.kind==="terminal"?" · 双击或 F2 改名":""}`,className:"flex min-w-0 flex-1 items-center gap-1.5 focus-visible:outline-none",children:[p.jsx(gie,{kind:N.kind}),p.jsxs("span",{className:"truncate",children:[N.title,l[N.resourceId]?" ●":""]})]}),p.jsx("button",{type:"button","aria-label":`关闭 ${N.title}`,disabled:!!t||(a[N.resourceId]??!1),onClick:async D=>{if(D.stopPropagation(),N.kind==="terminal"&&N.resourceId!=="terminal:empty"){n(N.id),s("");try{const L=await tu(N.resourceId),ee=j3(L.status)?L:await Ja(N.resourceId,"terminate",{confirmed:!0});if(!F1(ee))throw new Error("Termination unconfirmed");f(e.id,N.id)}catch{s("终止未确认,已保留 Tab;请核对状态后重试。")}finally{n(null)}return}N.file&&l[N.resourceId]?It.setState({closeRequest:{windowId:e.id,tabId:N.id}}):f(e.id,N.id)},className:"window-no-drag rounded p-0.5 text-ink-3 opacity-70 transition-opacity hover:bg-black/[.06] hover:text-ink group-hover:opacity-100 dark:hover:bg-white/[.08]",children:p.jsx(pa,{size:10})})]})},N.id)})}),S?p.jsx("button",{type:"button","aria-label":"向右滚动 Tab",className:"shrink-0 px-1 text-ink-3 hover:text-ink",onClick:()=>x.current?.scrollBy({left:180,behavior:"smooth"}),children:p.jsx(Hr,{size:13})}):null,b==="terminal"?p.jsxs(p.Fragment,{children:[p.jsx("div",{id:`terminal-controls-${m}`,className:"flex shrink-0"}),p.jsx($x,{label:"新建终端 Tab",className:"flex w-8 shrink-0 items-center justify-center text-ink-3 hover:bg-surface-2 hover:text-ink",scope:e.tabs[0]?.projectId?{projectId:e.tabs[0].projectId}:e.tabs[0]?.originType==="session"&&e.tabs[0].sourceSessionId?{sessionId:e.tabs[0].sourceSessionId}:{workspace:"default"},children:p.jsx($r,{size:14})})]}):null]})}function _ie({window:e}){const t=et(m=>m.focus),n=et(m=>m.close),i=et(m=>m.hide),s=et(m=>m.toggleMaximize),a=et(m=>m.togglePin),l=et(m=>m.setBounds),{data:u}=qr(),f=Dd(e.tabs,e.filter),h=Rc(f,e.activeTabId),g=SJ(h,u);return p.jsxs(xJ,{bounds:"parent",dragHandleClassName:"window-drag-handle",cancel:".window-no-drag",disableDragging:e.maximized,enableResizing:!e.maximized,minWidth:420,minHeight:280,size:e.maximized?{width:"100%",height:"100%"}:{width:e.width,height:e.height},position:e.maximized?{x:0,y:0}:{x:e.x,y:e.y},onMouseDown:()=>t(e.id),onDragStop:(m,_)=>l(e.id,{x:_.x,y:_.y,width:e.width,height:e.height}),onResizeStop:(m,_,b,x,S)=>l(e.id,{x:S.x,y:S.y,width:b.offsetWidth,height:b.offsetHeight}),style:{zIndex:e.z,display:e.minimized?"none":"flex",flexDirection:"column"},inert:e.minimized,"data-window-frame":e.id,role:"dialog","aria-label":g,className:qe("pointer-events-auto flex flex-col overflow-hidden border border-line bg-surface window-shadow",e.maximized?"rounded-none":"rounded-xl"),children:[p.jsxs("div",{className:"window-drag-handle flex h-10 shrink-0 items-center gap-2 border-b border-line bg-surface-2/55 px-3",children:[p.jsxs("div",{className:"window-no-drag group/traffic flex items-center gap-1.5",children:[p.jsx("button",{type:"button","aria-label":"关闭窗口",title:"关闭窗口",onClick:()=>n(e.id),className:"flex h-3 w-3 items-center justify-center rounded-full bg-[#ff5f57] text-[8px] text-[#6b0d08] opacity-95 transition-opacity hover:brightness-95",children:p.jsx(pa,{size:7,strokeWidth:2.8,className:"opacity-0 group-hover/traffic:opacity-100"})}),p.jsx("button",{type:"button","aria-label":"隐藏窗口",title:"隐藏窗口",onClick:()=>i(e.id),className:"flex h-3 w-3 items-center justify-center rounded-full bg-[#febc2e] text-[8px] text-[#6b4b00] opacity-95 transition-opacity hover:brightness-95",children:p.jsx(hz,{size:7,strokeWidth:3,className:"opacity-0 group-hover/traffic:opacity-100"})}),p.jsx("button",{type:"button","aria-label":e.maximized?"还原窗口":"最大化窗口",title:e.maximized?"还原窗口":"最大化窗口",onClick:()=>s(e.id),className:"flex h-3 w-3 items-center justify-center rounded-full bg-[#28c840] text-[8px] text-[#0b4d12] opacity-95 transition-opacity hover:brightness-95",children:e.maximized?p.jsx(R$,{size:7,strokeWidth:2.8,className:"opacity-0 group-hover/traffic:opacity-100"}):p.jsx(N$,{size:7,strokeWidth:2.8,className:"opacity-0 group-hover/traffic:opacity-100"})})]}),p.jsxs("div",{className:"pointer-events-none absolute left-1/2 -translate-x-1/2 text-center",children:[p.jsx("div",{className:"max-w-[260px] truncate text-[11.5px] font-medium text-ink",children:g}),p.jsx("div",{className:"text-[9px] text-ink-3",children:bie(h?.kind)})]}),p.jsx("div",{className:"window-no-drag ml-auto flex items-center",children:p.jsx(bi,{label:e.pinned?"取消置顶":"置顶窗口",active:e.pinned,className:"h-6 w-6",onClick:()=>a(e.id),children:e.pinned?p.jsx(O$,{size:12}):p.jsx(j$,{size:12})})})]}),h?.kind!=="services"?p.jsx(yie,{window:e}):null,p.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:h?p.jsx(mie,{tab:h,visible:!e.minimized}):p.jsx("div",{className:"flex h-full items-center justify-center text-[11px] text-ink-3",children:"暂无打开的 Tab"})})]})}function bie(e){switch(e){case"files":return"文件";case"terminal":return"终端";case"services":return"服务";case"browser":return"预览";case"git-diff":return"Diff";default:return""}}function xie({scope:e,paths:t}){const n=k3(e,t),i=co(e);return w.useEffect(()=>{It.setState(s=>({monitoring:{...s.monitoring,[i]:n}}))},[i,n]),p.jsx("span",{className:"sr-only",role:"status",children:n})}function Sie(){const e=w.useRef([]),t=et(_=>_.windows),n=It(_=>_.drafts),i=It(_=>_.closeRequest),[s,a]=w.useState(null),[l,u]=w.useState(!1),f=new Map;for(const _ of t)for(const b of _.tabs){if(!b.file)continue;const x=co(b.file.scope),S=f.get(x)??{scope:b.file.scope,paths:[]};S.paths.push(b.file.path),f.set(x,S)}w.useEffect(()=>{const _=t.flatMap(x=>x.tabs.filter(S=>S.file).map(S=>S.resourceId)),b=e.current.filter(x=>!_.includes(x));b.length&&$1(async()=>{const{disposeFileModel:x}=await import("./FileEditor-DpVfk7t3.js");return{disposeFileModel:x}},__vite__mapDeps([3,1,2])).then(({disposeFileModel:x})=>{for(const S of b)et.getState().windows.some(C=>C.tabs.some(k=>k.file&&k.resourceId===S))||x(S)}),e.current=_},[t]),w.useEffect(()=>{const _=b=>{Object.keys(It.getState().drafts).length&&(b.preventDefault(),b.returnValue="")};return window.addEventListener("beforeunload",_),()=>window.removeEventListener("beforeunload",_)},[]);const h=i?t.find(_=>_.id===i.windowId)?.tabs.find(_=>_.id===i.tabId):void 0,g=()=>{It.setState({closeRequest:null}),a(null)},m=()=>{!i||!h||(It.getState().discard(h.resourceId),et.getState().closeTab(i.windowId,i.tabId),g())};return p.jsxs(p.Fragment,{children:[[...f].map(([_,b])=>p.jsx(xie,{...b},_)),i&&h&&n[h.resourceId]?p.jsx(xi,{open:!0,onOpenChange:_=>{!_&&!l&&g()},children:p.jsxs(ui,{className:"pointer-events-auto space-y-4 text-sm",children:[p.jsx(Si,{children:"未保存的文件"}),p.jsxs(wi,{children:[h.title," 有未保存的改动。"]}),s?p.jsx("p",{role:"alert",className:"text-danger",children:s}):null,p.jsxs("div",{className:"flex gap-3",children:[p.jsx(Se,{type:"button",disabled:l,onClick:()=>{u(!0),om(h).then(m).catch(_=>a(il(_))).finally(()=>u(!1))},children:"保存并关闭"}),p.jsx(Se,{type:"button",variant:"secondary",disabled:l,onClick:m,children:"放弃改动"}),p.jsx(Se,{type:"button",variant:"secondary",disabled:l,onClick:g,children:"取消"})]})]})}):null]})}function wie(){const e=et(t=>t.closeRequest);return e?p.jsx(Cie,{request:e},JSON.stringify(e)):null}function Cie({request:e}){const t=et(x=>x.windows),n=It(x=>x.drafts),i=It(x=>x.saving),[s,a]=w.useState(e.tabIds.length<=1),[l,u]=w.useState(!1),[f,h]=w.useState(""),g=t.find(x=>x.id===e.windowId)?.tabs.filter(x=>e.tabIds.includes(x.id))??[],m=g.find(x=>x.file&&n[x.resourceId]),_=l||g.some(x=>i[x.resourceId]),b=()=>et.setState({closeRequest:null});return w.useEffect(()=>{if(!(!s||m||_)){for(const x of g)et.getState().closeTab(e.windowId,x.id);et.setState({closeRequest:null})}},[s,m,_,g,e.windowId]),s&&!m?null:p.jsx(xi,{open:!0,onOpenChange:x=>{!x&&!_&&b()},children:p.jsxs(ui,{className:"pointer-events-auto space-y-4 text-sm",onEscapeKeyDown:x=>{_&&x.preventDefault()},onPointerDownOutside:x=>{_&&x.preventDefault()},children:[p.jsx(Si,{children:s?"未保存的文件":`关闭 ${g.length} 个 Tab?`}),p.jsx(wi,{children:s?`${m?.title??"文件"} 有未保存的改动。`:"最小化可以保留这些 Tab,关闭后需要重新打开。"}),f?p.jsx("p",{role:"alert",className:"text-danger",children:f}):null,p.jsxs("div",{className:"flex flex-wrap justify-end gap-2",children:[p.jsx(Se,{variant:"secondary",disabled:_,onClick:b,children:"取消"}),s?m?p.jsxs(p.Fragment,{children:[p.jsx(Se,{variant:"secondary",disabled:_,onClick:()=>{It.getState().discard(m.resourceId),h("")},children:"放弃改动并继续"}),p.jsx(Se,{disabled:_,onClick:()=>{u(!0),h(""),om(m).then(()=>{It.getState().drafts[m.resourceId]&&h("文件在保存期间有新改动,请再次保存。")}).catch(()=>h("保存失败,已保留文件和草稿,请核对后重试。")).finally(()=>u(!1))},children:"保存并继续"})]}):null:p.jsx(Se,{onClick:()=>a(!0),children:"关闭全部 Tab"})]})]})})}function kie({window:e}){const[t,n]=w.useState(!e.minimized);if(!t){if(e.minimized)return null;n(!0)}return p.jsx(_ie,{window:e})}function Eie(){const{projectId:e,sessionId:t}=at(),{data:n}=qr(),i=M1(e,t,n.sessions),s=et(l=>l.windows),a=et(l=>l.setBounds);return w.useEffect(()=>{const l=()=>{for(const u of et.getState().windows)u.maximized||a(u.id,{x:u.x,y:u.y,width:u.width,height:u.height})};return window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[a]),w.useEffect(()=>{const l=window.setTimeout(()=>{for(const u of et.getState().windows)u.maximized||a(u.id,{x:u.x,y:u.y,width:u.width,height:u.height})},50);return()=>window.clearTimeout(l)},[a]),w.useEffect(()=>{const l=u=>{u.button!==0||!(u.target instanceof Element)||document.querySelector('[role="dialog"][data-state="open"], [role="alertdialog"][data-state="open"]')||u.target.closest('[data-window-frame], [data-window-dock], [data-project-resources], [role="dialog"], [role="alertdialog"], [role="menu"]')||et.getState().hideScope(i)};return document.addEventListener("pointerdown",l,!0),()=>document.removeEventListener("pointerdown",l,!0)},[i]),p.jsx(aie,{windows:s,children:p.jsxs("div",{className:"pointer-events-none absolute inset-0 z-40 overflow-hidden",children:[p.jsx(wie,{}),p.jsx(Sie,{}),s.filter(l=>Tc(l)===i).map(l=>p.jsx(kie,{window:l},l.id))]})})}const OT={files:s1,terminal:Lc,services:Pc,browser:Jd,"git-diff":o1};function Nie(){const{data:e}=qr(),{projectId:t,sessionId:n}=at(),{windows:i,focusedId:s,open:a,restore:l}=et(),u=M1(t,n,e.sessions),f=Xm(t,n,e.sessions),h=i.filter(m=>Tc(m)===u),g=m=>{const _=h.find(b=>b.tabs[0]?.kind===m);if(_){l(_.id);return}e.terminals.find(b=>b.projectId===t),e.services.find(b=>b.projectId===t),a({kind:m,resourceId:`${m}:empty`,title:m==="terminal"?"终端":"服务",projectId:t,sessionId:"sessionId"in f?f.sessionId:null,source:t?"project":"session"})};return p.jsx("div",{className:"pointer-events-none relative z-10 mb-1.5 flex justify-center px-1",children:p.jsxs("nav",{"aria-label":"项目窗口","data-window-dock":!0,className:"window-tabs-scroll pointer-events-auto flex max-w-full items-center gap-0.5 overflow-x-auto rounded-[10px] border border-line bg-surface/90 p-0.5 shadow-[var(--shadow-card)] backdrop-blur-xl",children:[["terminal","services"].map(m=>{const _=OT[m],b=h.find(S=>S.tabs[0]?.kind===m),x=b&&!b.minimized&&b.id===s;return p.jsxs("button",{type:"button","aria-label":m==="terminal"?"打开终端窗口":"打开服务窗口","aria-pressed":!!x,onClick:()=>g(m),className:qe("flex h-6 shrink-0 items-center gap-1 rounded-md px-1.5 [@media(pointer:coarse)]:h-11 text-[11px] font-medium transition-colors",x?"bg-accent-soft text-accent":"text-ink-2 hover:bg-surface-2 hover:text-ink"),children:[p.jsx(_,{size:12,strokeWidth:1.7,className:m==="terminal"?"text-accent":"text-success"}),m==="terminal"?"终端":"服务",b&&b.tabs.filter(S=>!S.resourceId.endsWith(":empty")).length>0?p.jsx("span",{className:"rounded bg-black/[.045] px-1 font-mono text-[9px] dark:bg-white/[.08]",children:b.tabs.filter(S=>!S.resourceId.endsWith(":empty")).length}):null]},m)}),h.filter(m=>m.minimized&&!["terminal","services"].includes(m.tabs[0]?.kind??"")).map(m=>{const _=m.tabs.find(x=>x.id===m.activeTabId)??m.tabs[0];if(!_)return null;const b=OT[_.kind];return p.jsxs("button",{type:"button","aria-label":`恢复 ${_.title}`,onClick:()=>l(m.id),title:_.title,className:"flex h-6 max-w-32 shrink-0 items-center gap-1 rounded-md px-1.5 [@media(pointer:coarse)]:h-11 text-[11px] text-ink-2 transition-colors hover:bg-surface-2 hover:text-ink",children:[p.jsx(b,{size:12,className:"shrink-0 text-accent"}),p.jsx("span",{className:"truncate",children:_.title}),m.tabs.length>1?p.jsx("span",{className:"text-[9px] text-ink-3",children:m.tabs.length}):null]},m.id)})]})})}function FI(e){const t=new Set(e.filter(n=>n.kind==="message"&&n.role==="user"&&n.turnOutcome!==void 0).map(n=>n.turnId));return e.filter(n=>n.kind==="approval"&&n.status==="pending"&&(n.turnId===void 0||!t.has(n.turnId)))}const UI=[{id:"off",label:"关闭"},{id:"low",label:"低"},{id:"medium",label:"中"},{id:"high",label:"高"}];function Rie(e){return e==="on"?"开启":UI.find(t=>t.id===e)?.label??"关闭"}function Tie(e){return e==="glm"?"GLM":e==="openai-compatible"?"兼容":"DeepSeek"}function Die({groups:e,model:t,credentialProfileId:n,thinking:i,catalogError:s,onSelectModel:a,onSelectThinking:l}){const u=w.useRef(null),[f,h]=w.useState(!1),[g,m]=w.useState("root"),_=t?.thinking.supported===!0,b=_?Rie(i):"不支持";w.useEffect(()=>{if(!f)return;const k=N=>{u.current!==null&&!u.current.contains(N.target)&&h(!1)},R=N=>{N.key==="Escape"&&h(!1)};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",R),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",R)}},[f]);const x=()=>{m("root"),h(k=>!k)},S=(k,R)=>{a(k,R);const N=e.find(A=>A.credentialProfileId===R)?.models.find(A=>A.id===k);N!==void 0&&!N.thinking.supported&&l("off"),h(!1)},C=k=>{l(k),h(!1)};return p.jsxs("div",{ref:u,className:"relative",children:[p.jsxs("button",{type:"button","aria-label":`模型与思考:${t?.label??"未配置凭据"} · ${b}`,"aria-expanded":f,onClick:x,className:"flex h-7 min-w-0 items-center gap-1.5 rounded-lg px-1.5 text-[11px] font-medium text-ink-2 transition-colors hover:bg-black/[.045] hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 dark:hover:bg-white/[.06]",children:[p.jsx("span",{className:"max-w-[96px] truncate sm:max-w-[128px]",children:t?.label??"选择模型"}),t?p.jsx("span",{className:qe("shrink-0 text-[10px] font-semibold",i==="off"||!_?"text-ink-3":"text-accent"),children:b}):null,p.jsx(Fm,{size:11,className:"shrink-0 text-ink-3"})]}),f?p.jsxs("div",{role:"dialog","aria-label":"模型与思考",className:"absolute bottom-[calc(100%+8px)] left-0 z-40 w-[240px] rounded-xl border border-line bg-surface/95 p-1.5 text-ink shadow-[var(--shadow-pop)] backdrop-blur-xl",children:[g==="root"?p.jsxs(p.Fragment,{children:[p.jsxs("button",{type:"button","aria-label":`模型:${t?.label??"选择模型"}`,onClick:()=>m("models"),className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left transition-colors hover:bg-black/[.05] dark:hover:bg-white/[.07]",children:[p.jsx("span",{className:"w-12 shrink-0 text-[10px] text-ink-3",children:"模型"}),p.jsx("span",{className:"min-w-0 flex-1 truncate text-[11.5px] text-ink",children:t?.label??"选择模型"}),p.jsx(Hr,{size:11,className:"shrink-0 text-ink-3"})]}),p.jsxs("button",{type:"button","aria-label":`思考等级:${b}`,disabled:!_,onClick:()=>m("thinking"),className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left transition-colors hover:bg-black/[.05] disabled:opacity-50 dark:hover:bg-white/[.07]",children:[p.jsx("span",{className:"w-12 shrink-0 text-[10px] text-ink-3",children:"思考等级"}),p.jsx("span",{className:qe("min-w-0 flex-1 truncate text-[11.5px]",_&&i!=="off"?"text-accent":"text-ink"),children:b}),_?p.jsx(Hr,{size:11,className:"shrink-0 text-ink-3"}):null]})]}):null,g==="models"?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-1 px-1 pb-1 pt-0.5",children:[p.jsx("button",{type:"button","aria-label":"返回",onClick:()=>m("root"),className:"flex h-5 w-5 items-center justify-center rounded-md text-ink-3 hover:bg-black/[.05] hover:text-ink dark:hover:bg-white/[.07]",children:p.jsx(Qp,{size:12})}),p.jsx("span",{className:"text-[10.5px] font-semibold text-ink-3",children:"模型"})]}),p.jsxs("div",{className:"max-h-[300px] overflow-y-auto",children:[e.length===0?p.jsx("p",{className:"mx-1 rounded-lg border border-dashed border-line px-2 py-1.5 text-[10.5px] leading-relaxed text-ink-3",children:"未配置凭据。先在设置中添加 Key 并刷新目录。"}):null,e.map(k=>p.jsxs("div",{children:[p.jsxs("div",{className:"truncate px-2.5 pb-1 pt-1 text-[10px] text-ink-3",children:[Tie(k.provider)," · ",k.credentialLabel]}),k.models.length===0?p.jsx("p",{className:"mx-1 mb-1 rounded-lg border border-dashed border-line px-2 py-1.5 text-[10.5px] leading-relaxed text-ink-3",children:k.lastRefreshError||s?"该 Key 的目录读取失败,请在设置中刷新。":"该 Key 还没有可用模型,请在设置中刷新目录。"}):k.models.map(R=>{const N=R.id===t?.id&&k.credentialProfileId===n;return p.jsxs("button",{type:"button","aria-pressed":N,disabled:R.contextWindow===null,onClick:()=>S(R.id,k.credentialProfileId),className:qe("flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-[11.5px] transition-colors",R.contextWindow===null?"cursor-not-allowed text-ink-3 opacity-50":N?"bg-black/[.04] text-ink dark:bg-white/[.06]":"text-ink-2 hover:bg-black/[.05] hover:text-ink dark:hover:bg-white/[.07]"),children:[p.jsx("span",{className:"min-w-0 flex-1 truncate",children:R.label}),p.jsx("span",{className:"shrink-0 text-[9.5px] text-ink-3",children:R.contextWindow===null?"窗口未知":`${Math.round(R.contextWindow/1024)}K`}),N?p.jsx(Ic,{size:13,className:"shrink-0 text-accent"}):null]},`${k.credentialProfileId}:${R.id}`)})]},k.credentialProfileId))]})]}):null,g==="thinking"?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-1 px-1 pb-1 pt-0.5",children:[p.jsx("button",{type:"button","aria-label":"返回",onClick:()=>m("root"),className:"flex h-5 w-5 items-center justify-center rounded-md text-ink-3 hover:bg-black/[.05] hover:text-ink dark:hover:bg-white/[.07]",children:p.jsx(Qp,{size:12})}),p.jsx("span",{className:"text-[10.5px] font-semibold text-ink-3",children:"思考等级"})]}),UI.map(k=>{const R=k.id===i;return p.jsxs("button",{type:"button","aria-pressed":R,onClick:()=>C(k.id),className:qe("flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-[11.5px] transition-colors",R?"bg-black/[.04] text-ink dark:bg-white/[.06]":"text-ink-2 hover:bg-black/[.05] hover:text-ink dark:hover:bg-white/[.07]"),children:[p.jsx("span",{className:"min-w-0 flex-1 truncate",children:k.label}),R?p.jsx(Ic,{size:13,className:"shrink-0 text-accent"}):null]},k.id)})]}):null]}):null]})}const mp=[{id:"standard",label:"标准审批",detail:"L0/L1 自动,L2 询问",icon:Hm,tone:"text-accent"},{id:"strict",label:"严格审批",detail:"所有写入都询问",icon:iN,tone:"text-warning"},{id:"autonomous",label:"完全自主",detail:"所有工具免人工审批",icon:iN,tone:"text-danger"},{id:"readonly",label:"只读",detail:"禁止修改与执行",icon:P$,tone:"text-success"}];function W_(e){return e.thinking.supported?e.thinking.mode==="toggle"?"on":e.thinking.mode==="mandatory-levels"?"high":"medium":"off"}function jT(e,t){if(!e.thinking.supported)return t==="off";const n=e.thinking.mode??"levels";return n==="toggle"?t==="off"||t==="on":n==="mandatory-levels"?["low","medium","high"].includes(t):["off","low","medium","high"].includes(t)}function Aie(){const[e,t]=w.useState(!1),[n,i]=w.useState(null),{catalog:s,error:a}=aX(),l=er(z=>z.draft),u=er(z=>z.modelId),f=er(z=>z.thinking),h=er(z=>z.policy),g=er(z=>z.setDraft),m=er(z=>z.setModelId),_=er(z=>z.credentialProfileId),b=er(z=>z.setThinking),x=er(z=>z.setCredentialProfileId),S=er(z=>z.setPolicy),C=Dt(z=>z.isStreaming),k=Dt(z=>z.send),R=Dt(z=>z.stop),N=at(z=>z.focusComposerNonce),A=at(z=>!!z.sessionId),I=w.useRef(null),T=at(z=>z.sessionId),D=lX(T),L=w.useRef(null),ee=w.useRef(null),F=(s?.groups??(s?[s]:[])).map(z=>({...z,models:z.models.filter(M=>M.visible!==!1&&M.contextWindow!==null)})),B=F.flatMap(z=>z.models.map(M=>({group:z,model:M}))),W=B.find(z=>z.model.id===u&&(_===null||z.group.credentialProfileId===_))??B.find(z=>z.model.id===u),te=W?.model??B[0]?.model,G=mp.find(z=>z.id===h)??mp[0],P=G.icon,Z=Dt(z=>z.modelUsage),$=te?Z[te.id]:void 0,ae=Dt(z=>FI(z.items).length>0);w.useEffect(()=>{N>0&&I.current?.focus()},[N]),w.useEffect(()=>{if(n===null)return;const z=setTimeout(()=>i(null),4e3);return()=>clearTimeout(z)},[n]),w.useEffect(()=>{D===null||D.id===L.current||(L.current=D.id,D.model&&m(D.model),D.credentialProfileId&&x(D.credentialProfileId),D.thinking&&b(D.thinking==="default"?"medium":D.thinking))},[D,m,x,b]),w.useEffect(()=>{if(D===null||D.model)return;const z=s?.defaultSelection;z&&ee.current!==D.id&&(ee.current=D.id,m(z.model),x(z.credentialProfileId),b(z.thinking))},[D,s,m,x,b]),w.useEffect(()=>{if(B.length===0)return;if(!B.some(K=>K.model.id===u&&(_===null||K.group.credentialProfileId===_))){const K=B[0];if(K===void 0)return;m(K.model.id),x(K.group.credentialProfileId),b(W_(K.model));return}const M=B.find(K=>K.model.id===u&&(_===null||K.group.credentialProfileId===_));M!==void 0&&!jT(M.model,f)&&b(W_(M.model))},[B,u,f,_,m,x,b]),w.useEffect(()=>{const z=I.current;z&&(z.style.height="auto",z.style.height=`${Math.min(180,Math.max(48,z.scrollHeight))}px`)},[l]);const j=z=>{const M=l&&!l.endsWith(" ")?" ":"";g(`${l}${M}${z} `),requestAnimationFrame(()=>I.current?.focus())},_e=(z,M)=>{m(z),x(M);const K=B.find(ne=>ne.model.id===z&&ne.group.credentialProfileId===M);K!==void 0&&(i(`已切换到 ${K.model.label}`),jT(K.model,f)||b(W_(K.model)))},Le=()=>{if(!A||te===void 0||C||ae)return;const z=l.trim();z&&(k(z),g(""),requestAnimationFrame(()=>I.current?.focus()))};return p.jsxs("div",{className:"rounded-[18px] border border-line bg-surface shadow-[var(--shadow-card)] transition-[border-color,box-shadow] focus-within:border-accent/35 focus-within:ring-2 focus-within:ring-accent/10",children:[n?p.jsx("p",{role:"status",className:"px-3.5 pt-2 text-[10.5px] text-ink-3",children:n}):null,p.jsx("textarea",{ref:I,value:l,rows:1,placeholder:A?"继续对话,或提出新的任务…":"新建或选择一个会话…","aria-label":"对话输入",onChange:z=>g(z.target.value),onKeyDown:z=>{if(z.key==="Enter"&&!z.shiftKey){if(z.nativeEvent.isComposing)return;z.preventDefault(),C||Le()}},className:"block max-h-[180px] min-h-[48px] w-full resize-none bg-transparent px-3.5 pt-3 text-[13px] leading-[1.65] text-ink outline-none placeholder:text-ink-3 focus:outline-none focus-visible:outline-none"}),p.jsxs("div",{className:"flex items-center gap-0.5 px-2 pb-2 pt-1",children:[p.jsxs(Oc,{children:[p.jsx(jc,{asChild:!0,children:p.jsx(bi,{label:"添加上下文",className:"h-7 w-7",children:p.jsx($r,{size:15})})}),p.jsxs(cl,{align:"start",className:"w-[220px]",children:[p.jsx(Zp,{children:"添加上下文"}),["@README.md","@package.json","@apps/web/src/app/AppShell.tsx"].map(z=>p.jsx(na,{onSelect:()=>j(z),className:"font-mono text-[10.5px]",children:z},z))]})]}),p.jsx(Die,{groups:F,model:te,credentialProfileId:_??W?.group.credentialProfileId??null,thinking:f,catalogError:a,onSelectModel:_e,onSelectThinking:b}),p.jsxs(Oc,{children:[p.jsx(jc,{asChild:!0,children:p.jsx(bi,{label:`审批策略:${G.label}`,title:`${G.label} · ${G.detail}`,className:"h-7 w-7",children:p.jsx(P,{size:15,className:G.tone,"aria-hidden":"true"})})}),p.jsxs(cl,{align:"start",className:"w-[230px]",children:[p.jsx(Zp,{children:"审批策略"}),p.jsx(TO,{value:h,onValueChange:z=>{z==="autonomous"&&h!=="autonomous"?t(!0):mp.some(M=>M.id===z)&&S(z)},children:mp.map(z=>p.jsx(Nd,{value:z.id,className:"items-start py-2",children:p.jsxs("span",{className:"flex flex-col",children:[p.jsx("span",{className:"text-[11.5px] font-medium text-ink",children:z.label}),p.jsx("span",{className:"text-[10px] text-ink-3",children:z.detail})]})},z.id))})]})]}),p.jsx("span",{className:"flex-1"}),p.jsx(Oie,{used:$?.inputTokens??null,limit:$?.contextWindow??te?.contextWindow??128e3}),C?p.jsx("button",{type:"button",onClick:R,"aria-label":"停止执行",className:"ml-1 flex h-7 w-7 items-center justify-center rounded-full bg-danger/10 text-danger transition-colors hover:bg-danger/15 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-danger/40",children:p.jsx(a1,{size:11,fill:"currentColor"})}):p.jsx("button",{type:"button",onClick:Le,disabled:!l.trim()||!A||te===void 0||ae,"aria-label":"发送消息",className:qe("ml-1 flex h-7 w-7 items-center justify-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/50",l.trim()&&A&&te!==void 0&&!ae?"bg-accent text-white shadow-[var(--shadow-card)] hover:brightness-110 active:brightness-95":"bg-black/[.06] text-ink-3 dark:bg-white/[.08]"),children:p.jsx(Rj,{size:15,strokeWidth:2.2})})]}),p.jsx(xi,{open:e,onOpenChange:t,children:p.jsxs(ui,{className:"space-y-4 text-sm",children:[p.jsx(Si,{children:"启用完全自主?"}),p.jsx(wi,{children:"Agent 将不再逐次请求工具审批,可自行修改或删除文件、执行命令、进行 Git 推送等操作。程序以本机账户权限运行,这不是沙箱。请仅在信任当前任务时启用;下一轮生效,随时可以切回标准审批。"}),p.jsxs("div",{className:"flex justify-end gap-2",children:[p.jsx(Se,{variant:"secondary",onClick:()=>t(!1),children:"取消"}),p.jsx(Se,{className:"bg-danger text-white",onClick:()=>{S("autonomous"),t(!1)},children:"确认启用"})]})]})})]})}function Oie({used:e,limit:t}){const n=e!==null&&Number.isFinite(e)&&e>0&&t>0,i=n?Math.min(100,Math.max(0,Math.round(e/t*100))):0,s=n?`单次输入:${e.toLocaleString()} / ${t.toLocaleString()} tokens(${i}%)`:`暂无统计 · 模型窗口 ${t.toLocaleString()} tokens`;return p.jsx(TU,{label:s,side:"top",children:p.jsx("div",{role:"progressbar","aria-label":"上下文用量","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n?i:void 0,"aria-valuetext":s,className:qe("flex h-7 w-7 shrink-0 items-center justify-center",n?i>=90?"text-danger":i>=75?"text-warning":"text-accent":"text-ink-3"),children:p.jsxs("svg",{"aria-hidden":"true",width:"18",height:"18",viewBox:"0 0 20 20",className:"-rotate-90",fill:"none",children:[p.jsx("circle",{cx:"10",cy:"10",r:"7",stroke:"currentColor",strokeWidth:"2",className:"text-line-strong"}),n?p.jsx("circle",{cx:"10",cy:"10",r:"7",pathLength:"100",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"100",strokeDashoffset:100-i,className:"transition-[stroke-dashoffset] duration-150 motion-reduce:transition-none"}):null]})})})}function jie(){const e=Dt(u=>u.items),t=Dt(u=>u.sessionId),n=FI(e),[i,s]=w.useState(null),a=Math.max(0,n.findIndex(u=>u.id===i)),l=n[a];return l?p.jsx(zie,{item:l,index:a,total:n.length,navigate:u=>s(n[a+u]?.id??l.id)},`${t}:${l.id}`):null}function zie({item:e,index:t,total:n,navigate:i}){const s=Dt(S=>S.resolveApproval),{data:a}=qr(),l=at(S=>S.projectId),[u,f]=w.useState(!1),[h,g]=w.useState(null),[m,_]=w.useState(Date.now);w.useEffect(()=>{const S=window.setInterval(()=>_(Date.now()),1e3);return()=>window.clearInterval(S)},[]);const b=e.expiresAt!==void 0&&m>=e.expiresAt,x=async S=>{if(!(u||b)){f(!0),g(null);try{await s(e.id,S)}catch(C){g(C instanceof Error?C.message:"审批提交失败,请重试")}finally{f(!1)}}};return p.jsxs("section",{"aria-label":"待处理审批",className:"mb-2 max-h-[min(42dvh,360px)] overflow-y-auto rounded-xl border border-warning/25 bg-surface p-2.5 shadow-[var(--shadow-card)] text-[12px]",children:[p.jsxs("div",{className:"flex items-center gap-2 font-medium text-ink",children:[p.jsx(Hm,{size:14,className:"text-warning"}),p.jsx("span",{children:"需要批准"}),n>1?p.jsxs("div",{className:"ml-auto flex items-center gap-1 text-ink-3",children:[p.jsx("button",{type:"button","aria-label":"上一项审批",disabled:u||t===0,onClick:()=>i(-1),className:"rounded p-1 disabled:opacity-30",children:p.jsx(Qp,{size:14})}),p.jsxs("span",{children:[t+1,"/",n]}),p.jsx("button",{type:"button","aria-label":"下一项审批",disabled:u||t===n-1,onClick:()=>i(1),className:"rounded p-1 disabled:opacity-30",children:p.jsx(Hr,{size:14})})]}):null]}),p.jsx("pre",{className:"mt-1.5 max-h-16 overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-2 px-2 py-1.5 font-mono text-[12px] text-ink",children:e.summary??e.impact??"请求执行操作"}),b?p.jsx("p",{role:"status",className:"mt-1.5 text-ink-3",children:"审批已过期,等待任务更新。"}):null,h?p.jsx("p",{role:"alert",className:"mt-1.5 break-words text-danger",children:h}):null,p.jsxs("div",{className:"mt-1.5 flex items-start gap-3",children:[p.jsxs("details",{className:"min-w-0 flex-1 pt-1 text-[11px] text-ink-3",children:[p.jsx("summary",{className:"cursor-pointer",children:"查看操作详情"}),p.jsxs("div",{className:"mt-1.5 space-y-1 whitespace-pre-wrap break-words",children:[p.jsxs("div",{children:[a.projects.find(S=>S.id===l)?.name??"默认工作区"," ·"," ",e.toolName??e.serviceName??"操作"]}),p.jsxs("div",{children:["授权范围:仅本次操作 · 风险 ",e.risk??"—"]}),e.expiresAt!==void 0?p.jsxs("div",{children:["有效至 ",new Date(e.expiresAt).toLocaleTimeString()]}):null,p.jsx("pre",{className:"max-h-28 overflow-auto whitespace-pre-wrap",children:JSON.stringify(e.scope??{},null,2)})]})]}),p.jsxs("div",{className:"flex shrink-0 gap-1.5",children:[p.jsx(Se,{variant:"primary",size:"sm","aria-label":e.toolName?"批准执行":"批准部署",disabled:u||b,onClick:()=>{x("approve")},children:u?"提交中…":"批准本次"}),p.jsx(Se,{variant:"secondary",size:"sm",disabled:u||b,onClick:()=>{x("reject")},children:"拒绝"})]})]})]})}function eS({icon:e,label:t,ariaLabel:n,onClick:i,disabled:s,titleAttr:a}){return p.jsxs("button",{type:"button","aria-label":n,title:a??n,disabled:s,onClick:i,className:qe("group inline-flex h-7 max-w-full items-center gap-1.5 rounded-full border border-line/80 bg-surface-2/55 px-2 text-[11px] text-ink-2","transition-colors hover:border-accent/35 hover:bg-accent-soft/30 hover:text-ink","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40","disabled:pointer-events-none disabled:opacity-55"),children:[p.jsx(e,{size:11,className:"shrink-0 text-accent"}),p.jsx("span",{className:"truncate",children:t}),p.jsx(r1,{size:10,className:"shrink-0 text-ink-3 group-hover:text-accent"})]})}function Mie(e){return e.split("/").pop()??e}function HI({target:e}){const[t,n]=w.useState(!1),[i,s]=w.useState(null),[a,l]=w.useState(!1);return p.jsxs("div",{className:"min-w-0",children:[p.jsx(eS,{icon:Yj,label:`文件 · ${Mie(e.path)}`,ariaLabel:`查看文件 · ${e.path}`,disabled:a,onClick:()=>{l(!0),s(null),C3(e.scope,e.path,"agent").then(u=>n(e.version!==void 0&&e.version!==u.version)).catch(u=>s(il(u))).finally(()=>l(!1))}}),t?p.jsx("p",{role:"status",className:"mt-1 text-[10.5px] text-ink-3",children:"文件已变化,已打开当前版本。"}):null,i?p.jsx("p",{role:"alert",className:"mt-1 text-[10.5px] text-danger",children:i}):null]})}function $I({target:e}){const t=et(i=>i.open),n=e.name??e.path;return p.jsx(eS,{icon:Jd,label:`预览 · ${n}`,ariaLabel:`打开预览 · ${n}`,onClick:()=>t({kind:"browser",resourceId:`browser:${e.serviceId}:${e.path}`,browser:{serviceId:e.serviceId,path:e.path},title:"预览服务",projectId:e.projectId,source:"agent"})})}function Iie(e){return p.jsx(Pie,{...e},JSON.stringify([e.projectId,e.terminalId]))}function Pie({terminalId:e,projectId:t,label:n,ariaLabel:i,className:s,variant:a="link"}){const[l,u]=w.useState(!1),[f,h]=w.useState(null),g=w.useRef(0),m=w.useRef(!1);w.useEffect(()=>()=>{g.current+=1,m.current=!1},[]);const _=async()=>{if(m.current)return;m.current=!0;const b=++g.current;u(!0),h(null);try{const x=await tu(e);if(b!==g.current)return;x.id!==e||x.projectId!==t?h({text:"终端归属已变化,无法打开。",error:!0}):F1(x)?h({text:"终端已关闭"}):x.status==="RUNNING"?Qm(x):h({text:x.status==="STOPPING"?"终端正在关闭,请稍后重试。":x.status==="CREATED"?"终端正在创建,请稍后重试。":"终端状态异常,请核对状态后重试。"})}catch(x){if(b!==g.current)return;h(x instanceof rr&&x.status===404?{text:"终端已关闭或已被清理"}:{text:"无法读取终端状态,请重试。",error:!0})}finally{b===g.current&&(m.current=!1,u(!1))}};return p.jsxs("div",{className:"min-w-0",children:[a==="card"?p.jsx(eS,{icon:Lc,label:`终端 · ${n.replace(/^打开终端 · /,"")}`,ariaLabel:i??n,disabled:l,onClick:()=>{_()}}):p.jsxs("button",{type:"button",disabled:l,"aria-label":i,"aria-busy":l,onClick:()=>{_()},className:qe("flex max-w-full items-center gap-2 py-1 text-left text-[12px] text-ink-2 hover:text-ink disabled:opacity-50",s),children:[p.jsx(Lc,{size:13,className:"shrink-0 text-accent"}),p.jsx("span",{className:"break-all",children:n})]}),f?p.jsx("p",{role:f.error?"alert":"status",className:qe("mt-1 text-[11px]",f.error?"text-danger":"text-ink-3"),children:f.text}):null]})}function qI({target:e}){return p.jsx(Iie,{terminalId:e.terminalId,projectId:e.projectId,label:`打开终端 · ${e.role??e.terminalId}`,variant:"card"})}function Lie(e,t){const n=zn(),[i,s]=w.useState("正在连接输出…");return w.useEffect(()=>{if(!t)return;let a=!1,l,u,f,h=1e3,g=!1;const m=(b=!1)=>{g||=!b,!(a||f)&&(f=setTimeout(()=>{f=void 0,a||(n.invalidateQueries({queryKey:["command",e,"output"]}),g&&n.invalidateQueries({queryKey:["command",e,"state"]})),g=!1},250))},_=()=>{if(a)return;const b=new URL("/ws",window.location.href);b.protocol=b.protocol==="https:"?"wss:":"ws:",l=new WebSocket(b),l.onopen=()=>{l?.send(JSON.stringify({type:"subscribe",subscriptions:[{topic:"command",resourceId:e,after:0}]})),h=1e3,s("实时输出已连接"),m()},l.onmessage=x=>{let S;try{S=JSON.parse(String(x.data))}catch{return}const C=SZ.safeParse(S),k=FM.safeParse(S);C.success&&C.data.resourceId===e&&m(!0),k.success&&k.data.resourceId===e&&m()},l.onerror=()=>s("输出连接中断,正在刷新状态…"),l.onclose=()=>{a||(s("输出连接中断,正在重连…"),m(),u=setTimeout(_,h),h=Math.min(h*2,1e4))}};return _(),()=>{a=!0,clearTimeout(u),clearTimeout(f),l?.close()}},[t,n,e]),i}const Bie={CREATED:"准备执行",RUNNING:"执行中",CANCELLING:"正在停止",COMPLETED:"已完成",FAILED:"执行失败",CANCELLED:"已取消",TIMED_OUT:"执行超时",INTERRUPTED:"执行中断"},K_=e=>!e||["CREATED","RUNNING","CANCELLING"].includes(e);async function Fie(e,t){let n=t?.cursor??0,i=t?.text??"",s=t?.truncated??!1,a=t?.gap??!1;for(let l=0;l<64;l++){const u=xZ.parse(await we(`/api/commands/${e}/output?after=${n}&limit=500`));if(u.resyncRequired&&!u.chunks.length&&(i=""),i+=u.chunks.filter(f=>f.cursor>n).map(f=>f.data).join(""),s||=u.truncated,a||=u.resyncRequired,u.nextCursor<=n||u.chunks.length<500)return{text:i,truncated:s,gap:a,cursor:u.nextCursor};n=u.nextCursor}return{text:i,truncated:!0,gap:a,cursor:n}}function Uie({commandId:e}){const t=zn(),n=Pt({queryKey:["command",e,"state"],queryFn:async()=>LN.parse(await we(`/api/commands/${e}`)),staleTime:0,refetchInterval:f=>K_(f.state.data?.status)&&!f.state.error?2e3:!1}),i=K_(n.data?.status);Lie(e,i&&!n.error);const s=Pt({queryKey:["command",e,"output"],queryFn:()=>Fie(e,t.getQueryData(["command",e,"output"])),staleTime:0,refetchInterval:i&&!n.error?2e3:!1}),a=n.data?.status;w.useEffect(()=>{a&&!K_(a)&&t.invalidateQueries({queryKey:["command",e,"output"]})},[t,e,a]);const l=()=>t.invalidateQueries({queryKey:["command",e]}),u=wc({mutationFn:async()=>LN.parse(await we(`/api/commands/${e}/cancel`,{method:"POST",body:{},csrf:!0})),onSuccess:f=>{t.setQueryData(["command",e,"state"],f),l()},onError:()=>{l()}});return p.jsxs("section",{"aria-label":"命令执行",className:"mt-2 overflow-hidden rounded-xl border border-line bg-surface",children:[p.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 text-[11px]",children:[p.jsx("span",{className:"font-semibold text-ink",children:"命令执行"}),p.jsx("span",{role:"status",className:"text-ink-2",children:n.data?Bie[n.data.status]:n.error?"命令不可用":"正在读取状态…"}),n.data?.exitCode!==null&&n.data?.exitCode!==void 0?p.jsxs("span",{className:"font-mono text-ink-3",children:["退出码 ",n.data.exitCode]}):null,p.jsxs("div",{className:"ml-auto flex gap-1",children:[p.jsx(Se,{size:"sm",variant:"secondary",onClick:()=>{l()},children:"刷新输出"}),n.data&&i?p.jsx(Se,{size:"sm",variant:"secondary",disabled:u.isPending||n.data.status==="CANCELLING",onClick:()=>u.mutate(),children:"取消命令"}):null]})]}),n.data?.reasonCode?p.jsxs("p",{className:"px-3 text-[11px] text-ink-2",children:["原因:",n.data.reasonCode]}):null,n.data?.status==="INTERRUPTED"?p.jsx("p",{className:"px-3 text-[11px] text-warning",children:"执行已中断;停止情况以状态原因为准,不能确认时项目保持受阻。"}):null,n.error||s.error||u.error?p.jsx("p",{role:"alert",className:"px-3 py-1 text-[11px] text-danger",children:"命令状态或输出读取失败;取消失败时请刷新确认。"}):null,s.data?.gap?p.jsx("p",{className:"px-3 text-[11px] text-warning",children:"输出有缺口,以下仅为当前可用记录。"}):null,s.data?.truncated||n.data?.truncated?p.jsx("p",{className:"px-3 text-[11px] text-warning",children:"输出已截断。"}):null,p.jsx("pre",{role:"log","aria-label":"命令输出",className:"max-h-[200px] overflow-auto whitespace-pre-wrap break-words border-t border-line bg-surface-2 px-3 py-2 font-mono text-[11px] text-ink-2",children:s.data?.text||(i?"等待命令输出…":"无可用输出")})]})}function Hie(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const $ie=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,qie=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Wie={};function zT(e,t){return(Wie.jsx?qie:$ie).test(e)}const Kie=/[ \t\n\f\r]/g;function Vie(e){return typeof e=="object"?e.type==="text"?MT(e.value):!1:MT(e)}function MT(e){return e.replace(Kie,"")===""}class sh{constructor(t,n,i){this.normal=n,this.property=t,i&&(this.space=i)}}sh.prototype.normal={};sh.prototype.property={};sh.prototype.space=void 0;function WI(e,t){const n={},i={};for(const s of e)Object.assign(n,s.property),Object.assign(i,s.normal);return new sh(n,i,t)}function qx(e){return e.toLowerCase()}class Li{constructor(t,n){this.attribute=n,this.property=t}}Li.prototype.attribute="";Li.prototype.booleanish=!1;Li.prototype.boolean=!1;Li.prototype.commaOrSpaceSeparated=!1;Li.prototype.commaSeparated=!1;Li.prototype.defined=!1;Li.prototype.mustUseProperty=!1;Li.prototype.number=!1;Li.prototype.overloadedBoolean=!1;Li.prototype.property="";Li.prototype.spaceSeparated=!1;Li.prototype.space=void 0;let Gie=0;const Ke=wl(),yn=wl(),Wx=wl(),ge=wl(),Ot=wl(),ol=wl(),Ji=wl();function wl(){return 2**++Gie}const Kx=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ke,booleanish:yn,commaOrSpaceSeparated:Ji,commaSeparated:ol,number:ge,overloadedBoolean:Wx,spaceSeparated:Ot},Symbol.toStringTag,{value:"Module"})),V_=Object.keys(Kx);class tS extends Li{constructor(t,n,i,s){let a=-1;if(super(t,n),IT(this,"space",s),typeof i=="number")for(;++a<V_.length;){const l=V_[a];IT(this,V_[a],(i&Kx[l])===Kx[l])}}}tS.prototype.defined=!0;function IT(e,t,n){n&&(e[t]=n)}function su(e){const t={},n={};for(const[i,s]of Object.entries(e.properties)){const a=new tS(i,e.transform(e.attributes||{},i),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(i)&&(a.mustUseProperty=!0),t[i]=a,n[qx(i)]=i,n[qx(a.attribute)]=i}return new sh(t,n,e.space)}const KI=su({properties:{ariaActiveDescendant:null,ariaAtomic:yn,ariaAutoComplete:null,ariaBusy:yn,ariaChecked:yn,ariaColCount:ge,ariaColIndex:ge,ariaColSpan:ge,ariaControls:Ot,ariaCurrent:null,ariaDescribedBy:Ot,ariaDetails:null,ariaDisabled:yn,ariaDropEffect:Ot,ariaErrorMessage:null,ariaExpanded:yn,ariaFlowTo:Ot,ariaGrabbed:yn,ariaHasPopup:null,ariaHidden:yn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ot,ariaLevel:ge,ariaLive:null,ariaModal:yn,ariaMultiLine:yn,ariaMultiSelectable:yn,ariaOrientation:null,ariaOwns:Ot,ariaPlaceholder:null,ariaPosInSet:ge,ariaPressed:yn,ariaReadOnly:yn,ariaRelevant:null,ariaRequired:yn,ariaRoleDescription:Ot,ariaRowCount:ge,ariaRowIndex:ge,ariaRowSpan:ge,ariaSelected:yn,ariaSetSize:ge,ariaSort:null,ariaValueMax:ge,ariaValueMin:ge,ariaValueNow:ge,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function VI(e,t){return t in e?e[t]:t}function GI(e,t){return VI(e,t.toLowerCase())}const Zie=su({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ol,acceptCharset:Ot,accessKey:Ot,action:null,allow:null,allowFullScreen:Ke,allowPaymentRequest:Ke,allowUserMedia:Ke,alpha:Ke,alt:null,as:null,async:Ke,autoCapitalize:null,autoComplete:Ot,autoFocus:Ke,autoPlay:Ke,blocking:Ot,capture:null,charSet:null,checked:Ke,cite:null,className:Ot,closedBy:null,colorSpace:null,cols:ge,colSpan:ge,command:null,commandFor:null,content:null,contentEditable:yn,controls:Ke,controlsList:Ot,coords:ge|ol,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ke,defer:Ke,dir:null,dirName:null,disabled:Ke,download:Wx,draggable:yn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ke,formTarget:null,headers:Ot,height:ge,hidden:Wx,high:ge,href:null,hrefLang:null,htmlFor:Ot,httpEquiv:Ot,id:null,imageSizes:null,imageSrcSet:null,inert:Ke,inputMode:null,integrity:null,is:null,isMap:Ke,itemId:null,itemProp:Ot,itemRef:Ot,itemScope:Ke,itemType:Ot,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ke,low:ge,manifest:null,max:null,maxLength:ge,media:null,method:null,min:null,minLength:ge,multiple:Ke,muted:Ke,name:null,nonce:null,noModule:Ke,noValidate:Ke,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:Ke,optimum:ge,pattern:null,ping:Ot,placeholder:null,playsInline:Ke,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ke,referrerPolicy:null,rel:Ot,required:Ke,reversed:Ke,rows:ge,rowSpan:ge,sandbox:Ot,scope:null,scoped:Ke,seamless:Ke,selected:Ke,shadowRootClonable:Ke,shadowRootCustomElementRegistry:Ke,shadowRootDelegatesFocus:Ke,shadowRootMode:null,shadowRootSerializable:Ke,shape:null,size:ge,sizes:null,slot:null,span:ge,spellCheck:yn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ge,step:null,style:null,tabIndex:ge,target:null,title:null,translate:null,type:null,typeMustMatch:Ke,useMap:null,value:yn,width:ge,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ot,axis:null,background:null,bgColor:null,border:ge,borderColor:null,bottomMargin:ge,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ke,declare:Ke,event:null,face:null,frame:null,frameBorder:null,hSpace:ge,leftMargin:ge,link:null,longDesc:null,lowSrc:null,marginHeight:ge,marginWidth:ge,noResize:Ke,noHref:Ke,noShade:Ke,noWrap:Ke,object:null,profile:null,prompt:null,rev:null,rightMargin:ge,rules:null,scheme:null,scrolling:yn,standby:null,summary:null,text:null,topMargin:ge,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ge,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Ke,disablePictureInPicture:Ke,disableRemotePlayback:Ke,exportParts:ol,part:Ot,prefix:null,property:null,results:ge,security:null,unselectable:null},space:"html",transform:GI}),Yie=su({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",maskType:"mask-type",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:Ji,accentHeight:ge,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ge,amplitude:ge,arabicForm:null,ascent:ge,attributeName:null,attributeType:null,azimuth:ge,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ge,by:null,calcMode:null,capHeight:ge,className:Ot,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:ge,diffuseConstant:ge,direction:null,display:null,dur:null,divisor:ge,dominantBaseline:null,download:Ke,dx:null,dy:null,edgeMode:null,editable:null,elevation:ge,enableBackground:null,end:null,event:null,exponent:ge,externalResourcesRequired:null,fill:null,fillOpacity:ge,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:ol,g2:ol,glyphName:ol,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ge,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ge,horizOriginX:ge,horizOriginY:ge,id:null,ideographic:ge,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ge,k:ge,k1:ge,k2:ge,k3:ge,k4:ge,kernelMatrix:Ji,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ge,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ge,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:ge,overlineThickness:ge,paintOrder:null,panose1:null,path:null,pathLength:ge,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ot,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ge,pointsAtY:ge,pointsAtZ:ge,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ji,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ji,rev:Ji,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ji,requiredFeatures:Ji,requiredFonts:Ji,requiredFormats:Ji,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:ge,specularExponent:ge,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ge,strikethroughThickness:ge,string:null,stroke:null,strokeDashArray:Ji,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ge,strokeOpacity:ge,strokeWidth:null,style:null,surfaceScale:ge,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ji,tabIndex:ge,tableValues:null,target:null,targetX:ge,targetY:ge,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ji,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ge,underlineThickness:ge,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ge,values:null,vAlphabetic:ge,vMathematical:ge,vectorEffect:null,vHanging:ge,vIdeographic:ge,version:null,vertAdvY:ge,vertOriginX:ge,vertOriginY:ge,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ge,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:VI}),ZI=su({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()}}),YI=su({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:GI}),XI=su({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Xie={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"},Qie=/[A-Z]/g,PT=/-[a-z]/g,Jie=/^data[-\w.:]+$/i;function ere(e,t){const n=qx(t);let i=t,s=Li;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Jie.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(PT,nre);i="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!PT.test(a)){let l=a.replace(Qie,tre);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}s=tS}return new s(i,t)}function tre(e){return"-"+e.toLowerCase()}function nre(e){return e.charAt(1).toUpperCase()}const ire=WI([KI,Zie,ZI,YI,XI],"html"),nS=WI([KI,Yie,ZI,YI,XI],"svg");function rre(e){return e.join(" ").trim()}var LT=/\/\*(?:[^*]|\*(?!\/))*\*\//g,sre=/\n/g,ore=/^\s*/,are=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,lre=/^:\s*/,cre=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,ure=/^[;\s]*/,dre=`
127
- `,BT="/",FT="*",fd="",hre="comment",fre="declaration";function pre(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,i=1;function s(x){var S=x.match(sre);S&&(n+=S.length);var C=x.lastIndexOf(dre);i=~C?x.length-C:i+x.length}function a(){var x={line:n,column:i};return function(S){return S.position=new l(x),h(),S}}function l(x){this.start=x,this.end={line:n,column:i},this.source=t.source}l.prototype.content=e;function u(x){var S=new Error(t.source+":"+n+":"+i+": "+x);if(S.reason=x,S.filename=t.source,S.line=n,S.column=i,S.source=e,!t.silent)throw S}function f(x){var S=x.exec(e);if(S){var C=S[0];return s(C),e=e.slice(C.length),S}}function h(){f(ore)}function g(x){for(var S;S=m();)x.push(S);return x}function m(){var x=a();if(!(BT!=e.charAt(0)||FT!=e.charAt(1))){for(var S=2;fd!=e.charAt(S)&&(FT!=e.charAt(S)||BT!=e.charAt(S+1));)++S;if(S+=2,fd===e.charAt(S-1))return u("End of comment missing");var C=e.slice(2,S-2);return i+=2,s(C),e=e.slice(S),i+=2,x({type:hre,comment:C})}}function _(){var x=a(),S=f(are);if(S){if(m(),!f(lre))return u("property missing ':'");var C=f(cre),k=x({type:fre,property:S[0].replace(LT,fd).trim(),value:C?C[0].replace(LT,fd).trim():fd});return f(ure),k}}function b(){var x=[];g(x);for(var S;S=_();)x.push(S),g(x);return x}return h(),b()}function mre(e,t){let n=null;if(!e||typeof e!="string")return n;const i=pre(e),s=typeof t=="function";return i.forEach(a=>{if(a.type!=="declaration")return;const{property:l,value:u}=a;s?t(l,u,a):u&&(n=n??{},n[l]=u)}),n}const QI=JI("end"),iS=JI("start");function JI(e){return t;function t(n){const i=n&&n.position&&n.position[e]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function gre(e){const t=iS(e),n=QI(e);if(t&&n)return{start:t,end:n}}function jd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?UT(e.position):"start"in e||"end"in e?UT(e):"line"in e||"column"in e?Vx(e):""}function Vx(e){return HT(e&&e.line)+":"+HT(e&&e.column)}function UT(e){return Vx(e&&e.start)+"-"+Vx(e&&e.end)}function HT(e){return e&&typeof e=="number"?e:1}class hi extends Error{constructor(t,n,i){super(),typeof n=="string"&&(i=n,n=void 0);let s="",a={},l=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?s=t:!a.cause&&t&&(l=!0,s=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?a.ruleId=i:(a.source=i.slice(0,f),a.ruleId=i.slice(f+1))}if(!a.place&&a.ancestors&&a.ancestors){const f=a.ancestors[a.ancestors.length-1];f&&(a.place=f.position)}const u=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=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=u?u.line:void 0,this.name=jd(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=l&&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}}hi.prototype.file="";hi.prototype.name="";hi.prototype.reason="";hi.prototype.message="";hi.prototype.stack="";hi.prototype.column=void 0;hi.prototype.line=void 0;hi.prototype.ancestors=void 0;hi.prototype.cause=void 0;hi.prototype.fatal=void 0;hi.prototype.place=void 0;hi.prototype.ruleId=void 0;hi.prototype.source=void 0;const rS={}.hasOwnProperty,vre=new Map,yre=/[A-Z]/g,_re=/-([a-z])/g,bre=new Set(["table","tbody","thead","tfoot","tr"]),xre=new Set(["td","th"]),e5="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Sre(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let i;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=Dre(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=Tre(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:i,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?nS:ire,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=t5(s,e,void 0);return a&&typeof a!="string"?a:s.create(e,s.Fragment,{children:a||void 0},void 0)}function t5(e,t,n){if(t.type==="element")return wre(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Cre(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return Ere(e,t,n);if(t.type==="mdxjsEsm")return kre(e,t);if(t.type==="root")return Nre(e,t,n);if(t.type==="text")return Rre(e,t)}function wre(e,t,n){const i=e.schema;let s=i;t.tagName.toLowerCase()==="svg"&&i.space==="html"&&(s=nS,e.schema=s),e.ancestors.push(t);const a=i5(e,t.tagName,!1),l=Are(e,t);let u=oS(e,t);return bre.has(t.tagName)&&(u=u.filter(function(f){return typeof f=="string"?!Vie(f):!0})),n5(e,l,a,t),sS(l,u),e.ancestors.pop(),e.schema=i,e.create(t,a,l,n)}function Cre(e,t){if(t.data&&t.data.estree&&e.evaluater){const i=t.data.estree.body[0];return i.type,e.evaluater.evaluateExpression(i.expression)}Kd(e,t.position)}function kre(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Kd(e,t.position)}function Ere(e,t,n){const i=e.schema;let s=i;t.name==="svg"&&i.space==="html"&&(s=nS,e.schema=s),e.ancestors.push(t);const a=t.name===null?e.Fragment:i5(e,t.name,!0),l=Ore(e,t),u=oS(e,t);return n5(e,l,a,t),sS(l,u),e.ancestors.pop(),e.schema=i,e.create(t,a,l,n)}function Nre(e,t,n){const i={};return sS(i,oS(e,t)),e.create(t,e.Fragment,i,n)}function Rre(e,t){return t.value}function n5(e,t,n,i){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=i)}function sS(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function Tre(e,t,n){return i;function i(s,a,l,u){const h=Array.isArray(l.children)?n:t;return u?h(a,l,u):h(a,l)}}function Dre(e,t){return n;function n(i,s,a,l){const u=Array.isArray(a.children),f=iS(i);return t(s,a,l,u,{columnNumber:f?f.column-1:void 0,fileName:e,lineNumber:f?f.line:void 0},void 0)}}function Are(e,t){const n={};let i,s;for(s in t.properties)if(s!=="children"&&rS.call(t.properties,s)){const a=jre(e,s,t.properties[s]);if(a){const[l,u]=a;e.tableCellAlignToStyle&&l==="align"&&typeof u=="string"&&xre.has(t.tagName)?i=u:n[l]=u}}if(i){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return n}function Ore(e,t){const n={};for(const i of t.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&e.evaluater){const a=i.data.estree.body[0];a.type;const l=a.expression;l.type;const u=l.properties[0];u.type,Object.assign(n,e.evaluater.evaluateExpression(u.argument))}else Kd(e,t.position);else{const{name:s}=i;let a;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&e.evaluater){const u=i.value.data.estree.body[0];u.type,a=e.evaluater.evaluateExpression(u.expression)}else Kd(e,t.position);else a=i.value===null?!0:i.value;n[s]=a}return n}function oS(e,t){const n=[];let i=-1;const s=e.passKeys?new Map:vre;for(;++i<t.children.length;){const a=t.children[i];let l;if(e.passKeys){const f=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(f){const h=s.get(f)||0;l=f+"-"+h,s.set(f,h+1)}}const u=t5(e,a,l);u!==void 0&&n.push(u)}return n}function jre(e,t,n){if(n==null||typeof n=="number"&&Number.isNaN(n))return;const i=ere(e.schema,t);return Array.isArray(n)&&(n=i.commaSeparated?Hie(n):rre(n)),i.property==="style"?["style",typeof n=="object"?e.stylePropertyNameCase==="dom"?n:Mre(n):zre(e,String(n))]:[e.elementAttributeNameCase==="react"&&i.space?Xie[i.property]||i.property:i.attribute,n]}function zre(e,t){const n={};try{mre(t,function(i,s){if(i&&s){let a=i;a.slice(0,2)!=="--"&&(a=a.toLowerCase(),e.stylePropertyNameCase==="dom"&&(a.slice(0,4)==="-ms-"&&(a=a.slice(1)),a=a.replace(_re,Lre))),n[a]=s}})}catch(i){if(e.ignoreInvalidStyle)return{};const s=i,a=new hi("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:s,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw a.file=e.filePath||void 0,a.url=e5+"#cannot-parse-style-attribute",a}return n}function i5(e,t,n){let i;if(!n)i={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let a=-1,l;for(;++a<s.length;){const u=zT(s[a])?{type:"Identifier",name:s[a]}:{type:"Literal",value:s[a]};l=l?{type:"MemberExpression",object:l,property:u,computed:!!(a&&u.type==="Literal"),optional:!1}:u}i=l}else i=zT(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(i.type==="Literal"){const s=i.value;return rS.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(i);Kd(e)}function Kd(e,t){const n=new hi("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=e5+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Mre(e){const t={};let n;for(n in e)rS.call(e,n)&&(t[Ire(n)]=e[n]);return t}function Ire(e){if(e.slice(0,2)==="--")return e;let t=e.replace(yre,Pre);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Pre(e){return"-"+e.toLowerCase()}function Lre(e,t){return t.toUpperCase()}const G_={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"]},Bre={};function aS(e,t){const n=Bre,i=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return r5(e,i,s)}function r5(e,t,n){if(Fre(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return $T(e.children,t,n)}return Array.isArray(e)?$T(e,t,n):""}function $T(e,t,n){const i=[];let s=-1;for(;++s<e.length;)i[s]=r5(e[s],t,n);return i.join("")}function Fre(e){return!!(e&&typeof e=="object")}const qT=document.createElement("i");function lS(e){const t="&"+e+";";qT.innerHTML=t;const n=qT.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Fr(e,t,n,i){const s=e.length;let a=0,l;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,i.length<1e4)l=Array.from(i),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<i.length;)l=i.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function wr(e,t){return e.length>0?(Fr(e,e.length,0,t),e):t}const WT={}.hasOwnProperty;function s5(e){const t={};let n=-1;for(;++n<e.length;)Ure(t,e[n]);return t}function Ure(e,t){let n;for(n in t){const s=(WT.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){WT.call(s,l)||(s[l]=[]);const u=a[l];Hre(s[l],Array.isArray(u)?u:u?[u]:[])}}}function Hre(e,t){let n=-1;const i=[];for(;++n<t.length;)(t[n].add==="after"?e:i).push(t[n]);Fr(e,0,0,i)}function o5(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Ur(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ii=_a(/[A-Za-z]/),ri=_a(/[\dA-Za-z]/),$re=_a(/[#-'*+\--9=?A-Z^-~]/);function pm(e){return e!==null&&(e<32||e===127)}const Gx=_a(/\d/),qre=_a(/[\dA-Fa-f]/),a5=_a(/[!-/:-@[-`{-~]/);function Fe(e){return e!==null&&e<-2}function jt(e){return e!==null&&(e<0||e===32)}function st(e){return e===-2||e===-1||e===32}const sg=_a(new RegExp("\\p{P}|\\p{S}","u")),ml=_a(/\s/);function _a(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function ou(e){const t=[];let n=-1,i=0,s=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&ri(e.charCodeAt(n+1))&&ri(e.charCodeAt(n+2)))s=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const u=e.charCodeAt(n+1);a<56320&&u>56319&&u<57344?(l=String.fromCharCode(a,u),s=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(i,n),encodeURIComponent(l)),i=n+s+1,l=""),s&&(n+=s,s=0)}return t.join("")+e.slice(i)}function mt(e,t,n,i){const s=i?i-1:1/0;let a=0;return l;function l(f){return st(f)?(e.enter(n),u(f)):t(f)}function u(f){return st(f)&&a++<s?(e.consume(f),u):(e.exit(n),t(f))}}function l5(e,t,n,i,s,a){let l=0;return u;function u(g){return st(g)?(e.enter(i),f(g)):h(g)}function f(g){return st(g)&&l<a?(e.consume(g),l++,f):(e.exit(i),h(g))}function h(g){return l>=s?t(g):n(g)}}const Wre={tokenize:Kre};function Kre(e){const t=e.attempt(this.parser.constructs.contentInitial,i,s);let n;return t;function i(u){if(u===null){e.consume(u);return}return e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),mt(e,t,"linePrefix")}function s(u){return e.enter("paragraph"),a(u)}function a(u){const f=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=f),n=f,l(u)}function l(u){if(u===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(u);return}return Fe(u)?(e.consume(u),e.exit("chunkText"),a):(e.consume(u),l)}}let mm=class{constructor(){this.index=new Map,this.map=[]}add(t,n,i){KT(this,t,n,i,!1)}addBefore(t,n,i){KT(this,t,n,i,!0)}consume(t){if(this.map.sort(function(a,l){return a[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let s=i.pop();for(;s;){for(const a of s)t.push(a);s=i.pop()}this.map.length=0,this.index.clear()}};function KT(e,t,n,i,s){if(n===0&&i.length===0)return;const a=e.index.get(t);if(a){a[1]+=n,s?(i.push(...a[2]),a[2]=i):a[2].push(...i);return}const l=[t,n,i];e.map.push(l),e.index.set(t,l)}const Vre={tokenize:Gre},VT={tokenize:Zre};function Gre(e){const t=this,n=[];let i=0,s,a,l;return u;function u(N){if(i<n.length){const A=n[i];return t.containerState=A[1],e.attempt(A[0].continuation,f,h)(N)}return h(N)}function f(N){if(i++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&R();const A=t.events.length;let I=A,T;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){T=t.events[I][1].end;break}k(i);let D=A;for(;D<t.events.length;)t.events[D][1].end={...T},D++;const L=new mm;return L.add(I+1,0,t.events.slice(A)),L.add(A,D-A,[]),L.consume(t.events),h(N)}return u(N)}function h(N){if(i===n.length){if(!s)return _(N);if(s.currentConstruct&&s.currentConstruct.concrete)return x(N);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(VT,g,m)(N)}function g(N){return s&&R(),k(i),_(N)}function m(N){return t.parser.lazy[t.now().line]=i!==n.length,l=t.now().offset,x(N)}function _(N){return t.containerState={},e.attempt(VT,b,x)(N)}function b(N){return i++,n.push([t.currentConstruct,t.containerState]),_(N)}function x(N){if(N===null){s&&R(),k(0),e.consume(N);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:a}),S(N)}function S(N){if(N===null){C(e.exit("chunkFlow"),!0),k(0),e.consume(N);return}return Fe(N)?(e.consume(N),C(e.exit("chunkFlow")),i=0,t.interrupt=void 0,u):(e.consume(N),S)}function C(N,A){const I=t.sliceStream(N);if(A&&I.push(null),N.previous=a,a&&(a.next=N),a=N,s.defineSkip(N.start),s.write(I),t.parser.lazy[N.start.line]){let T=s.events.length;for(;T--;)if(s.events[T][1].start.offset<l&&(!s.events[T][1].end||s.events[T][1].end.offset>l))return;const D=t.events.length;let L=D,ee,U;for(;L--;)if(t.events[L][0]==="exit"&&t.events[L][1].type==="chunkFlow"){if(ee){U=t.events[L][1].end;break}ee=!0}for(k(i),T=D;T<t.events.length;)t.events[T][1].end={...U},T++;const F=new mm;F.add(L+1,0,t.events.slice(D)),F.add(D,T-D,[]),F.consume(t.events)}}function k(N){let A=n.length;for(;A-- >N;){const I=n[A];t.containerState=I[1],I[0].exit.call(t,e)}n.length=N}function R(){s.write([null]),a=void 0,s=void 0,t.containerState._closeFlow=void 0}}function Zre(e,t,n){return mt(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ua(e){if(e===null||jt(e)||ml(e))return 1;if(sg(e))return 2}function og(e,t,n){const i=[];let s=-1;for(;++s<e.length;){const a=e[s].resolveAll;a&&!i.includes(a)&&(t=a(t,n),i.push(a))}return t}const Zx={name:"attention",resolveAll:Yre,tokenize:Xre};function Yre(e,t){let n=-1,i;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){let s=n;for(;s--;)if(e[s][0]==="exit"&&e[s][1].type==="attentionSequence"&&e[s][1]._open&&t.sliceSerialize(e[s][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[s][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[s][1].end.offset-e[s][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;const a=e[s][1].end.offset-e[s][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1,l={...e[s][1].end},u={...e[n][1].start};GT(l,-a),GT(u,a);const f={type:a>1?"strongSequence":"emphasisSequence",start:l,end:{...e[s][1].end}},h={type:a>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:u},g={type:a>1?"strongText":"emphasisText",start:{...e[s][1].end},end:{...e[n][1].start}},m={type:a>1?"strong":"emphasis",start:{...f.start},end:{...h.end}};e[s][1].end={...f.start},e[n][1].start={...h.end},i=[],e[s][1].end.offset-e[s][1].start.offset&&(i=wr(i,[["enter",e[s][1],t],["exit",e[s][1],t]])),i=wr(i,[["enter",m,t],["enter",f,t],["exit",f,t],["enter",g,t]]),i=wr(i,og(t.parser.constructs.insideSpan.null,e.slice(s+1,n),t)),i=wr(i,[["exit",g,t],["enter",h,t],["exit",h,t],["exit",m,t]]);let _=0;e[n][1].end.offset-e[n][1].start.offset&&(_=2,i=wr(i,[["enter",e[n][1],t],["exit",e[n][1],t]])),Fr(e,s-1,n-s+3,i),n=s+i.length-_-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function Xre(e,t){const n=this.parser.constructs.attentionMarkers.null,i=this.previous,s=ua(i);let a;return l;function l(f){return a=f,e.enter("attentionSequence"),u(f)}function u(f){if(f===a)return e.consume(f),u;const h=e.exit("attentionSequence"),g=ua(f),m=!g||g===2&&s||n.includes(f)&&f!==42&&f!==95,_=!s||s===2&&g||n.includes(i)&&i!==42&&i!==95;return h._open=!!(a===42?m:m&&(s||!_)),h._close=!!(a===42?_:_&&(g||!m)),t(f)}}function GT(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const Qre={name:"autolink",tokenize:Jre};function Jre(e,t,n){let i=0;return s;function s(b){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(b){return ii(b)?(e.consume(b),l):b===64?n(b):h(b)}function l(b){return b===43||b===45||b===46||ri(b)?(i=1,u(b)):h(b)}function u(b){return b===58?(e.consume(b),i=0,f):(b===43||b===45||b===46||ri(b))&&i++<32?(e.consume(b),u):(i=0,h(b))}function f(b){return b===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):b===null||b===32||b===60||pm(b)?n(b):(e.consume(b),f)}function h(b){return b===64?(e.consume(b),g):$re(b)?(e.consume(b),h):n(b)}function g(b){return ri(b)?m(b):n(b)}function m(b){return b===46?(e.consume(b),i=0,g):b===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(b),e.exit("autolinkMarker"),e.exit("autolink"),t):_(b)}function _(b){if((b===45||ri(b))&&i++<63){const x=b===45?_:m;return e.consume(b),x}return n(b)}}const oh={partial:!0,tokenize:ese};function ese(e,t,n){return i;function i(a){return st(a)?mt(e,s,"linePrefix")(a):s(a)}function s(a){return a===null||Fe(a)?t(a):n(a)}}const c5={continuation:{tokenize:nse},exit:ise,name:"blockQuote",tokenize:tse};function tse(e,t,n){const i=this;return s;function s(l){if(l===62){const u=i.containerState;return u.open||(e.enter("blockQuote",{_container:!0}),u.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return st(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function nse(e,t,n){const i=this;return s;function s(l){return st(l)?mt(e,a,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(c5,t,n)(l)}}function ise(e){e.exit("blockQuote")}const u5={name:"characterEscape",tokenize:rse};function rse(e,t,n){return i;function i(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),s}function s(a){return a5(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const d5={name:"characterReference",tokenize:sse};function sse(e,t,n){const i=this;let s=0,a,l;return u;function u(m){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),f}function f(m){return m===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(m),e.exit("characterReferenceMarkerNumeric"),h):(e.enter("characterReferenceValue"),a=31,l=ri,g(m))}function h(m){return m===88||m===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(m),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=qre,g):(e.enter("characterReferenceValue"),a=7,l=Gx,g(m))}function g(m){if(m===59&&s){const _=e.exit("characterReferenceValue");return l===ri&&!lS(i.sliceSerialize(_))?n(m):(e.enter("characterReferenceMarker"),e.consume(m),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(m)&&s++<a?(e.consume(m),g):n(m)}}const Yx={partial:!0,tokenize:ose};function ose(e,t,n){const i=this;return s;function s(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return i.parser.lazy[i.now().line]?n(l):t(l)}}const ZT={concrete:!0,name:"codeFenced",tokenize:ase};function ase(e,t,n){const i=this,s={partial:!0,tokenize:I};let a=0,l=0,u;return f;function f(T){return h(T)}function h(T){const D=i.events[i.events.length-1];return a=D&&D[1].type==="linePrefix"?D[2].sliceSerialize(D[1],!0).length:0,u=T,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),g(T)}function g(T){return T===u?(l++,e.consume(T),g):l<3?n(T):(e.exit("codeFencedFenceSequence"),st(T)?mt(e,m,"whitespace")(T):m(T))}function m(T){return T===null||Fe(T)?(e.exit("codeFencedFence"),i.interrupt?t(T):e.check(Yx,S,A)(T)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),_(T))}function _(T){return T===null||Fe(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),m(T)):st(T)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),mt(e,b,"whitespace")(T)):T===96&&T===u?n(T):(e.consume(T),_)}function b(T){return T===null||Fe(T)?m(T):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),x(T))}function x(T){return T===null||Fe(T)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),m(T)):T===96&&T===u?n(T):(e.consume(T),x)}function S(T){return e.attempt(s,A,C)(T)}function C(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),k}function k(T){return a>0&&st(T)?mt(e,R,"linePrefix",a+1)(T):R(T)}function R(T){return T===null||Fe(T)?e.check(Yx,S,A)(T):(e.enter("codeFlowValue"),N(T))}function N(T){return T===null||Fe(T)?(e.exit("codeFlowValue"),R(T)):(e.consume(T),N)}function A(T){return e.exit("codeFenced"),t(T)}function I(T,D,L){let ee=0;return U;function U(G){return T.enter("lineEnding"),T.consume(G),T.exit("lineEnding"),F}function F(G){return T.enter("codeFencedFence"),st(G)?mt(T,B,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):B(G)}function B(G){return G===u?(T.enter("codeFencedFenceSequence"),W(G)):L(G)}function W(G){return G===u?(ee++,T.consume(G),W):ee>=l?(T.exit("codeFencedFenceSequence"),st(G)?mt(T,te,"whitespace")(G):te(G)):L(G)}function te(G){return G===null||Fe(G)?(T.exit("codeFencedFence"),D(G)):L(G)}}}const Z_={name:"codeIndented",tokenize:cse},lse={partial:!0,tokenize:use};function cse(e,t,n){return i;function i(u){return e.enter("codeIndented"),l5(e,s,n,"linePrefix",4,4)(u)}function s(u){return u===null?l(u):Fe(u)?e.attempt(lse,s,l)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||Fe(u)?(e.exit("codeFlowValue"),s(u)):(e.consume(u),a)}function l(u){return e.exit("codeIndented"),t(u)}}function use(e,t,n){const i=this;return s;function s(l){return i.parser.lazy[i.now().line]?n(l):Fe(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),s):l5(e,t,a,"linePrefix",4,4)(l)}function a(l){return Fe(l)?s(l):n(l)}}const dse={name:"codeText",previous:fse,resolve:hse,tokenize:pse};function hse(e){let t=e.length-4,n=3,i,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(i=n;++i<t;)if(e[i][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(i=n-1,t++;++i<=t;)s===void 0?i!==t&&e[i][1].type!=="lineEnding"&&(s=i):(i===t||e[i][1].type==="lineEnding")&&(e[s][1].type="codeTextData",i!==s+2&&(e[s][1].end=e[i-1][1].end,e.splice(s+2,i-s-2),t-=i-s-2,i=s+2),s=void 0);return e}function fse(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function pse(e,t,n){let i=0,s,a;return l;function l(m){return e.enter("codeText"),e.enter("codeTextSequence"),u(m)}function u(m){return m===96?(e.consume(m),i++,u):(e.exit("codeTextSequence"),f(m))}function f(m){return m===null?n(m):m===32?(e.enter("space"),e.consume(m),e.exit("space"),f):m===96?(a=e.enter("codeTextSequence"),s=0,g(m)):Fe(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f):(e.enter("codeTextData"),h(m))}function h(m){return m===null||m===32||m===96||Fe(m)?(e.exit("codeTextData"),f(m)):(e.consume(m),h)}function g(m){return m===96?(e.consume(m),s++,g):s===i?(e.exit("codeTextSequence"),e.exit("codeText"),t(m)):(a.type="codeTextData",h(m))}}class mse{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const i=n??Number.POSITIVE_INFINITY;return i<this.left.length?this.left.slice(t,i):t>this.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(t,n,i){const s=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return i&&pd(this.left,i),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),pd(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),pd(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);pd(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);pd(this.left,n.reverse())}}}function pd(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function h5(e){const t={};let n=-1,i,s,a,l,u,f,h;const g=new mse(e);for(;++n<g.length;){for(;n in t;)n=t[n];if(i=g.get(n),n&&i[1].type==="chunkFlow"&&g.get(n-1)[1].type==="listItemPrefix"&&(f=i[1]._tokenizer.events,a=0,a<f.length&&f[a][1].type==="lineEndingBlank"&&(a+=2),a<f.length&&f[a][1].type==="content"))for(;++a<f.length&&f[a][1].type!=="content";)f[a][1].type==="chunkText"&&(f[a][1]._isInFirstContentOfListItem=!0,a++);if(i[0]==="enter")i[1].contentType&&(Object.assign(t,gse(g,n)),n=t[n],h=!0);else if(i[1]._container){for(a=n,s=void 0;a--;)if(l=g.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(s&&(g.get(s)[1].type="lineEndingBlank"),l[1].type="lineEnding",s=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;s&&(i[1].end={...g.get(s)[1].start},u=g.slice(s,n),u.unshift(i),g.splice(s,n-s+1,u))}}return Fr(e,0,Number.POSITIVE_INFINITY,g.slice(0)),!h}function gse(e,t){const n=e.get(t)[1],i=e.get(t)[2];let s=t-1;const a=[];let l=n._tokenizer;l||(l=i.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const u=l.events,f=[],h={};let g,m,_=-1,b=n,x=0,S=0;const C=[S];for(;b;){for(;e.get(++s)[1]!==b;);a.push(s),b._tokenizer||(g=i.sliceStream(b),b.next||g.push(null),m&&l.defineSkip(b.start),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(g),b._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),m=b,b=b.next}for(b=n;++_<u.length;)u[_][0]==="exit"&&u[_-1][0]==="enter"&&u[_][1].type===u[_-1][1].type&&u[_][1].start.line!==u[_][1].end.line&&(S=_+1,C.push(S),b._tokenizer=void 0,b.previous=void 0,b=b.next);for(l.events=[],b?(b._tokenizer=void 0,b.previous=void 0):C.pop(),_=C.length;_--;){const k=u.slice(C[_],C[_+1]),R=a.pop();f.push([R,R+k.length-1]),e.splice(R,2,k)}for(f.reverse(),_=-1;++_<f.length;)h[x+f[_][0]]=x+f[_][1],x+=f[_][1]-f[_][0]-1;return h}const vse={resolve:_se,tokenize:bse},yse={partial:!0,tokenize:xse};function _se(e){return h5(e),e}function bse(e,t){let n;return i;function i(u){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(u)}function s(u){return u===null?a(u):Fe(u)?e.check(yse,l,a)(u):(e.consume(u),s)}function a(u){return e.exit("chunkContent"),e.exit("content"),t(u)}function l(u){return e.consume(u),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function xse(e,t,n){const i=this;return s;function s(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),mt(e,a,"linePrefix")}function a(l){if(l===null||Fe(l))return n(l);const u=i.events[i.events.length-1];return!i.parser.constructs.disable.null.includes("codeIndented")&&u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?t(l):e.interrupt(i.parser.constructs.flow,n,t)(l)}}function f5(e,t,n,i,s,a,l,u,f){const h=f||Number.POSITIVE_INFINITY;let g=0;return m;function m(k){return k===60?(e.enter(i),e.enter(s),e.enter(a),e.consume(k),e.exit(a),_):k===null||k===32||k===41||pm(k)?n(k):(e.enter(i),e.enter(l),e.enter(u),e.enter("chunkString",{contentType:"string"}),S(k))}function _(k){return k===62?(e.enter(a),e.consume(k),e.exit(a),e.exit(s),e.exit(i),t):(e.enter(u),e.enter("chunkString",{contentType:"string"}),b(k))}function b(k){return k===62?(e.exit("chunkString"),e.exit(u),_(k)):k===null||k===60||Fe(k)?n(k):(e.consume(k),k===92?x:b)}function x(k){return k===60||k===62||k===92?(e.consume(k),b):b(k)}function S(k){return!g&&(k===null||k===41||jt(k))?(e.exit("chunkString"),e.exit(u),e.exit(l),e.exit(i),t(k)):g<h&&k===40?(e.consume(k),g++,S):k===41?(e.consume(k),g--,S):k===null||k===32||k===40||pm(k)?n(k):(e.consume(k),k===92?C:S)}function C(k){return k===40||k===41||k===92?(e.consume(k),S):S(k)}}function p5(e,t,n,i,s,a){const l=this;let u=0,f;return h;function h(b){return e.enter(i),e.enter(s),e.consume(b),e.exit(s),e.enter(a),g}function g(b){return u>999||b===null||b===91||b===93&&!f||b===94&&!u&&"_hiddenFootnoteSupport"in l.parser.constructs?n(b):b===93?(e.exit(a),e.enter(s),e.consume(b),e.exit(s),e.exit(i),t):Fe(b)?(e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),g):(e.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===null||b===91||b===93||Fe(b)||u++>999?(e.exit("chunkString"),g(b)):(e.consume(b),f||(f=!st(b)),b===92?_:m)}function _(b){return b===91||b===92||b===93?(e.consume(b),u++,m):m(b)}}function m5(e,t,n,i,s,a){let l;return u;function u(_){return _===34||_===39||_===40?(e.enter(i),e.enter(s),e.consume(_),e.exit(s),l=_===40?41:_,f):n(_)}function f(_){return _===l?(e.enter(s),e.consume(_),e.exit(s),e.exit(i),t):(e.enter(a),h(_))}function h(_){return _===l?(e.exit(a),f(l)):_===null?n(_):Fe(_)?(e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),mt(e,h,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),g(_))}function g(_){return _===l||_===null||Fe(_)?(e.exit("chunkString"),h(_)):(e.consume(_),_===92?m:g)}function m(_){return _===l||_===92?(e.consume(_),g):g(_)}}function zd(e,t){let n;return i;function i(s){return Fe(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,i):st(s)?mt(e,i,n?"linePrefix":"lineSuffix")(s):t(s)}}const Sse={name:"definition",tokenize:Cse},wse={partial:!0,tokenize:kse};function Cse(e,t,n){const i=this;let s;return a;function a(b){return e.enter("definition"),l(b)}function l(b){return p5.call(i,e,u,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(b)}function u(b){return s=Ur(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),b===58?(e.enter("definitionMarker"),e.consume(b),e.exit("definitionMarker"),f):n(b)}function f(b){return jt(b)?zd(e,h)(b):h(b)}function h(b){return f5(e,g,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(b)}function g(b){return e.attempt(wse,m,m)(b)}function m(b){return st(b)?mt(e,_,"whitespace")(b):_(b)}function _(b){return b===null||Fe(b)?(e.exit("definition"),i.parser.defined.push(s),t(b)):n(b)}}function kse(e,t,n){return i;function i(u){return jt(u)?zd(e,s)(u):n(u)}function s(u){return m5(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function a(u){return st(u)?mt(e,l,"whitespace")(u):l(u)}function l(u){return u===null||Fe(u)?t(u):n(u)}}const Ese={name:"hardBreakEscape",tokenize:Nse};function Nse(e,t,n){return i;function i(a){return e.enter("hardBreakEscape"),e.consume(a),s}function s(a){return Fe(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const Rse={name:"headingAtx",resolve:Tse,tokenize:Dse};function Tse(e,t){let n=e.length-2,i=3;if(e[i][1].type==="whitespace"&&(i+=2),n-2>i&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(i===n-1||n-4>i&&e[n-2][1].type==="whitespace")&&(n-=i+1===n?2:4),n>i){const s={type:"atxHeadingText",start:e[i][1].start,end:e[n][1].end},a={type:"chunkText",start:e[i][1].start,end:e[n][1].end,contentType:"text"};Fr(e,i,n-i+1,[["enter",s,t],["enter",a,t],["exit",a,t],["exit",s,t]])}return e}function Dse(e,t,n){let i=0;return s;function s(g){return e.enter("atxHeading"),a(g)}function a(g){return e.enter("atxHeadingSequence"),l(g)}function l(g){return g===35&&i++<6?(e.consume(g),l):g===null||jt(g)?(e.exit("atxHeadingSequence"),u(g)):n(g)}function u(g){return g===35?(e.enter("atxHeadingSequence"),f(g)):g===null||Fe(g)?(e.exit("atxHeading"),t(g)):st(g)?mt(e,u,"whitespace")(g):(e.enter("atxHeadingText"),h(g))}function f(g){return g===35?(e.consume(g),f):(e.exit("atxHeadingSequence"),u(g))}function h(g){return g===null||g===35||jt(g)?(e.exit("atxHeadingText"),u(g)):(e.consume(g),h)}}const g5=["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"],Xx=["pre","script","style","textarea"],Ase={concrete:!0,name:"htmlFlow",resolveTo:jse,tokenize:zse},Ose={partial:!0,tokenize:Mse};function jse(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 zse(e,t,n){const i=this;let s,a,l,u,f;return h;function h(z){return g(z)}function g(z){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(z),m}function m(z){return z===33?(e.consume(z),_):z===47?(e.consume(z),a=!0,S):z===63?(e.consume(z),s=3,i.interrupt?t:j):ii(z)?(e.consume(z),l=String.fromCharCode(z),C):n(z)}function _(z){return z===45?(e.consume(z),s=2,b):z===91?(e.consume(z),s=5,u=0,x):ii(z)?(e.consume(z),s=4,i.interrupt?t:j):n(z)}function b(z){return z===45?(e.consume(z),i.interrupt?t:j):n(z)}function x(z){const M="CDATA[";return z===M.charCodeAt(u++)?(e.consume(z),u===M.length?i.interrupt?t:B:x):n(z)}function S(z){return ii(z)?(e.consume(z),l=String.fromCharCode(z),C):n(z)}function C(z){if(z===null||z===47||z===62||jt(z)){const M=z===47,K=l.toLowerCase();return!M&&!a&&Xx.includes(K)?(s=1,i.interrupt?t(z):B(z)):g5.includes(l.toLowerCase())?(s=6,M?(e.consume(z),k):i.interrupt?t(z):B(z)):(s=7,i.interrupt&&!i.parser.lazy[i.now().line]?n(z):a?R(z):N(z))}return z===45||ri(z)?(e.consume(z),l+=String.fromCharCode(z),C):n(z)}function k(z){return z===62?(e.consume(z),i.interrupt?t:B):n(z)}function R(z){return st(z)?(e.consume(z),R):U(z)}function N(z){return z===47?(e.consume(z),U):z===58||z===95||ii(z)?(e.consume(z),A):st(z)?(e.consume(z),N):U(z)}function A(z){return z===45||z===46||z===58||z===95||ri(z)?(e.consume(z),A):I(z)}function I(z){return z===61?(e.consume(z),T):st(z)?(e.consume(z),I):N(z)}function T(z){return z===null||z===60||z===61||z===62||z===96?n(z):z===34||z===39?(e.consume(z),f=z,D):st(z)?(e.consume(z),T):L(z)}function D(z){return z===f?(e.consume(z),f=null,ee):z===null||Fe(z)?n(z):(e.consume(z),D)}function L(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||jt(z)?I(z):(e.consume(z),L)}function ee(z){return z===47||z===62||st(z)?N(z):n(z)}function U(z){return z===62?(e.consume(z),F):n(z)}function F(z){return z===null||Fe(z)?B(z):st(z)?(e.consume(z),F):n(z)}function B(z){return z===45&&s===2?(e.consume(z),P):z===60&&s===1?(e.consume(z),Z):z===62&&s===4?(e.consume(z),_e):z===63&&s===3?(e.consume(z),j):z===93&&s===5?(e.consume(z),ae):Fe(z)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(Ose,Le,W)(z)):z===null||Fe(z)?(e.exit("htmlFlowData"),W(z)):(e.consume(z),B)}function W(z){return e.check(Yx,te,Le)(z)}function te(z){return e.enter("lineEnding"),e.consume(z),e.exit("lineEnding"),G}function G(z){return z===null||Fe(z)?W(z):(e.enter("htmlFlowData"),B(z))}function P(z){return z===45?(e.consume(z),j):B(z)}function Z(z){return z===47?(e.consume(z),l="",$):B(z)}function $(z){if(z===62){const M=l.toLowerCase();return Xx.includes(M)?(e.consume(z),_e):B(z)}return ii(z)&&l.length<8?(e.consume(z),l+=String.fromCharCode(z),$):B(z)}function ae(z){return z===93?(e.consume(z),j):B(z)}function j(z){return z===62?(e.consume(z),_e):z===45&&s===2?(e.consume(z),j):B(z)}function _e(z){return z===null||Fe(z)?(e.exit("htmlFlowData"),Le(z)):(e.consume(z),_e)}function Le(z){return e.exit("htmlFlow"),t(z)}}function Mse(e,t,n){return i;function i(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(oh,t,n)}}const Ise={name:"htmlText",tokenize:Pse};function Pse(e,t,n){const i=this;let s,a,l;return u;function u(j){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(j),f}function f(j){return j===33?(e.consume(j),h):j===47?(e.consume(j),I):j===63?(e.consume(j),N):ii(j)?(e.consume(j),L):n(j)}function h(j){return j===45?(e.consume(j),g):j===91?(e.consume(j),a=0,x):ii(j)?(e.consume(j),R):n(j)}function g(j){return j===45?(e.consume(j),b):n(j)}function m(j){return j===null?n(j):j===45?(e.consume(j),_):Fe(j)?(l=m,Z(j)):(e.consume(j),m)}function _(j){return j===45?(e.consume(j),b):m(j)}function b(j){return j===62?P(j):j===45?_(j):m(j)}function x(j){const _e="CDATA[";return j===_e.charCodeAt(a++)?(e.consume(j),a===_e.length?S:x):n(j)}function S(j){return j===null?n(j):j===93?(e.consume(j),C):Fe(j)?(l=S,Z(j)):(e.consume(j),S)}function C(j){return j===93?(e.consume(j),k):S(j)}function k(j){return j===62?P(j):j===93?(e.consume(j),k):S(j)}function R(j){return j===null||j===62?P(j):Fe(j)?(l=R,Z(j)):(e.consume(j),R)}function N(j){return j===null?n(j):j===63?(e.consume(j),A):Fe(j)?(l=N,Z(j)):(e.consume(j),N)}function A(j){return j===62?P(j):N(j)}function I(j){return ii(j)?(e.consume(j),T):n(j)}function T(j){return j===45||ri(j)?(e.consume(j),T):D(j)}function D(j){return Fe(j)?(l=D,Z(j)):st(j)?(e.consume(j),D):P(j)}function L(j){return j===45||ri(j)?(e.consume(j),L):j===47||j===62||jt(j)?ee(j):n(j)}function ee(j){return j===47?(e.consume(j),P):j===58||j===95||ii(j)?(e.consume(j),U):Fe(j)?(l=ee,Z(j)):st(j)?(e.consume(j),ee):P(j)}function U(j){return j===45||j===46||j===58||j===95||ri(j)?(e.consume(j),U):F(j)}function F(j){return j===61?(e.consume(j),B):Fe(j)?(l=F,Z(j)):st(j)?(e.consume(j),F):ee(j)}function B(j){return j===null||j===60||j===61||j===62||j===96?n(j):j===34||j===39?(e.consume(j),s=j,W):Fe(j)?(l=B,Z(j)):st(j)?(e.consume(j),B):(e.consume(j),te)}function W(j){return j===s?(e.consume(j),s=void 0,G):j===null?n(j):Fe(j)?(l=W,Z(j)):(e.consume(j),W)}function te(j){return j===null||j===34||j===39||j===60||j===61||j===96?n(j):j===47||j===62||jt(j)?ee(j):(e.consume(j),te)}function G(j){return j===47||j===62||jt(j)?ee(j):n(j)}function P(j){return j===62?(e.consume(j),e.exit("htmlTextData"),e.exit("htmlText"),t):n(j)}function Z(j){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),$}function $(j){return st(j)?mt(e,ae,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(j):ae(j)}function ae(j){return e.enter("htmlTextData"),l(j)}}const cS={name:"labelEnd",resolveAll:Use,resolveTo:Hse,tokenize:$se},Lse={tokenize:qse},Bse={tokenize:Wse},Fse={tokenize:Kse};function Use(e){let t=-1;const n=[];for(;++t<e.length;){const i=e[t][1];if(n.push(e[t]),i.type==="labelImage"||i.type==="labelLink"||i.type==="labelEnd"){const s=i.type==="labelImage"?4:2;i.type="data",t+=s}}return e.length!==n.length&&Fr(e,0,e.length,n),e}function Hse(e,t){let n=e.length,i=0,s,a,l;for(;n--;){const g=e[n][1];if(s){if(g.type==="link"||g.type==="labelLink"&&g._inactive)break;e[n][0]==="enter"&&g.type==="labelLink"&&(g._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(g.type==="labelImage"||g.type==="labelLink")&&!g._balanced&&(s=n,g.type!=="labelLink")){i=2;break}}else g.type==="labelEnd"&&(a=n)}const u={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},f={type:"label",start:{...e[s][1].start},end:{...e[a][1].end}},h={type:"labelText",start:{...e[s+i+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",u,t],["enter",f,t]],l=wr(l,e.slice(s+1,s+i+3)),l=wr(l,[["enter",h,t]]),l=wr(l,og(t.parser.constructs.insideSpan.null,e.slice(s+i+4,a-3),t)),l=wr(l,[["exit",h,t],e[a-2],e[a-1],["exit",f,t]]),l=wr(l,e.slice(a+1)),l=wr(l,[["exit",u,t]]),Fr(e,s,e.length,l),e}function $se(e,t,n){const i=this,s=i._labelStarts;let a,l;if(s){for(;s.length>0&&s[s.length-1]._balanced;)s.pop();a=s[s.length-1]}return u;function u(_){return a?a._inactive?m(_):(l=i.parser.defined.includes(Ur(i.sliceSerialize({start:a.end,end:i.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(_),e.exit("labelMarker"),e.exit("labelEnd"),f):n(_)}function f(_){return _===40?e.attempt(Lse,g,l?g:m)(_):_===91?e.attempt(Bse,g,l?h:m)(_):l?g(_):m(_)}function h(_){return e.attempt(Fse,g,m)(_)}function g(_){return s.pop(),t(_)}function m(_){return a._balanced=!0,n(_)}}function qse(e,t,n){return i;function i(m){return e.enter("resource"),e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),s}function s(m){return jt(m)?zd(e,a)(m):a(m)}function a(m){return m===41?g(m):f5(e,l,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(m)}function l(m){return jt(m)?zd(e,f)(m):g(m)}function u(m){return n(m)}function f(m){return m===34||m===39||m===40?m5(e,h,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(m):g(m)}function h(m){return jt(m)?zd(e,g)(m):g(m)}function g(m){return m===41?(e.enter("resourceMarker"),e.consume(m),e.exit("resourceMarker"),e.exit("resource"),t):n(m)}}function Wse(e,t,n){const i=this;return s;function s(u){return p5.call(i,e,a,l,"reference","referenceMarker","referenceString")(u)}function a(u){return i.parser.defined.includes(Ur(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?t(u):n(u)}function l(u){return n(u)}}function Kse(e,t,n){return i;function i(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),s}function s(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const Vse={name:"labelStartImage",resolveAll:cS.resolveAll,tokenize:Gse};function Gse(e,t,n){const i=this;let s;return a;function a(f){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(f),e.exit("labelImageMarker"),l}function l(f){return f===91?(e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),s=e.exit("labelImage"),u):n(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(f):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(s),t(f))}}const Zse={name:"labelStartLink",resolveAll:cS.resolveAll,tokenize:Yse};function Yse(e,t,n){const i=this;let s;return a;function a(u){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(u),e.exit("labelMarker"),s=e.exit("labelLink"),l}function l(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?n(u):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(s),t(u))}}const Y_={name:"lineEnding",tokenize:Xse};function Xse(e,t){return n;function n(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),mt(e,t,"linePrefix")}}const Fp={name:"thematicBreak",tokenize:Qse};function Qse(e,t,n){let i=0,s;return a;function a(h){return e.enter("thematicBreak"),l(h)}function l(h){return s=h,u(h)}function u(h){return h===s?(e.enter("thematicBreakSequence"),f(h)):i>=3&&(h===null||Fe(h))?(e.exit("thematicBreak"),t(h)):n(h)}function f(h){return h===s?(e.consume(h),i++,f):(e.exit("thematicBreakSequence"),st(h)?mt(e,u,"whitespace")(h):u(h))}}const zi={continuation:{tokenize:noe},exit:roe,name:"list",tokenize:toe},Jse={partial:!0,tokenize:soe},eoe={partial:!0,tokenize:ioe};function toe(e,t,n){const i=this,s=i.events[i.events.length-1];let a=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,l=0;return u;function u(b){const x=i.containerState.type||(b===42||b===43||b===45?"listUnordered":"listOrdered");if(x==="listUnordered"?!i.containerState.marker||b===i.containerState.marker:Gx(b)){if(i.containerState.type||(i.containerState.type=x,e.enter(x,{_container:!0})),x==="listUnordered")return e.enter("listItemPrefix"),b===42||b===45?e.check(Fp,n,h)(b):h(b);if(!i.interrupt||b===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),f(b)}return n(b)}function f(b){return Gx(b)&&++l<10?(e.consume(b),f):(!i.interrupt||l<2)&&(i.containerState.marker?b===i.containerState.marker:b===41||b===46)?(e.exit("listItemValue"),h(b)):n(b)}function h(b){return e.enter("listItemMarker"),e.consume(b),e.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||b,e.check(oh,i.interrupt?n:g,e.attempt(Jse,_,m))}function g(b){return i.containerState.initialBlankLine=!0,a++,_(b)}function m(b){return st(b)?(e.enter("listItemPrefixWhitespace"),e.consume(b),e.exit("listItemPrefixWhitespace"),_):n(b)}function _(b){return i.containerState.size=a+i.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(b)}}function noe(e,t,n){const i=this;return i.containerState._closeFlow=void 0,e.check(oh,s,a);function s(u){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,mt(e,t,"listItemIndent",i.containerState.size+1)(u)}function a(u){return i.containerState.furtherBlankLines||!st(u)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,l(u)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,e.attempt(eoe,t,l)(u))}function l(u){return i.containerState._closeFlow=!0,i.interrupt=void 0,mt(e,e.attempt(zi,t,n),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function ioe(e,t,n){const i=this;return mt(e,s,"listItemIndent",i.containerState.size+1);function s(a){const l=i.events[i.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===i.containerState.size?t(a):n(a)}}function roe(e){e.exit(this.containerState.type)}function soe(e,t,n){const i=this;return mt(e,s,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(a){const l=i.events[i.events.length-1];return!st(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const YT={name:"setextUnderline",resolveTo:ooe,tokenize:aoe};function ooe(e,t){const n=new mm;let i=e.length,s,a,l;for(;i--;)if(e[i][0]==="enter"){if(e[i][1].type==="content"){s=i;break}e[i][1].type==="paragraph"&&(a=i)}else e[i][1].type==="content"&&n.add(i,1,[]),!l&&e[i][1].type==="definition"&&(l=i);const u={type:"setextHeading",start:{...e[s][1].start},end:{...e[e.length-1][1].end}};return e[a][1].type="setextHeadingText",l?(n.add(a,0,[["enter",u,t]]),n.add(l+1,0,[["exit",e[s][1],t]]),e[s][1].end={...e[l][1].end}):e[s][1]=u,n.add(e.length,0,[["exit",u,t]]),n.consume(e),e}function aoe(e,t,n){const i=this;let s;return a;function a(h){let g=i.events.length,m;for(;g--;)if(i.events[g][1].type!=="lineEnding"&&i.events[g][1].type!=="linePrefix"&&i.events[g][1].type!=="content"){m=i.events[g][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||m)?(e.enter("setextHeadingLine"),s=h,l(h)):n(h)}function l(h){return e.enter("setextHeadingLineSequence"),u(h)}function u(h){return h===s?(e.consume(h),u):(e.exit("setextHeadingLineSequence"),st(h)?mt(e,f,"lineSuffix")(h):f(h))}function f(h){return h===null||Fe(h)?(e.exit("setextHeadingLine"),t(h)):n(h)}}const loe={tokenize:coe};function coe(e){const t=this,n=e.attempt(oh,i,e.attempt(this.parser.constructs.flowInitial,s,mt(e,e.attempt(this.parser.constructs.flow,s,e.attempt(vse,s)),"linePrefix")));return n;function i(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const uoe={resolveAll:y5()},doe=v5("string"),hoe=v5("text");function v5(e){return{resolveAll:y5(e==="text"?foe:void 0),tokenize:t};function t(n){const i=this,s=this.parser.constructs[e],a=n.attempt(s,l,u);return l;function l(g){return h(g)?a(g):u(g)}function u(g){if(g===null){n.consume(g);return}return n.enter("data"),n.consume(g),f}function f(g){return h(g)?(n.exit("data"),a(g)):(n.consume(g),f)}function h(g){if(g===null)return!0;const m=s[g];let _=-1;if(m)for(;++_<m.length;){const b=m[_];if(!b.previous||b.previous.call(i,i.previous))return!0}return!1}}}function y5(e){return t;function t(n,i){let s=-1,a;for(;++s<=n.length;)a===void 0?n[s]&&n[s][1].type==="data"&&(a=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==a+2&&(n[a][1].end=n[s-1][1].end,n.splice(a+2,s-a-2),s=a+2),a=void 0);return e?e(n,i):n}}function foe(e,t){const n=new mm;let i=0;for(;++i<=e.length;)if((i===e.length||e[i][1].type==="lineEnding")&&e[i-1][1].type==="data"){const s=e[i-1][1],a=t.sliceStream(s);let l=a.length,u=-1,f=0,h;for(;l--;){const g=a[l];if(typeof g=="string"){for(u=g.length;g.charCodeAt(u-1)===32;)f++,u--;if(u)break;u=-1}else if(g===-2)h=!0,f++;else if(g!==-1){l++;break}}if(t._contentTypeTextTrailing&&i===e.length&&(f=0),f){const g={type:i===e.length||h||f<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:l?u:s.start._bufferIndex+u,_index:s.start._index+l,line:s.end.line,column:s.end.column-f,offset:s.end.offset-f},end:{...s.end}};s.end={...g.start},s.start.offset===s.end.offset?Object.assign(s,g):n.add(i,0,[["enter",g,t],["exit",g,t]])}i++}return n.consume(e),e}const poe={42:zi,43:zi,45:zi,48:zi,49:zi,50:zi,51:zi,52:zi,53:zi,54:zi,55:zi,56:zi,57:zi,62:c5},moe={91:Sse},goe={[-2]:Z_,[-1]:Z_,32:Z_},voe={35:Rse,42:Fp,45:[YT,Fp],60:Ase,61:YT,95:Fp,96:ZT,126:ZT},yoe={38:d5,92:u5},_oe={[-5]:Y_,[-4]:Y_,[-3]:Y_,33:Vse,38:d5,42:Zx,60:[Qre,Ise],91:Zse,92:[Ese,u5],93:cS,95:Zx,96:dse},boe={null:[Zx,uoe]},xoe={null:[42,95]},Soe={null:[]},woe=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:xoe,contentInitial:moe,disable:Soe,document:poe,flow:voe,flowInitial:goe,insideSpan:boe,string:yoe,text:_oe},Symbol.toStringTag,{value:"Module"}));function Coe(e,t,n){let i={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},a=[];let l=[],u=[];const f={attempt:D(I),check:D(T),consume:R,enter:N,exit:A,interrupt:D(T,{interrupt:!0})},h={code:null,containerState:{},defineSkip:S,events:[],now:x,parser:e,previous:null,sliceSerialize:_,sliceStream:b,write:m};let g=t.tokenize.call(h,f);return t.resolveAll&&a.push(t),h;function m(F){return l=wr(l,F),C(),l[l.length-1]!==null?[]:(L(t,0),h.events=og(a,h.events,h),h.events)}function _(F,B){return Eoe(b(F),B)}function b(F){return koe(l,F)}function x(){const{_bufferIndex:F,_index:B,line:W,column:te,offset:G}=i;return{_bufferIndex:F,_index:B,line:W,column:te,offset:G}}function S(F){s[F.line]=F.column,U()}function C(){for(;i._index<l.length;){const F=l[i._index];if(typeof F=="string"){const B=i._index;for(i._bufferIndex<0&&(i._bufferIndex=0);i._index===B&&i._bufferIndex<F.length;)k(F.charCodeAt(i._bufferIndex))}else k(F)}}function k(F){g=g(F)}function R(F){Fe(F)?(i.line++,i.column=1,i.offset+=F===-3?2:1,U()):F!==-1&&(i.column++,i.offset++),i._bufferIndex<0?i._index++:(i._bufferIndex++,i._bufferIndex===l[i._index].length&&(i._bufferIndex=-1,i._index++)),h.previous=F}function N(F,B){const W=B||{};return W.type=F,W.start=x(),h.events.push(["enter",W,h]),u.push(W),W}function A(F){const B=u.pop();return B.end=x(),h.events.push(["exit",B,h]),B}function I(F,B){L(F,B.from)}function T(F,B){B.restore()}function D(F,B){return W;function W(te,G,P){let Z,$,ae,j;return Array.isArray(te)?Le(te):"tokenize"in te?Le([te]):_e(te);function _e(ne){return me;function me(Ee){const ve=Ee!==null&&ne[Ee],Re=Ee!==null&&ne.null,re=[...Array.isArray(ve)?ve:ve?[ve]:[],...Array.isArray(Re)?Re:Re?[Re]:[]];return Le(re)(Ee)}}function Le(ne){return Z=ne,$=0,ne.length===0?P:z(ne[$])}function z(ne){return me;function me(Ee){return j=ee(),ae=ne,ne.partial||(h.currentConstruct=ne),ne.name&&h.parser.constructs.disable.null.includes(ne.name)?K():ne.tokenize.call(B?Object.assign(Object.create(h),B):h,f,M,K)(Ee)}}function M(ne){return F(ae,j),G}function K(ne){return j.restore(),++$<Z.length?z(Z[$]):P}}}function L(F,B){F.resolveAll&&!a.includes(F)&&a.push(F),F.resolve&&Fr(h.events,B,h.events.length-B,F.resolve(h.events.slice(B),h)),F.resolveTo&&(h.events=F.resolveTo(h.events,h))}function ee(){const F=x(),B=h.previous,W=h.currentConstruct,te=h.events.length,G=Array.from(u);return{from:te,restore:P};function P(){i=F,h.previous=B,h.currentConstruct=W,h.events.length=te,u=G,U()}}function U(){i.line in s&&i.column<2&&(i.column=s[i.line],i.offset+=s[i.line]-1)}}function koe(e,t){const n=t.start._index,i=t.start._bufferIndex,s=t.end._index,a=t.end._bufferIndex;let l;if(n===s)l=[e[n].slice(i,a)];else{if(l=e.slice(n,s),i>-1){const u=l[0];typeof u=="string"?l[0]=u.slice(i):l.shift()}a>0&&l.push(e[s].slice(0,a))}return l}function Eoe(e,t){let n=-1;const i=[];let s;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
128
- `;break}case-3:{l=`\r
129
- `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&s)continue;l=" ";break}default:l=String.fromCharCode(a)}s=a===-2,i.push(l)}return i.join("")}function Noe(e){const i={constructs:s5([woe,...(e||{}).extensions||[]]),content:s(Wre),defined:[],document:s(Vre),flow:s(loe),lazy:{},string:s(doe),text:s(hoe)};return i;function s(a){return l;function l(u){return Coe(i,a,u)}}}function Roe(e){for(;!h5(e););return e}const XT=/[\0\t\n\r]/g;function Toe(){let e=1,t="",n=!0,i;return s;function s(a,l,u){a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a));const f=[];let h=0;for(t="",n&&(a.charCodeAt(0)===65279&&h++,n=void 0);h<a.length;){XT.lastIndex=h;const g=XT.exec(a),m=g&&g.index!==void 0?g.index:a.length,_=a.charCodeAt(m);if(!g){t=a.slice(h);break}if(_===10&&h===m&&i)f.push(-3),i=void 0;else switch(i&&(f.push(-5),i=void 0),h<m&&(f.push(a.slice(h,m)),e+=m-h),_){case 0:{f.push(65533),e++;break}case 9:{const b=Math.ceil(e/4)*4;for(f.push(-2);e++<b;)f.push(-1);break}case 10:{f.push(-4),e=1;break}default:i=!0,e=1}h=m+1}return u&&(i&&f.push(-5),t&&f.push(t),f.push(null)),f}}const Doe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Aoe(e){return e.replace(Doe,Ooe)}function Ooe(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),a=s===120||s===88;return o5(n.slice(a?2:1),a?16:10)}return lS(n)||e}const _5={}.hasOwnProperty;function joe(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),zoe(n)(Roe(Noe(n).document().write(Toe()(e,t,!0))))}function zoe(e){const t={afterExit:[],beforeEnter:[],transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:l(xt),autolinkProtocol:U,autolinkEmail:U,atxHeading:l(Ut),blockQuote:l(re),characterEscape:U,characterReference:U,codeFenced:l(he),codeFencedFenceInfo:u,codeFencedFenceMeta:u,codeIndented:l(he,u),codeText:l(J,u),codeTextData:U,data:U,codeFlowValue:U,definition:l(Ie),definitionDestinationString:u,definitionLabelString:u,definitionTitleString:u,emphasis:l(Ze),hardBreakEscape:l(Et),hardBreakTrailing:l(Et),htmlFlow:l(tt,u),htmlFlowData:U,htmlText:l(tt,u),htmlTextData:U,image:l(Lt),label:u,link:l(xt),listItem:l(Tr),listItemValue:b,listOrdered:l(Bt,_),listUnordered:l(Bt),paragraph:l(go),reference:M,referenceString:u,resourceDestinationString:u,resourceTitleString:u,setextHeading:l(Ut),strong:l(Dr),thematicBreak:l(Kr)},exit:{atxHeading:h(),atxHeadingSequence:T,autolink:h(),autolinkEmail:Re,autolinkProtocol:ve,blockQuote:h(),characterEscapeValue:F,characterReferenceMarkerHexadecimal:ne,characterReferenceMarkerNumeric:ne,characterReferenceValue:me,characterReference:Ee,codeFenced:h(k),codeFencedFence:C,codeFencedFenceInfo:x,codeFencedFenceMeta:S,codeFlowValue:F,codeIndented:h(R),codeText:h(P),codeTextData:F,data:F,definition:h(),definitionDestinationString:I,definitionLabelString:N,definitionTitleString:A,emphasis:h(),hardBreakEscape:h(W),hardBreakTrailing:h(W),htmlFlow:h(te),htmlFlowData:F,htmlText:h(G),htmlTextData:F,image:h($),label:j,labelText:ae,lineEnding:B,link:h(Z),listItem:h(),listOrdered:h(),listUnordered:h(),paragraph:h(),referenceString:K,resourceDestinationString:_e,resourceTitleString:Le,resource:z,setextHeading:h(ee),setextHeadingLineSequence:L,setextHeadingText:D,strong:h(),thematicBreak:h()}};b5(t,(e||{}).mdastExtensions||[]);const n={};return i;function i(le){let ye={type:"root",children:[],position:void 0};const Pe={stack:[ye],tokenStack:[],config:t,enter:f,exit:g,buffer:u,resume:m,data:n},He=[],dn=[];let St=-1;for(;++St<le.length;)if(dn.push(le[St]),le[St][1].type==="listOrdered"||le[St][1].type==="listUnordered")if(le[St][0]==="enter")He.push(dn.length-1);else{const Be=He.pop();a(dn,Be)}for(le=dn,St=-1;++St<le.length;){const Be=t[le[St][0]];le[St][0]==="enter"&&t.beforeEnter.length>0&&s(t.beforeEnter,{...Pe,sliceSerialize:le[St][2].sliceSerialize},le[St][1]),_5.call(Be,le[St][1].type)&&Be[le[St][1].type].call({...Pe,sliceSerialize:le[St][2].sliceSerialize},le[St][1]),le[St][0]==="exit"&&t.afterExit.length>0&&s(t.afterExit,{...Pe,sliceSerialize:le[St][2].sliceSerialize},le[St][1])}if(Pe.tokenStack.length>0){const Be=Pe.tokenStack[Pe.tokenStack.length-1];(Be[1]||QT).call(Pe,void 0,Be[0])}for(ye.position={start:Zo(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:Zo(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},St=-1;++St<t.transforms.length;)ye=t.transforms[St](ye)||ye;return ye}function s(le,ye,Pe){let He=-1;for(;++He<le.length;)le[He].call(ye,Pe)}function a(le,ye){const Pe=le.length-1;let He=ye-1,dn=-1,St=!1,Be,Ye,kn,hn;const Ei=[];for(;++He<=Pe;){const Mn=le[He];switch(Mn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Mn[0]==="enter"?dn++:dn--,hn=void 0;break}case"lineEndingBlank":{Mn[0]==="enter"&&(Be&&!hn&&!dn&&!kn&&(kn=He),hn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:hn=void 0}if(!dn&&Mn[0]==="enter"&&Mn[1].type==="listItemPrefix"||dn===-1&&Mn[0]==="exit"&&(Mn[1].type==="listUnordered"||Mn[1].type==="listOrdered")){if(Be){let Os=He;for(Ye=void 0;Os--;){const lr=le[Os];if(lr[1].type==="lineEnding"||lr[1].type==="lineEndingBlank"){if(lr[0]==="exit")continue;Ye&&(le[Ye][1].type="lineEndingBlank",St=!0),lr[1].type="lineEnding",Ye=Os}else if(!(lr[1].type==="linePrefix"||lr[1].type==="blockQuotePrefix"||lr[1].type==="blockQuotePrefixWhitespace"||lr[1].type==="blockQuoteMarker"||lr[1].type==="listItemIndent"))break}kn&&(!Ye||kn<Ye)&&(Be._spread=!0),Be.end=Object.assign({},Ye?le[Ye][1].start:Mn[1].end),Ei.push({at:Ye||He,event:["exit",Be,Mn[2]]})}if(Mn[1].type==="listItemPrefix"){const Os={type:"listItem",_spread:!1,start:Object.assign({},Mn[1].start),end:void 0};Be=Os,Ei.push({at:He,event:["enter",Os,Mn[2]]}),kn=void 0,hn=!0}}}const Vr=le.splice(ye);let _t=0;for(He=-1;++He<Vr.length;){for(;_t<Ei.length&&Ei[_t].at===ye+He;)le.push(Ei[_t++].event);le.push(Vr[He])}le[ye][1]._spread=St}function l(le,ye){return Pe;function Pe(He){f.call(this,le(He),He),ye&&ye.call(this,He)}}function u(){this.stack.push({type:"fragment",children:[]})}function f(le,ye,Pe){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([ye,Pe||void 0]),le.position={start:Zo(ye.start),end:void 0}}function h(le){return ye;function ye(Pe){le&&le.call(this,Pe),g.call(this,Pe)}}function g(le,ye){const Pe=this.stack.pop(),He=this.tokenStack.pop();if(!He)throw new Error("Cannot close `"+le.type+"` ("+jd({start:le.start,end:le.end})+"): it’s not open");He[0].type!==le.type&&(ye?ye.call(this,le,He[0]):(He[1]||QT).call(this,le,He[0])),Pe.position.end=Zo(le.end)}function m(){return aS(this.stack.pop())}function _(){this.data.expectingFirstListItemValue=!0}function b(le){if(this.data.expectingFirstListItemValue){const ye=this.stack[this.stack.length-2];ye.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function x(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.lang=le}function S(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.meta=le}function C(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function R(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.value=le.replace(/(\r?\n|\r)$/g,"")}function N(le){const ye=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=ye,Pe.identifier=Ur(this.sliceSerialize(le)).toLowerCase()}function A(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.title=le}function I(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.url=le}function T(le){const ye=this.stack[this.stack.length-1];if(!ye.depth){const Pe=this.sliceSerialize(le).length;ye.depth=Pe}}function D(){this.data.setextHeadingSlurpLineEnding=!0}function L(le){const ye=this.stack[this.stack.length-1];ye.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function ee(){this.data.setextHeadingSlurpLineEnding=void 0}function U(le){const Pe=this.stack[this.stack.length-1].children;let He=Pe[Pe.length-1];(!He||He.type!=="text")&&(He=Wr(),He.position={start:Zo(le.start),end:void 0},Pe.push(He)),this.stack.push(He)}function F(le){const ye=this.stack.pop();ye.value+=this.sliceSerialize(le),ye.position.end=Zo(le.end)}function B(le){const ye=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Pe=ye.children[ye.children.length-1];Pe.position.end=Zo(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ye.type)&&(U.call(this,le),F.call(this,le))}function W(){this.data.atHardBreak=!0}function te(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.value=le}function G(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.value=le}function P(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.value=le}function Z(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ye,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function $(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const ye=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=ye,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function ae(le){const ye=this.sliceSerialize(le),Pe=this.stack[this.stack.length-2];Pe.label=Aoe(ye),Pe.identifier=Ur(ye).toLowerCase()}function j(){const le=this.stack[this.stack.length-1],ye=this.resume(),Pe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Pe.type==="link"){const He=le.children;Pe.children=He}else Pe.alt=ye}function _e(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.url=le}function Le(){const le=this.resume(),ye=this.stack[this.stack.length-1];ye.title=le}function z(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function K(le){const ye=this.resume(),Pe=this.stack[this.stack.length-1];Pe.label=ye,Pe.identifier=Ur(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function ne(le){this.data.characterReferenceType=le.type}function me(le){const ye=this.sliceSerialize(le),Pe=this.data.characterReferenceType;let He;Pe?(He=o5(ye,Pe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):He=lS(ye);const dn=this.stack[this.stack.length-1];dn.value+=He}function Ee(le){const ye=this.stack.pop();ye.position.end=Zo(le.end)}function ve(le){F.call(this,le);const ye=this.stack[this.stack.length-1];ye.url=this.sliceSerialize(le)}function Re(le){F.call(this,le);const ye=this.stack[this.stack.length-1];ye.url="mailto:"+this.sliceSerialize(le)}function re(){return{type:"blockquote",children:[],position:void 0}}function he(){return{type:"code",lang:null,meta:null,value:"",position:void 0}}function J(){return{type:"inlineCode",value:"",position:void 0}}function Ie(){return{type:"definition",identifier:"",label:null,title:null,url:"",position:void 0}}function Ze(){return{type:"emphasis",children:[],position:void 0}}function Ut(){return{type:"heading",depth:0,children:[],position:void 0}}function Et(){return{type:"break",position:void 0}}function tt(){return{type:"html",value:"",position:void 0}}function Lt(){return{type:"image",title:null,url:"",alt:null,position:void 0}}function xt(){return{type:"link",title:null,url:"",children:[],position:void 0}}function Bt(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[],position:void 0}}function Tr(le){return{type:"listItem",spread:le._spread,checked:null,children:[],position:void 0}}function go(){return{type:"paragraph",children:[],position:void 0}}function Dr(){return{type:"strong",children:[],position:void 0}}function Wr(){return{type:"text",value:"",position:void 0}}function Kr(){return{type:"thematicBreak",position:void 0}}}function Zo(e){return{line:e.line,column:e.column,offset:e.offset}}function b5(e,t){let n=-1;for(;++n<t.length;){const i=t[n];Array.isArray(i)?b5(e,i):Moe(e,i)}}function Moe(e,t){let n;for(n in t)if(_5.call(t,n))switch(n){case"canContainEols":{const i=t[n];i&&e[n].push(...i);break}case"transforms":{const i=t[n];i&&e[n].push(...i);break}case"afterExit":case"beforeEnter":{const i=t[n];i&&e[n].push(i);break}case"enter":case"exit":{const i=t[n];i&&Object.assign(e[n],i);break}}}function QT(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+jd({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+jd({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+jd({start:t.start,end:t.end})+") is still open")}function Ioe(e){const t=this;t.parser=n;function n(i){return joe(i,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Poe(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Loe(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
130
- `}]}function Boe(e,t){const n=t.value?t.value+`
131
- `:"",i={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(i.className=["language-"+s[0]]);let a={type:"element",tagName:"code",properties:i,children:[{type:"text",value:n}]};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 Foe(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Uoe(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Hoe(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",i=String(t.identifier).toUpperCase(),s=ou(i.toLowerCase()),a=e.footnoteOrder.indexOf(i);let l,u=e.footnoteCounts.get(i);u===void 0?(u=0,e.footnoteOrder.push(i),l=e.footnoteOrder.length):l=a+1,u+=1,e.footnoteCounts.set(i,u);const f={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(l)}]};e.patch(t,f);const h={type:"element",tagName:"sup",properties:{},children:[f]};return e.patch(t,h),e.applyData(t,h)}function $oe(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function qoe(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function x5(e,t){const n=t.referenceType;let i="]";if(n==="collapsed"?i+="[]":n==="full"&&(i+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+i}];const s=e.all(t),a=s[0];a&&a.type==="text"?a.value="["+a.value:s.unshift({type:"text",value:"["});const l=s[s.length-1];return l&&l.type==="text"?l.value+=i:s.push({type:"text",value:i}),s}function Woe(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return x5(e,t);const s={src:ou(i.url||""),alt:t.alt};i.title!==null&&i.title!==void 0&&(s.title=i.title);const a={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,a),e.applyData(t,a)}function Koe(e,t){const n={src:ou(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,i),e.applyData(t,i)}function Voe(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const i={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,i),e.applyData(t,i)}function Goe(e,t){const n=String(t.identifier).toUpperCase(),i=e.definitionById.get(n);if(!i)return x5(e,t);const s={href:ou(i.url||"")};i.title!==null&&i.title!==void 0&&(s.title=i.title);const a={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function Zoe(e,t){const n={href:ou(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const i={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Yoe(e,t,n){const i=e.all(t),s=n?Xoe(n):S5(t),a={},l=[];if(typeof t.checked=="boolean"){const g=i[0];let m;g&&g.type==="element"&&g.tagName==="p"?m=g:(m={type:"element",tagName:"p",properties:{},children:[]},i.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let u=-1;for(;++u<i.length;){const g=i[u];(s||u!==0||g.type!=="element"||g.tagName!=="p")&&l.push({type:"text",value:`
132
- `}),g.type==="element"&&g.tagName==="p"&&!s?l.push(...g.children):l.push(g)}const f=i[i.length-1];f&&(s||f.type!=="element"||f.tagName!=="p")&&l.push({type:"text",value:`
133
- `});const h={type:"element",tagName:"li",properties:a,children:l};return e.patch(t,h),e.applyData(t,h)}function Xoe(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let i=-1;for(;!t&&++i<n.length;)t=S5(n[i])}return t}function S5(e){const t=e.spread;return t??e.children.length>1}function Qoe(e,t){const n={},i=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<i.length;){const l=i[s];if(l.type==="element"&&l.tagName==="li"&&l.properties&&Array.isArray(l.properties.className)&&l.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const a={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Joe(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function eae(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function tae(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function nae(e,t){const n=e.all(t),i=n.shift(),s=[];if(i){const l={type:"element",tagName:"thead",properties:{},children:e.wrap([i],!0)};e.patch(t.children[0],l),s.push(l)}if(n.length>0){const l={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},u=iS(t.children[1]),f=QI(t.children[t.children.length-1]);u&&f&&(l.position={start:u,end:f}),s.push(l)}const a={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,a),e.applyData(t,a)}function iae(e,t,n){const i=n?n.children:void 0,a=(i?i.indexOf(t):1)===0?"th":"td",l=n&&n.type==="table"?n.align:void 0,u=l?l.length:t.children.length;let f=-1;const h=[];for(;++f<u;){const m=t.children[f],_={},b=l?l[f]:void 0;b&&(_.align=b);let x={type:"element",tagName:a,properties:_,children:[]};m&&(x.children=e.all(m),e.patch(m,x),x=e.applyData(m,x)),h.push(x)}const g={type:"element",tagName:"tr",properties:{},children:e.wrap(h,!0)};return e.patch(t,g),e.applyData(t,g)}function rae(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const JT=9,eD=32;function sae(e){const t=String(e),n=/\r?\n|\r/g;let i=n.exec(t),s=0;const a=[];for(;i;)a.push(tD(t.slice(s,i.index),s>0,!0),i[0]),s=i.index+i[0].length,i=n.exec(t);return a.push(tD(t.slice(s),s>0,!1)),a.join("")}function tD(e,t,n){let i=0,s=e.length;if(t){let a=e.codePointAt(i);for(;a===JT||a===eD;)i++,a=e.codePointAt(i)}if(n){let a=e.codePointAt(s-1);for(;a===JT||a===eD;)s--,a=e.codePointAt(s-1)}return s>i?e.slice(i,s):""}function oae(e,t){const n={type:"text",value:sae(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function aae(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const lae={blockquote:Poe,break:Loe,code:Boe,delete:Foe,emphasis:Uoe,footnoteReference:Hoe,heading:$oe,html:qoe,imageReference:Woe,image:Koe,inlineCode:Voe,linkReference:Goe,link:Zoe,listItem:Yoe,list:Qoe,paragraph:Joe,root:eae,strong:tae,table:nae,tableCell:rae,tableRow:iae,text:oae,thematicBreak:aae,toml:gp,yaml:gp,definition:gp,footnoteDefinition:gp};function gp(){}const w5=-1,ag=0,Md=1,gm=2,uS=3,dS=4,hS=5,fS=6,C5=7,k5=8,{defineProperty:cae}=Object,E5=typeof self=="object"?self:globalThis,nD=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new E5[e](t)},uae=(e,t)=>{const n=(s,a)=>(e.set(a,s),s),i=s=>{if(e.has(s))return e.get(s);const[a,l]=t[s];switch(a){case ag:case w5:return n(l,s);case Md:{const u=n([],s);for(const f of l)u.push(i(f));return u}case gm:{const u=n({},s);for(const[f,h]of l){const g=i(f),m=i(h);g==="__proto__"?cae(u,g,{value:m,configurable:!0,enumerable:!0,writable:!0}):u[g]=m}return u}case uS:return n(new Date(l),s);case dS:{const{source:u,flags:f}=l;return n(new RegExp(u,f),s)}case hS:{const u=n(new Map,s);for(const[f,h]of l)u.set(i(f),i(h));return u}case fS:{const u=n(new Set,s);for(const f of l)u.add(i(f));return u}case C5:{const{name:u,message:f}=l;return n(typeof E5[u]=="function"?nD(u,f):new Error(f),s)}case k5:return n(BigInt(l),s);case"BigInt":return n(Object(BigInt(l)),s);case"ArrayBuffer":return n(new Uint8Array(l).buffer,l);case"DataView":{const{buffer:u}=new Uint8Array(l);return n(new DataView(u),l)}case"-0":return-0}return n(nD(a,l),s)};return i},iD=e=>uae(new Map,e)(0),Xa="",{toString:dae}={},{keys:hae,is:fae}=Object,md=e=>{const t=typeof e;if(t!=="object"||!e)return[ag,t];const n=dae.call(e).slice(8,-1);switch(n){case"Array":return[Md,Xa];case"Object":return[gm,Xa];case"Date":return[uS,Xa];case"RegExp":return[dS,Xa];case"Map":return[hS,Xa];case"Set":return[fS,Xa];case"DataView":return[Md,n]}return n.includes("Array")?[Md,n]:e instanceof Error?[C5,e.name||"Error"]:[gm,n]},vp=([e,t])=>e===ag&&(t==="function"||t==="symbol"),pae=(e,t,n,i)=>{const s=(l,u)=>{const f=i.push(l)-1;return n.set(u,f),f},a=l=>{if(n.has(l))return n.get(l);let[u,f]=md(l);switch(u){case ag:{let g=l;switch(f){case"bigint":u=k5,g=l.toString();break;case"number":if(!l&&fae(l,-0))return i.push(["-0"])-1;break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);g=null;break;case"undefined":return s([w5],l)}return s([u,g],l)}case Md:{if(f){let _=l;return f==="DataView"?_=new Uint8Array(l.buffer):f==="ArrayBuffer"&&(_=new Uint8Array(l)),s([f,[..._]],l)}const g=[],m=s([u,g],l);for(const _ of l)g.push(a(_));return m}case gm:{if(f)switch(f){case"BigInt":return s([f,l.toString()],l);case"Boolean":case"Number":case"String":return s([f,l.valueOf()],l)}if(t&&"toJSON"in l)return a(l.toJSON());const g=[],m=s([u,g],l);for(const _ of hae(l))(e||!vp(md(l[_])))&&g.push([a(_),a(l[_])]);return m}case uS:return s([u,isNaN(l.getTime())?Xa:l.toISOString()],l);case dS:{const{source:g,flags:m}=l;return s([u,{source:g,flags:m}],l)}case hS:{const g=[],m=s([u,g],l);for(const[_,b]of l)(e||!(vp(md(_))||vp(md(b))))&&g.push([a(_),a(b)]);return m}case fS:{const g=[],m=s([u,g],l);for(const _ of l)(e||!vp(md(_)))&&g.push(a(_));return m}}const{message:h}=l;return s([u,{name:f,message:h}],l)};return a},rD=(e,{json:t,lossy:n}={})=>{const i=[];return pae(!(t||n),!!t,new Map,i)(e),i},vm=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?iD(rD(e,t)):structuredClone(e):(e,t)=>iD(rD(e,t));function mae(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function gae(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function vae(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||mae,i=e.options.footnoteBackLabel||gae,s=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",l=e.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let f=-1;for(;++f<e.footnoteOrder.length;){const h=e.footnoteById.get(e.footnoteOrder[f]);if(!h)continue;const g=e.all(h),m=String(h.identifier).toUpperCase(),_=ou(m.toLowerCase());let b=0;const x=[],S=e.footnoteCounts.get(m);for(;S!==void 0&&++b<=S;){x.length>0&&x.push({type:"text",value:" "});let R=typeof n=="string"?n:n(f,b);typeof R=="string"&&(R={type:"text",value:R}),x.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+_+(b>1?"-"+b:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(f,b),className:["data-footnote-backref"]},children:Array.isArray(R)?R:[R]})}const C=g[g.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const R=C.children[C.children.length-1];R&&R.type==="text"?R.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...x)}else g.push(...x);const k={type:"element",tagName:"li",properties:{id:t+"fn-"+_},children:e.wrap(g,!0)};e.patch(h,k),u.push(k)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...vm(l),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
134
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(u,!0)},{type:"text",value:`
135
- `}]}}const lg=(function(e){if(e==null)return xae;if(typeof e=="function")return cg(e);if(typeof e=="object")return Array.isArray(e)?yae(e):_ae(e);if(typeof e=="string")return bae(e);throw new Error("Expected function, string, or object as test")});function yae(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=lg(e[n]);return cg(i);function i(...s){let a=-1;for(;++a<t.length;)if(t[a].apply(this,s))return!0;return!1}}function _ae(e){const t=e;return cg(n);function n(i){const s=i;let a;for(a in e)if(s[a]!==t[a])return!1;return!0}}function bae(e){return cg(t);function t(n){return n&&n.type===e}}function cg(e){return t;function t(n,i,s){return!!(Sae(n)&&e.call(this,n,typeof i=="number"?i:void 0,s||void 0))}}function xae(){return!0}function Sae(e){return e!==null&&typeof e=="object"&&"type"in e}const N5=[],wae=!0,Up=!1,Qx="skip";function Jx(e,t,n,i){if(!e||typeof e!="object")throw new Error("Unexpected value `"+e+"` for `tree`, expected node");let s=!0,a,l,u,f;if(typeof n=="function"||n&&typeof n=="object"?(a=t,l=n,i&&(s=!1)):(l=t,n&&(s=!1)),typeof l=="function")u=l;else if(l&&typeof l=="object"){if(!(l.enter===null||l.enter===void 0))if(typeof l.enter=="function")u=l.enter;else throw new Error("Unexpected value `"+l.enter+"` for `visitors.enter`, expected optional visitor");if(typeof l.exit=="function")f=l.exit;else throw new Error("Unexpected value `"+l.exit+"` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)")}else throw new Error("Unexpected value `"+l+"` for `enter` or `visitors`, expected visitor or object with visitors");const h=lg(a),g=s?1:-1;m(e,void 0,[])();function m(_,b,x){const S=_&&typeof _=="object"?_:{};if(typeof S.type=="string"){const k=typeof S.tagName=="string"?S.tagName:typeof S.name=="string"?S.name:void 0;Object.defineProperty(C,"name",{value:"node ("+(_.type+(k?"<"+k+">":""))+")"})}return C;function C(){const k=!a||h(_,b,x[x.length-1]||void 0);let R=N5;if(u&&k&&(R=sD(u(_,x,b)),R[0]===Up))return R;if("children"in _&&_.children){const N=_;if(N.children&&R[0]!==Qx){let A=(s?-1:N.children.length)+g;const I=[...x,N];for(;A>-1&&A<N.children.length;){const T=N.children[A],D=m(T,A,I)();if(D[0]===Up)return D;A=typeof D[1]=="number"?D[1]:A+g}}}if(f&&k){const N=sD(f(_,x,b));if(N[0]===Qx)throw new Error("Unexpected value `"+N[0]+"` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");if(N[0]===Up||typeof N[1]=="number")return N}return R}}}function sD(e){return Array.isArray(e)?e:typeof e=="number"?[wae,e]:e==null?N5:[e]}function pS(e,t,n,i){let s,a,l;a=t,l=n,typeof a=="function"?Jx(e,s,e0(a),l):Jx(e,s,Cae(a),l)}function Cae(e){return!e||typeof e!="object"?e:{enter:typeof e.enter=="function"?e0(e.enter):e.enter,exit:typeof e.exit=="function"?e0(e.exit):e.exit}}function e0(e){return t;function t(n,i,s){return e(n,s,i[i.length-1])}}const t0={}.hasOwnProperty,kae={};function Eae(e,t){const n=t||kae,i=new Map,s=new Map,a=new Map,l={...lae,...n.handlers},u={all:h,applyData:Rae,definitionById:i,footnoteById:s,footnoteCounts:a,footnoteOrder:[],handlers:l,one:f,options:n,patch:Nae,wrap:Dae};return pS(e,function(g){if(g.type==="definition"||g.type==="footnoteDefinition"){const m=g.type==="definition"?i:s,_=String(g.identifier).toUpperCase();m.has(_)||m.set(_,g)}}),u;function f(g,m){const _=g.type,b=u.handlers[_];if(t0.call(u.handlers,_)&&b)return b(u,g,m);if(u.options.passThrough&&u.options.passThrough.includes(_)){if("children"in g){const{children:S,...C}=g,k=vm(C);return k.children=u.all(g),k}return vm(g)}return(u.options.unknownHandler||Tae)(u,g,m)}function h(g){const m=[];if("children"in g){const _=g.children;let b=-1;for(;++b<_.length;){const x=u.one(_[b],g);if(x){if(b&&_[b-1].type==="break"&&(!Array.isArray(x)&&x.type==="text"&&(x.value=oD(x.value)),!Array.isArray(x)&&x.type==="element")){const S=x.children[0];S&&S.type==="text"&&(S.value=oD(S.value))}Array.isArray(x)?m.push(...x):m.push(x)}}}return m}}function Nae(e,t){e.position&&(t.position=gre(e))}function Rae(e,t){let n=t;if(e&&e.data){const i=e.data.hName,s=e.data.hChildren,a=e.data.hProperties;if(typeof i=="string")if(n.type==="element")n.tagName=i;else{const l="children"in n?n.children:[n];n={type:"element",tagName:i,properties:{},children:l}}n.type==="element"&&a&&Object.assign(n.properties,vm(a)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function Tae(e,t){const n=t.data||{},i="value"in t&&!(t0.call(n,"hProperties")||t0.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Dae(e,t){const n=[];let i=-1;for(t&&n.push({type:"text",value:`
136
- `});++i<e.length;)i&&n.push({type:"text",value:`
137
- `}),n.push(e[i]);return t&&e.length>0&&n.push({type:"text",value:`
138
- `}),n}function oD(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function aD(e,t){const n=Eae(e,t),i=n.one(e,void 0),s=vae(n),a=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return s&&a.children.push({type:"text",value:`
139
- `},s),a}function Aae(e,t){return e&&"run"in e?async function(n,i){const s=aD(n,{file:i,...t});await e.run(s,i)}:function(n,i){return aD(n,{file:i,...e||t})}}function lD(e){if(e)throw e}var X_,cD;function Oae(){if(cD)return X_;cD=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):t.call(h)==="[object Array]"},a=function(h){if(!h||t.call(h)!=="[object Object]")return!1;var g=e.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&e.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!g&&!m)return!1;var _;for(_ in h);return typeof _>"u"||e.call(h,_)},l=function(h,g){n&&g.name==="__proto__"?n(h,g.name,{enumerable:!0,configurable:!0,value:g.newValue,writable:!0}):h[g.name]=g.newValue},u=function(h,g){if(g==="__proto__")if(e.call(h,g)){if(i)return i(h,g).value}else return;return h[g]};return X_=function f(){var h,g,m,_,b,x,S=arguments[0],C=1,k=arguments.length,R=!1;for(typeof S=="boolean"&&(R=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});C<k;++C)if(h=arguments[C],h!=null)for(g in h)m=u(S,g),_=u(h,g),S!==_&&(R&&_&&(a(_)||(b=s(_)))?(b?(b=!1,x=m&&s(m)?m:[]):x=m&&a(m)?m:{},l(S,{name:g,newValue:f(R,x,_)})):typeof _<"u"&&l(S,{name:g,newValue:_}));return S},X_}var jae=Oae();const Q_=bm(jae);function n0(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 zae(){const e=[],t={run:n,use:i};return t;function n(...s){let a=-1;const l=s.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);u(null,...s);function u(f,...h){const g=e[++a];let m=-1;if(f){l(f);return}for(;++m<s.length;)(h[m]===null||h[m]===void 0)&&(h[m]=s[m]);s=h,g?Mae(g,u)(...h):l(null,...h)}}function i(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function Mae(e,t){let n;return i;function i(...l){const u=e.length>l.length;let f;u&&l.push(s);try{f=e.apply(this,l)}catch(h){const g=h;if(u&&n)throw g;return s(g)}u||(f&&f.then&&typeof f.then=="function"?f.then(a,s):f instanceof Error?s(f):a(f))}function s(l,...u){n||(n=!0,t(l,...u))}function a(l){s(null,l)}}const us={basename:Iae,dirname:Pae,extname:Lae,join:Bae,sep:"/"};function Iae(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ah(e);let n=0,i=-1,s=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else i<0&&(a=!0,i=s+1);return i<0?"":e.slice(n,i)}if(t===e)return"";let l=-1,u=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(a){n=s+1;break}}else l<0&&(a=!0,l=s+1),u>-1&&(e.codePointAt(s)===t.codePointAt(u--)?u<0&&(i=s):(u=-1,i=l));return n===i?i=l:i<0&&(i=e.length),e.slice(n,i)}function Pae(e){if(ah(e),e.length===0)return".";let t=-1,n=e.length,i;for(;--n;)if(e.codePointAt(n)===47){if(i){t=n;break}}else i||(i=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function Lae(e){ah(e);let t=e.length,n=-1,i=0,s=-1,a=0,l;for(;t--;){const u=e.codePointAt(t);if(u===47){if(l){i=t+1;break}continue}n<0&&(l=!0,n=t+1),u===46?s<0?s=t:a!==1&&(a=1):s>-1&&(a=-1)}return s<0||n<0||a===0||a===1&&s===n-1&&s===i+1?"":e.slice(s,n)}function Bae(...e){let t=-1,n;for(;++t<e.length;)ah(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":Fae(n)}function Fae(e){ah(e);const t=e.codePointAt(0)===47;let n=Uae(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Uae(e,t){let n="",i=0,s=-1,a=0,l=-1,u,f;for(;++l<=e.length;){if(l<e.length)u=e.codePointAt(l);else{if(u===47)break;u=47}if(u===47){if(!(s===l-1||a===1))if(s!==l-1&&a===2){if(n.length<2||i!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(f=n.lastIndexOf("/"),f!==n.length-1){f<0?(n="",i=0):(n=n.slice(0,f),i=n.length-1-n.lastIndexOf("/")),s=l,a=0;continue}}else if(n.length>0){n="",i=0,s=l,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",i=2)}else n.length>0?n+="/"+e.slice(s+1,l):n=e.slice(s+1,l),i=l-s-1;s=l,a=0}else u===46&&a>-1?a++:a=-1}return n}function ah(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Hae={cwd:$ae};function $ae(){return"/"}function i0(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function qae(e){if(typeof e=="string")e=new URL(e);else if(!i0(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 Wae(e)}function Wae(e){if(e.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const i=t.codePointAt(n+2);if(i===70||i===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const J_=["history","path","basename","stem","extname","dirname"];class R5{constructor(t){let n;t?i0(t)?n={path:t}:typeof t=="string"||Kae(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Hae.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let i=-1;for(;++i<J_.length;){const a=J_[i];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let s;for(s in n)J_.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?us.basename(this.path):void 0}set basename(t){tb(t,"basename"),eb(t,"basename"),this.path=us.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?us.dirname(this.path):void 0}set dirname(t){uD(this.basename,"dirname"),this.path=us.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?us.extname(this.path):void 0}set extname(t){if(eb(t,"extname"),uD(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=us.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){i0(t)&&(t=qae(t)),tb(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?us.basename(this.path,this.extname):void 0}set stem(t){tb(t,"stem"),eb(t,"stem"),this.path=us.join(this.dirname||"",t+(this.extname||""))}fail(t,n,i){const s=this.message(t,n,i);throw s.fatal=!0,s}info(t,n,i){const s=this.message(t,n,i);return s.fatal=void 0,s}message(t,n,i){const s=new hi(t,n,i);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function eb(e,t){if(e&&e.includes(us.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+us.sep+"`")}function tb(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function uD(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function Kae(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Vae=(function(e){const i=this.constructor.prototype,s=i[e],a=function(){return s.apply(a,arguments)};return Object.setPrototypeOf(a,i),a}),Gae={}.hasOwnProperty;class mS extends Vae{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=zae()}copy(){const t=new mS;let n=-1;for(;++n<this.attachers.length;){const i=this.attachers[n];t.use(...i)}return t.data(Q_(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(rb("data",this.frozen),this.namespace[t]=n,this):Gae.call(this.namespace,t)&&this.namespace[t]||void 0:t?(rb("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...i]=this.attachers[this.freezeIndex];if(i[0]===!1)continue;i[0]===!0&&(i[0]=void 0);const s=n.call(t,...i);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=yp(t),i=this.parser||this.Parser;return nb("parse",i),i(String(n),n)}process(t,n){const i=this;return this.freeze(),nb("process",this.parser||this.Parser),ib("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(a,l){const u=yp(t),f=i.parse(u);i.run(f,u,function(g,m,_){if(g||!m||!_)return h(g);const b=m,x=i.stringify(b,_);Xae(x)?_.value=x:_.result=x,h(g,_)});function h(g,m){g||!m?l(g):a?a(m):n(void 0,m)}}}processSync(t){let n=!1,i;return this.freeze(),nb("processSync",this.parser||this.Parser),ib("processSync",this.compiler||this.Compiler),this.process(t,s),hD("processSync","process",n),i;function s(a,l){n=!0,lD(a),i=l}}run(t,n,i){dD(t),this.freeze();const s=this.transformers;return!i&&typeof n=="function"&&(i=n,n=void 0),i?a(void 0,i):new Promise(a);function a(l,u){const f=yp(n);s.run(t,f,h);function h(g,m,_){const b=m||t;g?u(g):l?l(b):i(void 0,b,_)}}}runSync(t,n){let i=!1,s;return this.run(t,n,a),hD("runSync","run",i),s;function a(l,u){lD(l),s=u,i=!0}}stringify(t,n){this.freeze();const i=yp(n),s=this.compiler||this.Compiler;return ib("stringify",s),dD(t),s(t,i)}use(t,...n){const i=this.attachers,s=this.namespace;if(rb("use",this.frozen),t!=null)if(typeof t=="function")f(t,n);else if(typeof t=="object")Array.isArray(t)?u(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(h){if(typeof h=="function")f(h,[]);else if(typeof h=="object")if(Array.isArray(h)){const[g,...m]=h;f(g,m)}else l(h);else throw new TypeError("Expected usable value, not `"+h+"`")}function l(h){if(!("plugins"in h)&&!("settings"in h))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");u(h.plugins),h.settings&&(s.settings=Q_(!0,s.settings,h.settings))}function u(h){let g=-1;if(h!=null)if(Array.isArray(h))for(;++g<h.length;){const m=h[g];a(m)}else throw new TypeError("Expected a list of plugins, not `"+h+"`")}function f(h,g){let m=-1,_=-1;for(;++m<i.length;)if(i[m][0]===h){_=m;break}if(_===-1)i.push([h,...g]);else if(g.length>0){let[b,...x]=g;const S=i[_][1];n0(S)&&n0(b)&&(b=Q_(!0,S,b)),i[_]=[h,b,...x]}}}}const Zae=new mS().freeze();function nb(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ib(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function rb(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 dD(e){if(!n0(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function hD(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function yp(e){return Yae(e)?e:new R5(e)}function Yae(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function Xae(e){return typeof e=="string"||Qae(e)}function Qae(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Jae="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",fD=[],pD={allowDangerousHtml:!0},ele=/^(https?|ircs?|mailto|xmpp)$/i,tle=[{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 nle(e){const t=ile(e),n=rle(e);return sle(t.runSync(t.parse(n),n),e)}function ile(e){const t=e.rehypePlugins||fD,n=e.remarkPlugins||fD,i=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...pD}:pD;return Zae().use(Ioe).use(n).use(Aae,i).use(t)}function rle(e){const t=e.children||"",n=new R5;return typeof t=="string"&&(n.value=t),n}function sle(e,t){const n=t.allowedElements,i=t.allowElement,s=t.components,a=t.disallowedElements,l=t.skipHtml,u=t.unwrapDisallowed,f=t.urlTransform||ole;for(const g of tle)Object.hasOwn(t,g.from)&&(""+g.from+(g.to?"use `"+g.to+"` instead":"remove it")+Jae+g.id,void 0);return pS(e,h),Sre(e,{Fragment:p.Fragment,components:s,ignoreInvalidStyle:!0,jsx:p.jsx,jsxs:p.jsxs,passKeys:!0,passNode:!0});function h(g,m,_){if(g.type==="raw"&&_&&typeof m=="number")return l?_.children.splice(m,1):_.children[m]={type:"text",value:g.value},m;if(g.type==="element"){let b;for(b in G_)if(Object.hasOwn(G_,b)&&Object.hasOwn(g.properties,b)){const x=g.properties[b],S=G_[b];(S===null||S.includes(g.tagName))&&(g.properties[b]=f(String(x||""),b,g))}}if(g.type==="element"){let b=n?!n.includes(g.tagName):a?a.includes(g.tagName):!1;if(!b&&i&&typeof m=="number"&&(b=!i(g,m,_)),b&&_&&typeof m=="number")return u&&g.children?_.children.splice(m,1,...g.children):_.children.splice(m,1),m}}}function ole(e){const t=e.indexOf(":"),n=e.indexOf("?"),i=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||i!==-1&&t>i||ele.test(e.slice(0,t))?e:""}function mD(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let i=0,s=n.indexOf(t);for(;s!==-1;)i++,s=n.indexOf(t,s+t.length);return i}function ale(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function lle(e,t,n){const s=lg((n||{}).ignore||[]),a=cle(t);let l=-1;for(;++l<a.length;)Jx(e,u);function u(h,g,m){if(h.type==="text"&&typeof m=="number")return f(h,g,m);if(s(h,m,g[g.length-1]))return Qx}function f(h,g,m){const _=g[g.length-1],b=a[l][0],x=a[l][1];let S=0,C=!1,k=[];b.lastIndex=0;let R=b.exec(h.value);for(;R;){const A=R.index,I={index:R.index,input:R.input,stack:[...g,h]};let T=x(...R,I);if(typeof T=="string"&&(T=T.length>0?{type:"text",value:T}:void 0),T===!1)b.lastIndex=A+1;else{if(S!==A&&N({type:"text",value:h.value.slice(S,A)}),Array.isArray(T))for(const D of T)N(D);else T&&N(T);S=A+R[0].length,C=!0}if(!b.global)break;R=b.exec(h.value)}return C?(S<h.value.length&&N({type:"text",value:h.value.slice(S)}),_.children.splice(m,1,...k)):k=[h],m+k.length;function N(A){const I=k[k.length-1];I&&I.type==="text"&&A.type==="text"?I.value+=A.value:k.push(A)}}}function cle(e){if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const t=[],n=!e[0]||Array.isArray(e[0])?e:[e];let i=-1;for(;++i<n.length;){const s=n[i];t.push([ule(s[0]),dle(s[1])])}return t}function ule(e){return typeof e=="string"?new RegExp(ale(e),"g"):e}function dle(e){return typeof e=="function"?e:function(){return e}}const sb="phrasing",ob=["autolink","link","image","label"];function hle(){return{transforms:[_le],enter:{literalAutolink:ple,literalAutolinkEmail:ab,literalAutolinkHttp:ab,literalAutolinkWww:ab},exit:{literalAutolink:yle,literalAutolinkEmail:vle,literalAutolinkHttp:mle,literalAutolinkWww:gle}}}function fle(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:sb,notInConstruct:ob},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:sb,notInConstruct:ob},{character:":",before:"[ps]",after:"\\/",inConstruct:sb,notInConstruct:ob}]}}function ple(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function ab(e){this.config.enter.autolinkProtocol.call(this,e)}function mle(e){this.config.exit.autolinkProtocol.call(this,e)}function gle(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function vle(e){this.config.exit.autolinkEmail.call(this,e)}function yle(e){this.exit(e)}function _le(e){lle(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,ble],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),xle]],{ignore:["link","linkReference"]})}function ble(e,t,n,i,s){let a="";if(!T5(s)||(/^w/i.test(t)&&(n=t+n,t="",a="http://"),!Sle(n)))return!1;const l=wle(n+i);if(!l[0])return!1;const u={type:"link",title:null,url:a+t+l[0],children:[{type:"text",value:t+l[0]}]};return l[1]?[u,{type:"text",value:l[1]}]:u}function xle(e,t,n,i){return!T5(i,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Sle(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function wle(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],i=n.indexOf(")");const s=mD(e,"(");let a=mD(e,")");for(;i!==-1&&s>a;)e+=n.slice(0,i+1),n=n.slice(i+1),i=n.indexOf(")"),a++;return[e,n]}function T5(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||ml(n)||sg(n))&&(!t||n!==47)}D5.peek=Ole;function Cle(){this.buffer()}function kle(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Ele(){this.buffer()}function Nle(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Rle(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ur(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Tle(e){this.exit(e)}function Dle(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Ur(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Ale(e){this.exit(e)}function Ole(){return"["}function D5(e,t,n,i){const s=n.createTracker(i);let a=s.move("[^");const l=n.enter("footnoteReference"),u=n.enter("reference");return a+=s.move(n.safe(n.associationId(e),{after:"]",before:a})),u(),l(),a+=s.move("]"),a}function jle(){return{enter:{gfmFootnoteCallString:Cle,gfmFootnoteCall:kle,gfmFootnoteDefinitionLabelString:Ele,gfmFootnoteDefinition:Nle},exit:{gfmFootnoteCallString:Rle,gfmFootnoteCall:Tle,gfmFootnoteDefinitionLabelString:Dle,gfmFootnoteDefinition:Ale}}}function zle(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:D5},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(i,s,a,l){const u=a.createTracker(l);let f=u.move("[^");const h=a.enter("footnoteDefinition"),g=a.enter("label");return f+=u.move(a.safe(a.associationId(i),{before:f,after:"]"})),g(),f+=u.move("]:"),i.children&&i.children.length>0&&(u.shift(4),f+=u.move((t?`
140
- `:" ")+a.indentLines(a.containerFlow(i,u.current()),t?A5:Mle))),h(),f}}function Mle(e,t,n){return t===0?e:A5(e,t,n)}function A5(e,t,n){return(n?"":" ")+e}const Ile=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];gS.attention=Ule;gS.peek=Hle;function Ple(){return{canContainEols:["delete"],enter:{strikethrough:Ble},exit:{strikethrough:Fle}}}function Lle(){return{handlers:{delete:gS},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Ile}]}}function Ble(e){this.enter({type:"delete",children:[],position:void 0},e)}function Fle(e){this.exit(e)}function gS(e,t,n,i){const s=n.createTracker(i),a=n.stack.includes("strikethrough")?"~":"~~",l=n.enter("strikethrough");let u=s.move(a);return u+=n.containerPhrasing(e,{...s.current(),before:u,after:"~"}),u+=s.move(a),l(),u}function Ule(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function Hle(){return"~"}function $le(e){return e.length}function qle(e,t){const n=t||{},i=(n.align||[]).concat(),s=n.stringLength||$le,a=[],l=[],u=[],f=[];let h=0,g=-1;for(;++g<e.length;){const S=[],C=[];let k=-1;for(e[g].length>h&&(h=e[g].length);++k<e[g].length;){const R=Wle(e[g][k]);if(n.alignDelimiters!==!1){const N=s(R);C[k]=N,(f[k]===void 0||N>f[k])&&(f[k]=N)}S.push(R)}l[g]=S,u[g]=C}let m=-1;if(typeof i=="object"&&"length"in i)for(;++m<h;)a[m]=gD(i[m]);else{const S=gD(i);for(;++m<h;)a[m]=S}m=-1;const _=[],b=[];for(;++m<h;){const S=a[m];let C="",k="";S===99?(C=":",k=":"):S===108?C=":":S===114&&(k=":");let R=n.alignDelimiters===!1?1:Math.max(1,f[m]-C.length-k.length);const N=C+"-".repeat(R)+k;n.alignDelimiters!==!1&&(R=C.length+R+k.length,R>f[m]&&(f[m]=R),b[m]=R),_[m]=N}l.splice(1,0,_),u.splice(1,0,b),g=-1;const x=[];for(;++g<l.length;){const S=l[g],C=u[g];m=-1;const k=[];for(;++m<h;){const R=S[m]||"";let N="",A="";if(n.alignDelimiters!==!1){const I=f[m]-(C[m]||0),T=a[m];T===114?N=" ".repeat(I):T===99?I%2?(N=" ".repeat(I/2+.5),A=" ".repeat(I/2-.5)):(N=" ".repeat(I/2),A=N):A=" ".repeat(I)}n.delimiterStart!==!1&&!m&&k.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&R==="")&&(n.delimiterStart!==!1||m)&&k.push(" "),n.alignDelimiters!==!1&&k.push(N),k.push(R),n.alignDelimiters!==!1&&k.push(A),n.padding!==!1&&k.push(" "),(n.delimiterEnd!==!1||m!==h-1)&&k.push("|")}x.push(n.delimiterEnd===!1?k.join("").replace(/ +$/,""):k.join(""))}return x.join(`
141
- `)}function Wle(e){return e==null?"":String(e)}function gD(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const Kle=lg(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Vle(e,t,n,i){const s=n.enter("blockquote"),a=n.createTracker(i);a.move("> "),a.shift(2);const l=n.indentLines(n.containerFlow(e,a.current()),Gle);return s(),l}function Gle(e,t,n){return">"+(n?"":" ")+e}function Zle(e,t){return vD(e,t.inConstruct,!0)&&!vD(e,t.notInConstruct,!1)}function vD(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let i=-1;for(;++i<t.length;)if(e.includes(t[i]))return!0;return!1}function yD(e,t,n,i){let s=-1;for(;++s<n.unsafe.length;){const a=n.unsafe[s];if(a.character===`
142
- `&&!a.before&&!a.after&&Zle(n.stack,a))return/[\t ]/.test(i.before)?"":" "}return`\\
143
- `}function Yle(e,t){const n=String(e);let i=n.indexOf(t),s=i,a=0,l=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;i!==-1;)i===s?++a>l&&(l=a):a=1,s=i+t.length,i=n.indexOf(t,s);return l}function Xle(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^\n\r ]/.test(e.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(e.value))}function Qle(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Jle(e,t,n,i){const s=Qle(n),a=e.value||"";if(Xle(e,n)){const m=n.enter("codeIndented"),_=n.indentLines(a,ece);return m(),_}const l=n.createTracker(i),u=s.repeat(Math.max(Yle(a,s)+1,3)),f=n.enter("codeFenced"),h=s==="`"?"GraveAccent":"Tilde";let g=l.move(u);if(e.lang){const m=n.enter(`codeFencedLang${h}`);g+=l.move(n.safe(e.lang,{before:g,after:" ",encode:["`"],...l.current()})),m()}if(e.lang&&e.meta){const m=n.enter(`codeFencedMeta${h}`);g+=l.move(" "),g+=l.move(n.safe(e.meta,{before:g,after:`
144
- `,encode:["`"],...l.current()})),m()}return g+=l.move(`
145
- `),a&&(g+=l.move(a+`
146
- `)),g+=l.move(u),f(),g}function ece(e,t,n){return(n?"":" ")+e}function vS(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function tce(e,t,n,i){const s=vS(n),a=s==='"'?"Quote":"Apostrophe",l=n.enter("definition");let u=n.enter("label");const f=n.createTracker(i);let h=f.move("[");return h+=f.move(n.safe(n.associationId(e),{before:h,after:"]",...f.current()})),h+=f.move("]: "),u(),!e.url||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(u=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":`
147
- `,...f.current()}))),u(),e.title&&(u=n.enter(`title${a}`),h+=f.move(" "+s),h+=f.move(n.safe(e.title,{before:h,after:s,...f.current()})),h+=f.move(s),u()),l(),h}function nce(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function ym(e){const t=e.codePointAt(0);return t===void 0?"":String.fromCodePoint(t)}function Ac(e){const t=e.codePointAt(e.length-2);return t!==void 0&&t>65535?e.slice(-2):e.slice(-1)}function O5(e){return"&#x"+e.toString(16).toUpperCase()+";"}function _D(e,t,n){const i=ua(e),s=ua(t);return i===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function ice(e){if(e.charCodeAt(0)!==60)return;const t=e.charCodeAt(1);if(t===33){const u=e.charCodeAt(2);return u===45?2:u===91?5:ii(u)?4:void 0}if(t===63)return 3;const n=t===47,i=n?2:1;let s=i,a=e.charCodeAt(s);if(!ii(a))return;for(;a===45||ri(a);)a=e.charCodeAt(++s);const l=e.slice(i,s).toLowerCase();return!n&&a!==47&&Xx.includes(l)?1:g5.includes(l)?6:7}const rce=new Map([["*",!1],["_",!0]]);function sce(e,t,n){const i=new Set;for(const a of e){const l=n.get(a);if(l&&a.attention&&t.some(u=>u.attention===a.attention))for(const u of l.tokens)i.add(u.attention)}const s=[];for(const a of e)a.attention&&i.delete(a.attention)&&s.push(a.attention);return s.reverse(),s}function j5(e,t,n){const i=[],s=new Map,a=new Map;let l=0;for(;l<e.length;){if(!e[l].attention){l++;continue}const u=e[l].value.charAt(0),f=rce.get(u);let h=l+1;for(;h<e.length&&e[h].attention&&e[h].value.charAt(0)===u;)h++;const g=l?e[l-1].value:t,m=ua(g.charCodeAt(g.length-1)),_=ua((h<e.length?e[h].value:n).charCodeAt(0)),b=!_||_===2&&!!m,x=!m||m===2&&!!_,S={tokens:e.slice(l,h),markers:[],start:0,end:0,open:f?b&&(!!m||!x):b,close:f?x&&(!!_||!b):x,split:f!==void 0};for(const C of S.tokens){s.set(C,[...S.tokens]),a.set(C,S);let k=C.value.length;for(;k--;)S.markers.push(C)}S.end=S.markers.length,i.push(S),l=h}for(ace(i,s),l=-1;++l<e.length;){const u=s.get(e[l]);if(u)return{attention:sce(e,u,a),index:l}}}function _p(e,t){const n=e[t?0:e.length-1];if(!n||n.attention)return;const i=t?ym(n.value):Ac(n.value),s=O5(i.codePointAt(0));if(t)n.value=s+n.value.slice(i.length);else{let a=n.value.slice(0,n.value.length-i.length),l=0;for(;a.charCodeAt(a.length-1-l)===92;)l++;l%2&&(a+="\\"),n.value=a+s}}function oce(e,t,n,i,s){for(const a of n.attention){const l=t.get(a)||a.sequences[0];for(const u of a.sequences){if(u===l)continue;const f=new Map(t);f.set(a,u);const h=_S(e,f,i,s),g=j5(h,i,s);if(!g||g.index>n.index)return{chosen:f,mistake:g,tokens:h}}}}function ace(e,t){const n=new Map;for(const i of e){const s=i.tokens[0].value.charAt(0);let a=n.get(s);a||(a=[],n.set(s,a));let l=i.close?a.length:0;for(;l--&&i.start<i.end;){const u=a[l],f=u.end-u.start,h=i.end-i.start;if(i.split?(u.close||i.open)&&h%3&&!((f+h)%3):f!==u.markers.length||f!==h)continue;const g=i.split?f>1&&h>1?2:1:h,m=u.markers.slice(u.end-g,u.end),_=i.markers.slice(i.start,i.start+g),b=m[0],x=_[0];if(b===m[g-1]&&b.value.length===g&&x===_[g-1]&&x.value.length===g&&b.attention===x.attention)t.delete(b),t.delete(x);else{const S=[...new Set([...m,..._])];for(const C of S){const k=t.get(C);k&&k.push(...S)}}u.end-=g,i.start+=g,u.start===u.end&&a.splice(l,1),l=a.length}i.open&&i.start<i.end&&a.push(i)}}function lce(e,t,n){if(t.length===0)throw new Error("Cannot serialize `"+e+"` as attention without markers, expected one or more markers");if(n.length===0)throw new Error("Cannot serialize `"+e+"` as attention without sizes, expected one or more sizes");for(const s of n)if(!Number.isSafeInteger(s)||s<1)throw new Error("Cannot serialize `"+e+"` as attention with `"+s+"` as size, expected positive integer");const i=[];for(const s of t){if(s.length!==1)throw new Error("Cannot serialize `"+e+"` as attention with `"+s+"` as marker, expected a single ascii character");if(!a5(s.charCodeAt(0)))throw new Error("Cannot serialize `"+e+"` as attention with `"+s+"` as marker, expected ascii punctuation");for(const a of n)i.push(s.repeat(a))}return i}function cce(e,t,n){const i=t.indexStack,s=e.children||[],a=[];let l=-1,u=n.before;i.push(-1);let f=t.createTracker(n);for(;++l<s.length;){const h=s[l];let g;if(i[i.length-1]=l,l+1<s.length){let b=t.handle.handlers[s[l+1].type];b&&b.peek&&(b=b.peek),g=b?ym(b(s[l+1],e,t,{before:"",after:"",...f.current()})):""}else g=n.after;const m=a[a.length-1];typeof m=="string"&&(u==="\r"||u===`
148
- `)&&h.type==="html"&&ice(h.value)!==7&&(a[a.length-1]=m.replace(/(\r?\n|\r)$/," "),u=" ",f=t.createTracker(n),f.move(ug(a,n.before,n.after)));const _=t.handle.handlers[h.type];if(_&&_.attention){const b=yS(h,_.attention,t,f);a.push(b),u=Ac(b.sequences[0])}else{const b=t.handle(h,e,t,{...f.current(),after:g,before:u});if(!b)continue;f.move(b),a.push(b),u=Ac(b)}}return i.pop(),a}function yS(e,t,n,i){const{construct:s,markers:a,sizes:l}=t(e,n),u=lce(e.type,a,l),f=u[0],h=n.enter(s);i.move(f);const g=cce(e,n,{...i.current(),before:f,after:f});return i.move(ug(g,f,f)),i.move(f),h(),{children:g,sequences:u}}function _S(e,t,n,i){const s=[];let a,l=Ac(n),u=-1;for(;++u<e.length;){const f=e[u];if(typeof f=="string"){const N={value:f,attention:void 0};a&&a===ym(f)&&_p([N],!0),a=void 0,s.push(N),N.value&&(l=Ac(N.value));continue}const h=t.get(f)||f.sequences[0],g=h.charAt(0),m=e[u+1],_=l,b=ym(m===void 0?i:typeof m=="string"?m:t.get(m)||m.sequences[0]),x=_S(f.children,t,h,h),S=x.length>0?x[0].value:"",C=_D(_.charCodeAt(_.length-1),S.charCodeAt(0),g);C.inside&&_p(x,!0);const k=x.length>0?Ac(x[x.length-1].value):"",R=_D(b.charCodeAt(0),k.charCodeAt(k.length-1),g);R.inside&&_p(x,!1),C.outside&&_!==`
149
- `&&_!=="\r"&&_p(s,!1),R.outside&&(a=b),s.push({value:h,attention:f},...x,{value:h,attention:f}),l=h.charAt(h.length-1)}return s}function ug(e,t,n){let i=new Map;const s=_S(e,i,t,n);let a=s,l=j5(a,t,n);for(;l;){const f=oce(e,i,l,t,n);if(!f){a=s;break}i=f.chosen,a=f.tokens,l=f.mistake}let u="";for(const f of a)u+=f.value;return u}bS.attention=z5;bS.peek=uce;function bS(e,t,n,i){const s=n.enter("phrasing"),a=yS(e,z5,n,n.createTracker(i)),l=ug([a],i.before,i.after);return s(),l}function z5(e,t){return{construct:"emphasis",markers:nce(t)==="*"?["*","_"]:["_","*"],sizes:[1]}}function uce(e,t,n){return n.options.emphasis||"*"}function dce(e,t){let n=!1;return pS(e,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return n=!0,Up}),!!((!e.depth||e.depth<3)&&aS(e)&&(t.options.setext||n))}function hce(e,t,n,i){const s=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(i);if(dce(e,n)){const m=n.enter("headingSetext"),_=n.enter("phrasing"),b=n.containerPhrasing(e,{...a.current(),before:`
150
- `,after:`
151
- `});return _(),m(),b+`
152
- `+(s===1?"=":"-").repeat(b.length-(Math.max(b.lastIndexOf("\r"),b.lastIndexOf(`
153
- `))+1))}const l="#".repeat(s),u=n.enter("headingAtx"),f=n.enter("phrasing");a.move(l+" ");let h=n.containerPhrasing(e,{before:"# ",after:`
154
- `,...a.current()});const g=h.charCodeAt(0);return(g===9||g===32)&&(h=O5(g)+h.slice(1)),h=h?l+" "+h:l,n.options.closeAtx&&(h+=" "+l),f(),u(),h}M5.peek=fce;function M5(e){return e.value||""}function fce(){return"<"}I5.peek=pce;function I5(e,t,n,i){const s=vS(n),a=s==='"'?"Quote":"Apostrophe",l=n.enter("image");let u=n.enter("label");const f=n.createTracker(i);let h=f.move("![");return h+=f.move(n.safe(e.alt,{before:h,after:"]",...f.current()})),h+=f.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),h+=f.move("<"),h+=f.move(n.safe(e.url,{before:h,after:">",...f.current()})),h+=f.move(">")):(u=n.enter("destinationRaw"),h+=f.move(n.safe(e.url,{before:h,after:e.title?" ":")",...f.current()}))),u(),e.title&&(u=n.enter(`title${a}`),h+=f.move(" "+s),h+=f.move(n.safe(e.title,{before:h,after:s,...f.current()})),h+=f.move(s),u()),h+=f.move(")"),l(),h}function pce(){return"!"}P5.peek=mce;function P5(e,t,n,i){const s=e.referenceType,a=n.enter("imageReference");let l=n.enter("label");const u=n.createTracker(i);let f=u.move("![");const h=n.safe(e.alt,{before:f,after:"]",...u.current()});f+=u.move(h+"]["),l();const g=n.stack;n.stack=g.filter(function(_){return _!=="phrasing"}),l=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...u.current()});return l(),n.stack=g,a(),s==="full"||!h||h!==m?f+=u.move(m+"]"):s==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function mce(){return"!"}L5.peek=gce;function L5(e,t,n){let i=e.value||"",s="`",a=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(i);)s+="`";for(/[^\n\r ]/.test(i)&&(/^[\n\r ]/.test(i)&&/[\n\r ]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++a<n.unsafe.length;){const l=n.unsafe[a],u=n.compilePattern(l);if(!l.atBreak)continue;let f;for(;f=u.exec(i);){let h=f.index;i.charCodeAt(h)===10&&i.charCodeAt(h-1)===13&&h--,i=i.slice(0,h)+" "+i.slice(f.index+1)}}return s+i+s}function gce(){return"`"}function B5(e,t){const n=aS(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][+\-.a-z]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}F5.peek=vce;function F5(e,t,n,i){const s=vS(n),a=s==='"'?"Quote":"Apostrophe",l=n.createTracker(i);if(B5(e,n)){const x=n.stack;n.stack=x.filter(function(k){return k!=="phrasing"});const S=n.enter("autolink");let C=l.move("<");return C+=l.move(n.containerPhrasing(e,{before:C,after:">",...l.current()})),C+=l.move(">"),S(),n.stack=x,C}const u=n.enter("link");let f=n.enter("label"),h=l.move("[");const g=n.containerPhrasing(e,{before:h,after:"](",...l.current()});h+=l.move(g),f(),h+=l.move("](");const m=/[\0- \u007F]/.test(e.url),_=i.before.charAt(i.before.length-1);let b=e.title||void 0;if(!b&&!m&&(_===`
155
- `||_==="\r")){let x=0;for(;x<g.length&&g.charCodeAt(x)!==93;)x+=g.charCodeAt(x)===92?2:1;g.charCodeAt(x+1)===58&&(b="")}return!e.url&&typeof b=="string"||m?(f=n.enter("destinationLiteral"),h+=l.move("<"),h+=l.move(n.safe(e.url,{before:h,after:">",...l.current()})),h+=l.move(">")):(f=n.enter("destinationRaw"),h+=l.move(n.safe(e.url,{before:h,after:typeof b=="string"?" ":")",...l.current()}))),f(),typeof b=="string"&&(f=n.enter(`title${a}`),h+=l.move(" "+s),h+=l.move(n.safe(b,{before:h,after:s,...l.current()})),h+=l.move(s),f()),h+=l.move(")"),u(),h}function vce(e,t,n){return B5(e,n)?"<":"["}U5.peek=yce;function U5(e,t,n,i){const s=e.referenceType,a=n.enter("linkReference");let l=n.enter("label");const u=n.createTracker(i);let f=u.move("[");const h=n.containerPhrasing(e,{before:f,after:"]",...u.current()});f+=u.move(h+"]["),l();const g=n.stack;n.stack=g.filter(function(_){return _!=="phrasing"}),l=n.enter("reference");const m=n.safe(n.associationId(e),{before:f,after:"]",...u.current()});return l(),n.stack=g,a(),s==="full"||!h||h!==m?f+=u.move(m+"]"):s==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function yce(){return"["}function xS(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function _ce(e){const t=xS(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function bce(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function H5(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function xce(e,t,n,i){const s=n.enter("list"),a=n.bulletCurrent;let l=e.ordered?bce(n):xS(n);const u=e.ordered?l==="."?")":".":_ce(n);let f=t&&n.bulletLastUsed?l===n.bulletLastUsed:!1;if(!e.ordered){const g=e.children?e.children[0]:void 0;if((l==="*"||l==="-")&&g&&(!g.children||!g.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(f=!0),H5(n)===l&&g){let m=-1;for(;++m<e.children.length;){const _=e.children[m];if(_&&_.type==="listItem"&&_.children&&_.children[0]&&_.children[0].type==="thematicBreak"){f=!0;break}}}}f&&(l=u),n.bulletCurrent=l;const h=n.containerFlow(e,i);return n.bulletLastUsed=l,n.bulletCurrent=a,s(),h}function Sce(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function wce(e,t,n,i){const s=Sce(n);let a=n.bulletCurrent||xS(n);t&&t.type==="list"&&t.ordered&&(a=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let l=a.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(l=Math.ceil(l/4)*4);const u=n.createTracker(i);u.move(a+" ".repeat(l-a.length)),u.shift(l);const f=n.enter("listItem"),h=n.indentLines(n.containerFlow(e,u.current()),g);return f(),h;function g(m,_,b){return _?(b?"":" ".repeat(l))+m:(b?a:a+" ".repeat(l-a.length))+m}}function Cce(e,t,n,i){const s=n.enter("paragraph"),a=n.enter("phrasing"),l=n.containerPhrasing(e,i);return a(),s(),l}function kce(e,t,n,i){if(!e.children.some(function(u){return Kle(u)}))return n.containerFlow(e,i);const a=n.enter("phrasing"),l=n.containerPhrasing(e,i);return a(),l}function Ece(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}SS.attention=$5;SS.peek=Nce;function SS(e,t,n,i){const s=n.enter("phrasing"),a=yS(e,$5,n,n.createTracker(i)),l=ug([a],i.before,i.after);return s(),l}function $5(e,t){return{construct:"strong",markers:Ece(t)==="*"?["*","_"]:["_","*"],sizes:[2]}}function Nce(e,t,n){return n.options.strong||"*"}function Rce(e,t,n,i){const s=t?t.children:[],a=n.indexStack[n.indexStack.length-1];return n.safe(e.value,{...i,afterNode:s[a+1],beforeNode:s[a-1]})}function Tce(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function Dce(e,t,n){const i=(H5(n)+(n.options.ruleSpaces?" ":"")).repeat(Tce(n));return n.options.ruleSpaces?i.slice(0,-1):i}const q5={blockquote:Vle,break:yD,code:Jle,definition:tce,emphasis:bS,hardBreak:yD,heading:hce,html:M5,image:I5,imageReference:P5,inlineCode:L5,link:F5,linkReference:U5,list:xce,listItem:wce,paragraph:Cce,root:kce,strong:SS,text:Rce,thematicBreak:Dce};function Ace(){return{enter:{table:Oce,tableData:bD,tableHeader:bD,tableRow:zce},exit:{codeText:Mce,table:jce,tableData:lb,tableHeader:lb,tableRow:lb}}}function Oce(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function jce(e){this.exit(e),this.data.inTable=void 0}function zce(e){this.enter({type:"tableRow",children:[]},e)}function lb(e){this.exit(e)}function bD(e){this.enter({type:"tableCell",children:[]},e)}function Mce(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Ice));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Ice(e,t){return t==="|"?t:e}function Pce(e){const t=e||{},n=t.tableCellPadding,i=t.tablePipeAlign,s=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
156
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:_,table:l,tableCell:f,tableRow:u}};function l(b,x,S,C){return h(g(b,S,C),b.align)}function u(b,x,S,C){const k=m(b,S,C),R=h([k]);return R.slice(0,R.indexOf(`
157
- `))}function f(b,x,S,C){const k=S.enter("tableCell"),R=S.enter("phrasing"),N=S.containerPhrasing(b,{...C,before:a,after:a});return R(),k(),N}function h(b,x){return qle(b,{align:x,alignDelimiters:i,padding:n,stringLength:s})}function g(b,x,S){const C=b.children;let k=-1;const R=[],N=x.enter("table");for(;++k<C.length;)R[k]=m(C[k],x,S);return N(),R}function m(b,x,S){const C=b.children;let k=-1;const R=[],N=x.enter("tableRow");for(;++k<C.length;)R[k]=f(C[k],b,x,S);return N(),R}function _(b,x,S){let C=q5.inlineCode(b,x,S);return S.stack.includes("tableCell")&&(C=C.replace(/\|/g,"\\$&")),C}}function Lce(){return{exit:{taskListCheckValueChecked:xD,taskListCheckValueUnchecked:xD,paragraph:Fce}}}function Bce(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Uce}}}function xD(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function Fce(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const i=n.children[0];if(i&&i.type==="text"){const s=t.children;let a=-1,l;for(;++a<s.length;){const u=s[a];if(u.type==="paragraph"){l=u;break}}l===n&&(i.value=i.value.slice(1),i.value.length===0?n.children.shift():n.position&&i.position&&typeof i.position.start.offset=="number"&&(i.position.start.column++,i.position.start.offset++,n.position.start=Object.assign({},i.position.start)))}}this.exit(e)}function Uce(e,t,n,i){const s=e.children[0],a=typeof e.checked=="boolean"&&s&&s.type==="paragraph",l="["+(e.checked?"x":" ")+"] ",u=n.createTracker(i);a&&u.move(l);let f=q5.listItem(e,t,n,{...i,...u.current()});return a&&(f=f.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,h)),f;function h(g){return g+l}}function Hce(){return[hle(),jle(),Ple(),Ace(),Lce()]}function $ce(e){return{extensions:[fle(),zle(e),Lle(),Pce(e),Bce()]}}const qce={tokenize:Yce,partial:!0},W5={tokenize:Xce,partial:!0},K5={tokenize:Qce,partial:!0},V5={tokenize:Jce,partial:!0},Wce={tokenize:eue,partial:!0},G5={name:"wwwAutolink",tokenize:Gce,previous:Y5},Z5={name:"protocolAutolink",tokenize:Zce,previous:X5},mo={name:"emailAutolink",tokenize:Vce,previous:Q5},As={};function Kce(){return{text:As}}let Ga=48;for(;Ga<123;)As[Ga]=mo,Ga++,Ga===58?Ga=65:Ga===91&&(Ga=97);As[43]=mo;As[45]=mo;As[46]=mo;As[95]=mo;As[72]=[mo,Z5];As[104]=[mo,Z5];As[87]=[mo,G5];As[119]=[mo,G5];function Vce(e,t,n){const i=this;let s,a;return l;function l(m){return!r0(m)||!Q5.call(i,i.previous)||wS(i.events)?n(m):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(m))}function u(m){return r0(m)?(e.consume(m),u):m===64?(e.consume(m),f):n(m)}function f(m){return m===46?e.check(Wce,g,h)(m):m===45||m===95||ri(m)?(a=!0,e.consume(m),f):g(m)}function h(m){return e.consume(m),s=!0,f}function g(m){return a&&s&&ii(i.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(m)):n(m)}}function Gce(e,t,n){const i=this;return s;function s(l){return l!==87&&l!==119||!Y5.call(i,i.previous)||wS(i.events)?n(l):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(qce,e.attempt(W5,e.attempt(K5,a),n),n)(l))}function a(l){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(l)}}function Zce(e,t,n){const i=this;let s="",a=!1;return l;function l(m){return(m===72||m===104)&&X5.call(i,i.previous)&&!wS(i.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(m),e.consume(m),u):n(m)}function u(m){if(ii(m)&&s.length<5)return s+=String.fromCodePoint(m),e.consume(m),u;if(m===58){const _=s.toLowerCase();if(_==="http"||_==="https")return e.consume(m),f}return n(m)}function f(m){return m===47?(e.consume(m),a?h:(a=!0,f)):n(m)}function h(m){return m===null||pm(m)||jt(m)||ml(m)||sg(m)?n(m):e.attempt(W5,e.attempt(K5,g),n)(m)}function g(m){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(m)}}function Yce(e,t,n){let i=0;return s;function s(l){return(l===87||l===119)&&i<3?(i++,e.consume(l),s):l===46&&i===3?(e.consume(l),a):n(l)}function a(l){return l===null?n(l):t(l)}}function Xce(e,t,n){let i,s,a;return l;function l(h){return h===46||h===95?e.check(V5,f,u)(h):h===null||jt(h)||ml(h)||h!==45&&sg(h)?f(h):(a=!0,e.consume(h),l)}function u(h){return h===95?i=!0:(s=i,i=void 0),e.consume(h),l}function f(h){return s||i||!a?n(h):t(h)}}function Qce(e,t){let n=0,i=0;return s;function s(l){return l===40?(n++,e.consume(l),s):l===41&&i<n?a(l):l===33||l===34||l===38||l===39||l===41||l===42||l===44||l===46||l===58||l===59||l===60||l===63||l===93||l===95||l===126?e.check(V5,t,a)(l):l===null||jt(l)||ml(l)?t(l):(e.consume(l),s)}function a(l){return l===41&&i++,e.consume(l),s}}function Jce(e,t,n){return i;function i(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),i):u===38?(e.consume(u),a):u===93?(e.consume(u),s):u===60||u===null||jt(u)||ml(u)?t(u):n(u)}function s(u){return u===null||u===40||u===91||jt(u)||ml(u)?t(u):i(u)}function a(u){return ii(u)?l(u):n(u)}function l(u){return u===59?(e.consume(u),i):ii(u)?(e.consume(u),l):n(u)}}function eue(e,t,n){return i;function i(a){return e.consume(a),s}function s(a){return ri(a)?n(a):t(a)}}function Y5(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||jt(e)}function X5(e){return!ii(e)}function Q5(e){return!(e===47||r0(e))}function r0(e){return e===43||e===45||e===46||e===95||ri(e)}function wS(e){let t=e.length,n=!1;for(;t--;){const i=e[t][1];if((i.type==="labelLink"||i.type==="labelImage")&&!i._balanced){n=!0;break}if(i._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const tue={tokenize:cue,partial:!0};function nue(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:oue,continuation:{tokenize:aue},exit:lue}},text:{91:{name:"gfmFootnoteCall",tokenize:sue},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:iue,resolveTo:rue}}}}function iue(e,t,n){const i=this;let s=i.events.length;const a=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let l;for(;s--;){const f=i.events[s][1];if(f.type==="labelImage"){l=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return u;function u(f){if(!l||!l._balanced)return n(f);const h=Ur(i.sliceSerialize({start:l.end,end:i.now()}));return h.codePointAt(0)!==94||!a.includes(h.slice(1))?n(f):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),t(f))}}function rue(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const a={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},l={type:"chunkString",contentType:"string",start:Object.assign({},a.start),end:Object.assign({},a.end)},u=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",a,t],["enter",l,t],["exit",l,t],["exit",a,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...u),e}function sue(e,t,n){const i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a=0,l;return u;function u(m){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),f}function f(m){return m!==94?n(m):(e.enter("gfmFootnoteCallMarker"),e.consume(m),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",h)}function h(m){if(a>999||m===93&&!l||m===null||m===91||jt(m))return n(m);if(m===93){e.exit("chunkString");const _=e.exit("gfmFootnoteCallString");return s.includes(Ur(i.sliceSerialize(_)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(m),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(m)}return jt(m)||(l=!0),a++,e.consume(m),m===92?g:h}function g(m){return m===91||m===92||m===93?(e.consume(m),a++,h):h(m)}}function oue(e,t,n){const i=this,s=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a,l=0,u;return f;function f(x){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(x){return x===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",g):n(x)}function g(x){if(l>999||x===93&&!u||x===null||x===91||jt(x))return n(x);if(x===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return a=Ur(i.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(x),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),_}return jt(x)||(u=!0),l++,e.consume(x),x===92?m:g}function m(x){return x===91||x===92||x===93?(e.consume(x),l++,g):g(x)}function _(x){return x===58?(e.enter("definitionMarker"),e.consume(x),e.exit("definitionMarker"),s.includes(a)||s.push(a),mt(e,b,"gfmFootnoteDefinitionWhitespace")):n(x)}function b(x){return t(x)}}function aue(e,t,n){return e.check(oh,t,e.attempt(tue,t,n))}function lue(e){e.exit("gfmFootnoteDefinition")}function cue(e,t,n){const i=this;return mt(e,s,"gfmFootnoteDefinitionIndent",5);function s(a){const l=i.events[i.events.length-1];return l&&l[1].type==="gfmFootnoteDefinitionIndent"&&l[2].sliceSerialize(l[1],!0).length===4?t(a):n(a)}}function uue(e){let n=(e||{}).singleTilde;const i={name:"strikethrough",tokenize:a,resolveAll:s};return n==null&&(n=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function s(l,u){let f=-1;for(;++f<l.length;)if(l[f][0]==="enter"&&l[f][1].type==="strikethroughSequenceTemporary"&&l[f][1]._close){let h=f;for(;h--;)if(l[h][0]==="exit"&&l[h][1].type==="strikethroughSequenceTemporary"&&l[h][1]._open&&l[f][1].end.offset-l[f][1].start.offset===l[h][1].end.offset-l[h][1].start.offset){l[f][1].type="strikethroughSequence",l[h][1].type="strikethroughSequence";const g={type:"strikethrough",start:Object.assign({},l[h][1].start),end:Object.assign({},l[f][1].end)},m={type:"strikethroughText",start:Object.assign({},l[h][1].end),end:Object.assign({},l[f][1].start)},_=[["enter",g,u],["enter",l[h][1],u],["exit",l[h][1],u],["enter",m,u]],b=u.parser.constructs.insideSpan.null;b&&Fr(_,_.length,0,og(b,l.slice(h+1,f),u)),Fr(_,_.length,0,[["exit",m,u],["enter",l[f][1],u],["exit",l[f][1],u],["exit",g,u]]),Fr(l,h-1,f-h+3,_),f=h+_.length-2;break}}for(f=-1;++f<l.length;)l[f][1].type==="strikethroughSequenceTemporary"&&(l[f][1].type="data");return l}function a(l,u,f){const h=this.previous,g=this.events;let m=0;return _;function _(x){return h===126&&g[g.length-1][1].type!=="characterEscape"?f(x):(l.enter("strikethroughSequenceTemporary"),b(x))}function b(x){const S=ua(h);if(x===126)return m>1?f(x):(l.consume(x),m++,b);if(m<2&&!n)return f(x);const C=l.exit("strikethroughSequenceTemporary"),k=ua(x);return C._open=!k||k===2&&!!S,C._close=!S||S===2&&!!k,u(x)}}}class due{constructor(){this.map=[],this.index=new Map}add(t,n,i){hue(this,t,n,i)}consume(t){if(this.map.sort(function(a,l){return a[0]-l[0]}),this.map.length===0)return;let n=this.map.length;const i=[];for(;n>0;)n-=1,i.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];i.push(t.slice()),t.length=0;let s=i.pop();for(;s;){for(const a of s)t.push(a);s=i.pop()}this.map.length=0,this.index.clear()}}function hue(e,t,n,i){if(n===0&&i.length===0)return;const s=e.index.get(t);if(s){s[1]+=n,s[2].push(...i);return}const a=[t,n,i];e.map.push(a),e.index.set(t,a)}function fue(e,t){let n=!1;const i=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&i.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const a=i.length-1;i[a]=i[a]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return i}function pue(){return{flow:{null:{name:"table",tokenize:mue,resolveAll:gue}}}}function mue(e,t,n){const i=this;let s=0,a=0,l;return u;function u(U){let F=i.events.length-1;for(;F>-1;){const{type:te}=i.events[F][1];if(te==="lineEnding"||te==="linePrefix")F--;else break}const B=F>-1?i.events[F][1].type:null,W=B==="tableHead"||B==="tableRow"?T:f;return W===T&&i.parser.lazy[i.now().line]?n(U):W(U)}function f(U){return e.enter("tableHead"),e.enter("tableRow"),h(U)}function h(U){return U===124||(l=!0,a+=1),g(U)}function g(U){return U===null?n(U):Fe(U)?a>1?(a=0,i.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(U),e.exit("lineEnding"),b):n(U):st(U)?mt(e,g,"whitespace")(U):(a+=1,l&&(l=!1,s+=1),U===124?(e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),l=!0,g):(e.enter("data"),m(U)))}function m(U){return U===null||U===124||jt(U)?(e.exit("data"),g(U)):(e.consume(U),U===92?_:m)}function _(U){return U===92||U===124?(e.consume(U),m):m(U)}function b(U){return i.interrupt=!1,i.parser.lazy[i.now().line]?n(U):(e.enter("tableDelimiterRow"),l=!1,st(U)?mt(e,x,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(U):x(U))}function x(U){return U===45||U===58?C(U):U===124?(l=!0,e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),S):I(U)}function S(U){return st(U)?mt(e,C,"whitespace")(U):C(U)}function C(U){return U===58?(a+=1,l=!0,e.enter("tableDelimiterMarker"),e.consume(U),e.exit("tableDelimiterMarker"),k):U===45?(a+=1,k(U)):U===null||Fe(U)?A(U):I(U)}function k(U){return U===45?(e.enter("tableDelimiterFiller"),R(U)):I(U)}function R(U){return U===45?(e.consume(U),R):U===58?(l=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(U),e.exit("tableDelimiterMarker"),N):(e.exit("tableDelimiterFiller"),N(U))}function N(U){return st(U)?mt(e,A,"whitespace")(U):A(U)}function A(U){return U===124?x(U):U===null||Fe(U)?!l||s!==a?I(U):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(U)):I(U)}function I(U){return n(U)}function T(U){return e.enter("tableRow"),D(U)}function D(U){return U===124?(e.enter("tableCellDivider"),e.consume(U),e.exit("tableCellDivider"),D):U===null||Fe(U)?(e.exit("tableRow"),t(U)):st(U)?mt(e,D,"whitespace")(U):(e.enter("data"),L(U))}function L(U){return U===null||U===124||jt(U)?(e.exit("data"),D(U)):(e.consume(U),U===92?ee:L)}function ee(U){return U===92||U===124?(e.consume(U),L):L(U)}}function gue(e,t){let n=-1,i=!0,s=0,a=[0,0,0,0],l=[0,0,0,0],u=!1,f=0,h,g,m;const _=new due;for(;++n<e.length;){const b=e[n],x=b[1];b[0]==="enter"?x.type==="tableHead"?(u=!1,f!==0&&(SD(_,t,f,h,g),g=void 0,f=0),h={type:"table",start:Object.assign({},x.start),end:Object.assign({},x.end)},_.add(n,0,[["enter",h,t]])):x.type==="tableRow"||x.type==="tableDelimiterRow"?(i=!0,m=void 0,a=[0,0,0,0],l=[0,n+1,0,0],u&&(u=!1,g={type:"tableBody",start:Object.assign({},x.start),end:Object.assign({},x.end)},_.add(n,0,[["enter",g,t]])),s=x.type==="tableDelimiterRow"?2:g?3:1):s&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")?(i=!1,l[2]===0&&(a[1]!==0&&(l[0]=l[1],m=bp(_,t,a,s,void 0,m),a=[0,0,0,0]),l[2]=n)):x.type==="tableCellDivider"&&(i?i=!1:(a[1]!==0&&(l[0]=l[1],m=bp(_,t,a,s,void 0,m)),a=l,l=[a[1],n,0,0])):x.type==="tableHead"?(u=!0,f=n):x.type==="tableRow"||x.type==="tableDelimiterRow"?(f=n,a[1]!==0?(l[0]=l[1],m=bp(_,t,a,s,n,m)):l[1]!==0&&(m=bp(_,t,l,s,n,m)),s=0):s&&(x.type==="data"||x.type==="tableDelimiterMarker"||x.type==="tableDelimiterFiller")&&(l[3]=n)}for(f!==0&&SD(_,t,f,h,g),_.consume(t.events),n=-1;++n<t.events.length;){const b=t.events[n];b[0]==="enter"&&b[1].type==="table"&&(b[1]._align=fue(t.events,n))}return e}function bp(e,t,n,i,s,a){const l=i===1?"tableHeader":i===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(a.end=Object.assign({},Sc(t.events,n[0])),e.add(n[0],0,[["exit",a,t]]));const f=Sc(t.events,n[1]);if(a={type:l,start:Object.assign({},f),end:Object.assign({},f)},e.add(n[1],0,[["enter",a,t]]),n[2]!==0){const h=Sc(t.events,n[2]),g=Sc(t.events,n[3]),m={type:u,start:Object.assign({},h),end:Object.assign({},g)};if(e.add(n[2],0,[["enter",m,t]]),i!==2){const _=t.events[n[2]],b=t.events[n[3]];if(_[1].end=Object.assign({},b[1].end),_[1].type="chunkText",_[1].contentType="text",n[3]>n[2]+1){const x=n[2]+1,S=n[3]-n[2]-1;e.add(x,S,[])}}e.add(n[3]+1,0,[["exit",m,t]])}return s!==void 0&&(a.end=Object.assign({},Sc(t.events,s)),e.add(s,0,[["exit",a,t]]),a=void 0),a}function SD(e,t,n,i,s){const a=[],l=Sc(t.events,n);s&&(s.end=Object.assign({},l),a.push(["exit",s,t])),i.end=Object.assign({},l),a.push(["exit",i,t]),e.add(n+1,0,a)}function Sc(e,t){const n=e[t],i=n[0]==="enter"?"start":"end";return n[1][i]}const vue={name:"tasklistCheck",tokenize:_ue};function yue(){return{text:{91:vue}}}function _ue(e,t,n){const i=this;return s;function s(f){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?n(f):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),a)}function a(f){return jt(f)?(e.enter("taskListCheckValueUnchecked"),e.consume(f),e.exit("taskListCheckValueUnchecked"),l):f===88||f===120?(e.enter("taskListCheckValueChecked"),e.consume(f),e.exit("taskListCheckValueChecked"),l):n(f)}function l(f){return f===93?(e.enter("taskListCheckMarker"),e.consume(f),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(f)}function u(f){return Fe(f)?t(f):st(f)?e.check({tokenize:bue},t,n)(f):n(f)}}function bue(e,t,n){return mt(e,i,"whitespace");function i(s){return s===null?n(s):t(s)}}function xue(e){return s5([Kce(),nue(),uue(e),pue(),yue()])}const Sue={};function wue(e){const t=this,n=e||Sue,i=t.data(),s=i.micromarkExtensions||(i.micromarkExtensions=[]),a=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),l=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);s.push(xue(n)),a.push(Hce()),l.push($ce(n))}const Cue={h1:({children:e})=>p.jsx("h1",{className:"mb-2 mt-1 text-[15px] font-medium leading-6 text-ink",children:e}),h2:({children:e})=>p.jsx("h2",{className:"mb-1.5 mt-3 text-[14px] font-medium leading-5 text-ink",children:e}),h3:({children:e})=>p.jsx("h3",{className:"mb-1 mt-2.5 text-[13px] font-medium leading-5 text-ink",children:e}),p:({children:e})=>p.jsx("p",{className:"my-1.5 leading-[1.65] first:mt-0 last:mb-0",children:e}),strong:({children:e})=>p.jsx("strong",{className:"font-medium text-ink",children:e}),em:({children:e})=>p.jsx("em",{className:"italic",children:e}),a:({children:e,href:t})=>p.jsx("a",{href:t,target:"_blank",rel:"noreferrer",className:"text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent",children:e}),ul:({children:e})=>p.jsx("ul",{className:"my-1.5 list-disc space-y-0.5 pl-5 marker:text-ink-3",children:e}),ol:({children:e})=>p.jsx("ol",{className:"my-1.5 list-decimal space-y-0.5 pl-5 marker:text-ink-3",children:e}),li:({children:e})=>p.jsx("li",{className:"leading-[1.65]",children:e}),blockquote:({children:e})=>p.jsx("blockquote",{className:"my-2 border-l-2 border-accent/30 pl-3 text-ink-2",children:e}),hr:()=>p.jsx("hr",{className:"my-3 border-line"}),pre:({children:e})=>p.jsx("pre",{className:"my-2 overflow-x-auto rounded-lg bg-surface-2 px-3 py-2.5 font-mono text-[12px] leading-5 text-ink",children:e}),code:({children:e,className:t})=>p.jsx("code",{className:t?`font-mono ${t}`:"rounded bg-black/[.06] px-1 py-[1px] font-mono text-[.92em] text-ink dark:bg-white/[.1]",children:e}),table:({children:e})=>p.jsx("div",{className:"my-2 overflow-x-auto rounded-lg border border-line",children:p.jsx("table",{className:"w-full border-collapse text-left text-[11.5px]",children:e})}),thead:({children:e})=>p.jsx("thead",{className:"bg-surface-2 text-ink-2",children:e}),th:({children:e})=>p.jsx("th",{className:"border-b border-line px-2.5 py-1.5 font-medium",children:e}),td:({children:e})=>p.jsx("td",{className:"border-b border-line/70 px-2.5 py-1.5 align-top last:border-b-0",children:e}),tr:({children:e})=>p.jsx("tr",{className:"last:[&>td]:border-b-0",children:e})};function kue({text:e}){return p.jsx("div",{className:"markdown-body [&_pre_code]:bg-transparent [&_pre_code]:p-0",children:p.jsx(nle,{remarkPlugins:[wue],components:Cue,children:e})})}function gd({item:e,turnActive:t=!1,onRetry:n}){switch(e.kind){case"message":return p.jsx(J5,{item:e});case"plan":return p.jsx(Nue,{item:e,turnActive:t});case"tool":return p.jsx(Rue,{item:e});case"reasoning":return null;case"approval":return null;case"artifact":return p.jsx(Tue,{item:e});case"error":return p.jsxs("div",{role:"status",className:qe("border-l-2 pl-3 text-[12px] leading-5",/已停止/.test(e.message)?"border-line text-ink-3":"border-danger/50 text-ink-2"),children:[e.message,n?p.jsx("button",{type:"button",onClick:n,className:"ml-2 text-[11px] text-accent hover:underline",children:"重试"}):null]})}}function J5({item:e,children:t}){const[n,i]=w.useState(!1),[s,a]=w.useState(!1);return e.role==="user"?p.jsx("div",{className:"mb-5 flex justify-end",children:p.jsxs("div",{className:"max-w-[91%] rounded-[18px] bg-accent-soft px-3.5 py-2.5 text-[13px] leading-[1.65] text-ink sm:max-w-[82%]",children:[p.jsx("div",{className:qe("whitespace-pre-wrap break-words [overflow-wrap:anywhere]",!n&&e.text.length>1200&&"line-clamp-8"),children:e.text}),e.text.length>1200?p.jsx("button",{type:"button",className:"mt-1 text-[11px] text-ink-3",onClick:()=>i(l=>!l),children:n?"收起":"展开消息"}):null]})}):p.jsxs("article",{className:"min-w-0 break-words text-[13px] leading-[1.65] text-ink [overflow-wrap:anywhere]",children:[p.jsx("div",{className:"w-fit min-w-0 max-w-full rounded-2xl rounded-tl-md border border-line bg-surface px-3.5 py-2.5 shadow-[var(--shadow-card)]",children:p.jsx(kue,{text:e.text})}),t,!e.streaming&&e.text?p.jsxs("div",{className:"mt-1 flex items-center gap-2 px-0.5",children:[p.jsx("button",{type:"button","aria-label":s?"已复制答复":"复制答复",className:"rounded p-1 text-ink-3 hover:bg-surface-2",onClick:()=>{navigator.clipboard.writeText(e.text).then(()=>a(!0)).catch(()=>a(!1))},children:s?p.jsx(Ic,{size:13}):p.jsx(_$,{size:13})}),p.jsx("time",{dateTime:new Date(e.createdAt).toISOString(),title:new Date(e.createdAt).toLocaleString(),className:"font-mono text-[11px] text-ink-3",children:new Date(e.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hourCycle:"h23"})})]}):null]})}const Eue={done:"已完成:",running:"进行中:",failed:"失败:",pending:"待做:",unfinished:"未完成"};function Nue({item:e,turnActive:t}){const[n,i]=w.useState(!1),s=e.steps.filter(l=>l.status==="done").length,a=t?e.steps.find(l=>l.status==="running"):void 0;return p.jsxs("div",{className:"text-[12px] text-ink-3",children:[p.jsxs("button",{type:"button","aria-expanded":n,onClick:()=>i(l=>!l),className:"flex w-full items-start gap-1.5 rounded-md py-1 text-left transition-colors hover:text-accent",children:[p.jsx(Hr,{size:13,className:qe("mt-0.5 shrink-0",n&&"rotate-90")}),p.jsxs("span",{className:a?"text-accent":void 0,children:["计划 · ",s,"/",e.steps.length,a?` · ${a.title}`:` · ${e.title}`]})]}),n?p.jsx("ol",{"aria-label":e.title,className:"ml-5 mt-1 space-y-1.5",children:e.steps.map(l=>{const u=l.status==="running"&&!t?"unfinished":l.status;return p.jsxs("li",{className:"flex items-start gap-2",children:[u==="done"?p.jsx(Ic,{size:13,className:"mt-0.5 shrink-0 text-success"}):u==="running"?p.jsx(Ss,{size:13,className:"mt-0.5 shrink-0 animate-spin text-accent motion-reduce:animate-none"}):u==="failed"||u==="unfinished"?p.jsx(pa,{size:13,className:"mt-0.5 shrink-0 text-danger"}):p.jsx(g$,{size:13,className:"mt-0.5 shrink-0"}),p.jsxs("span",{className:"min-w-0 break-words",children:[l.title,p.jsx("span",{className:u==="unfinished"?"ml-2":"sr-only",children:Eue[u]}),l.detail?p.jsx("span",{className:"ml-2",children:l.detail}):null]})]},l.id)})}):null]})}function Rue({item:e}){const[t,n]=w.useState(!1);return p.jsxs("div",{className:"min-w-0 text-[12px] text-ink-3",children:[p.jsxs("button",{type:"button","aria-expanded":t,onClick:()=>n(i=>!i),className:"flex w-full items-start gap-1.5 rounded-md py-1 text-left transition-colors hover:text-accent",children:[p.jsx(Hr,{size:13,className:qe("mt-0.5 shrink-0",t&&"rotate-90")}),p.jsx("span",{className:"min-w-0 break-words",children:e.summary||e.name}),e.status==="error"?p.jsx(pa,{size:13,className:"mt-0.5 shrink-0 text-danger"}):null]}),t?p.jsxs("div",{className:"ml-5 space-y-2",children:[p.jsxs("div",{className:"text-[11px]",children:[e.name,e.durationMs!==void 0?` · ${Math.round(e.durationMs/1e3)}秒`:""]}),e.args?p.jsx("pre",{className:"max-h-[200px] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-2 p-2.5 font-mono text-[12px] text-ink-2",children:e.args}):null,e.output?p.jsx("pre",{className:"max-h-[200px] overflow-auto whitespace-pre-wrap break-words rounded-lg bg-surface-2 p-2.5 font-mono text-[12px] text-ink-2",children:e.output}):null]}):null]})}function Tue({item:e}){const t=et(s=>s.open),{projectId:n,sessionId:i}=at();return e.resourceTarget?.kind==="file"?p.jsx(HI,{target:e.resourceTarget}):e.resourceTarget?.kind==="preview"?p.jsx($I,{target:e.resourceTarget}):e.resourceTarget?.kind==="terminal"?p.jsx(qI,{target:e.resourceTarget}):p.jsxs("div",{className:"break-words text-[12px] text-ink-2",children:[p.jsx("span",{children:e.title}),p.jsx("p",{className:"mt-1 text-ink-3",children:e.description}),e.href?p.jsxs("button",{type:"button",className:"mt-1 text-accent underline decoration-accent/30 underline-offset-4 hover:decoration-accent",onClick:()=>t({kind:"browser",resourceId:e.href??e.id,title:e.title,projectId:n,sessionId:i,source:"artifact"}),children:["打开 ",e.title]}):null]})}const Due=[{label:"了解这个项目",text:"先帮我了解项目结构、主要功能和启动方式。",icon:w$,color:"bg-accent-soft text-accent"},{label:"一起排查问题",text:"帮我排查一个问题:",icon:p$,color:"bg-warning/10 text-warning"},{label:"实现一个想法",text:"我想在这个项目中实现一个功能:",icon:y$,color:"bg-success/10 text-success"},{label:"打磨现有体验",text:"看看这个项目有哪些值得改进的体验,先给我简短建议。",icon:U$,color:"bg-violet-500/10 text-violet-500"}];function Aue(){return p.jsxs("section",{"aria-label":"开始新的任务",className:"mx-auto flex min-h-[340px] max-w-[560px] flex-col justify-center py-8 sm:py-14",children:[p.jsxs("div",{className:"relative mb-5 flex h-14 w-14 items-center justify-center rounded-2xl border border-accent/15 bg-gradient-to-br from-accent-soft via-surface to-violet-500/10 text-accent shadow-sm",children:[p.jsx(L$,{size:26,strokeWidth:1.6}),p.jsx("span",{"aria-hidden":"true",className:"absolute -right-1 -top-1 h-3 w-3 rounded-full border-2 border-canvas bg-warning"})]}),p.jsx("h2",{className:"text-[25px] font-semibold tracking-tight text-ink sm:text-[28px]",children:"有什么想一起完成?"}),p.jsx("p",{className:"mb-7 mt-2 text-[12px] leading-6 text-ink-3",children:"从一个问题、一个想法,或眼前的项目开始。"}),p.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:Due.map(({label:e,text:t,icon:n,color:i})=>p.jsxs("button",{type:"button",onClick:()=>{er.getState().setDraft(t),at.getState().focusComposer()},className:"group flex min-w-0 items-center gap-3 rounded-xl border border-line bg-surface/80 p-3 text-left shadow-sm transition-colors hover:border-accent/30 hover:bg-surface focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent",children:[p.jsx("span",{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg ${i}`,children:p.jsx(n,{size:16})}),p.jsx("span",{className:"flex-1 text-[12px] font-medium text-ink-2",children:e}),p.jsx(r1,{size:13,className:"text-ink-3 transition-colors group-hover:text-accent"})]},e))})]})}function Oue(e){const t=[],n=new Map;let i;for(const s of e){const a=s.kind==="message"&&s.role==="user",l=s.turnId??(a?s.id:i?.id??s.id),u=n.get(l);if(u)u.items.push(s),a&&(i=u);else{const f={id:l,items:[s]};t.push(f),n.set(l,f),i=f}}return t}function jue({group:e,active:t}){const n=Dt(F=>F.send),i=e.items,s=i.find(F=>F.kind==="message"&&F.role==="user"),a=t&&s?.turnOutcome===void 0,[l,u]=w.useState(!1),f=i.filter(F=>F.kind==="tool"&&F.name!=="update_plan");let h=-1,g=-1;i.forEach((F,B)=>{F.kind==="tool"&&(h=B),F.kind==="message"&&F.role==="assistant"&&(g=B)});const m=g>=0&&(g>h||s?.turnOutcome==="completed")?i[g]:void 0,_=t&&!m?[...i].reverse().find(F=>F.kind==="message"&&F.role==="assistant"):void 0,b=i.filter(F=>F!==s&&F!==m&&F!==_&&(F.kind==="message"&&F.role==="assistant"||F.kind==="plan"||F.kind==="tool"&&F.name!=="update_plan")),x=i.filter(F=>F.kind==="approval"),S=[...f].reverse().find(F=>F.status==="running"),C=x.find(F=>F.kind==="approval"&&F.status==="pending"),k=s?.turnOutcome==="failed"||s?.turnOutcome==="interrupted",R=s?.turnOutcome==="cancelled",N=s?.durationMs,A=N===void 0?"":` · ${Math.round(N/1e3)}秒`,I=[...i].reverse().find(F=>F.kind==="reasoning")?.text,T=t?C?`本轮 ${f.length} 项操作`:S?`正在执行 · ${S.summary||S.name}`:I?`正在思考${f.length>0?` · 已执行 ${f.length} 项操作`:""} · ${I}`:`已执行 ${f.length} 项操作`:`${R?"已停止":k?"执行未完成":"执行了"} ${f.length} 项操作${A}`,D=new Map;for(const F of f){const B=F.resourceTarget;B&&D.set(B.kind==="file"?JSON.stringify([B.scope,B.path]):B.kind==="preview"?`preview:${B.serviceId}:${B.path}`:B.terminalId,B)}const L=new Set([...D.values()].filter(F=>F.kind==="file").map(F=>F.path)),ee=i.filter(F=>F.kind==="artifact"&&!L.has(F.title.replace(/^已修改 /,""))),U=!a&&(D.size>0||ee.length>0)?p.jsxs("div",{className:"mt-2 space-y-2",children:[D.size>0?p.jsx("section",{"aria-label":"本次成果",className:"flex flex-wrap gap-1.5 pt-0.5",children:[...D.entries()].map(([F,B])=>B.kind==="file"?p.jsx(HI,{target:B},F):B.kind==="preview"?p.jsx($I,{target:B},F):p.jsx(qI,{target:B},F))}):null,ee.map(F=>p.jsx(gd,{item:F},F.id))]}):null;return p.jsxs("section",{"aria-label":"对话轮次",className:"min-w-0",children:[s?p.jsx(gd,{item:s}):null,p.jsxs("div",{className:"space-y-3",children:[b.length>0||f.length>0||I!==void 0?p.jsxs("div",{className:"text-[12px] text-ink-3",children:[p.jsxs("button",{type:"button","aria-label":`执行过程 · ${T}`,"aria-expanded":l,onClick:()=>u(F=>!F),className:qe("flex w-full items-start gap-1.5 rounded-md py-1 text-left transition-colors hover:text-accent",t&&!C&&"text-accent"),children:[t&&!C?p.jsx(Ss,{size:13,"data-testid":"turn-running-spinner",className:"mt-0.5 shrink-0 animate-spin text-accent motion-reduce:animate-none"}):p.jsx(Hr,{size:13,className:qe("mt-0.5 shrink-0",l&&"rotate-90")}),p.jsx("span",{className:"min-w-0 truncate",children:T})]}),l?p.jsx("div",{className:"ml-1.5 mt-2 space-y-2 border-l border-accent/15 pl-4",children:b.map(F=>p.jsxs("div",{children:[p.jsx(gd,{item:F,turnActive:a}),F.kind==="tool"&&F.commandId?p.jsx(Uie,{commandId:F.commandId}):null]},F.id))}):null]}):null,_?p.jsx(gd,{item:_}):null,m?.kind==="message"?p.jsx(J5,{item:m,children:U}):U,t&&!C&&!S&&!m&&!_?p.jsxs("div",{role:"status",className:"flex items-center gap-2 text-[12px] text-ink-3",children:[p.jsx(Ss,{size:12,className:"animate-spin text-accent motion-reduce:animate-none"}),"正在处理…"]}):null,i.filter(F=>F.kind==="error").map(F=>p.jsx(gd,{item:F,onRetry:s?()=>{n(s.text)}:void 0},F.id))]})]})}function zue(){const e=Dt(b=>b.items),t=Dt(b=>b.loading),n=Dt(b=>b.isStreaming),i=Dt(b=>b.contextNotice),s=Dt(b=>b.activeTurnId),a=at(b=>b.sessionId),l=w.useRef(null),u=w.useRef(null),f=w.useRef(!0),[h,g]=w.useState(!1),m=w.useCallback(()=>{const b=l.current;b&&(f.current?b.scrollTop=b.scrollHeight:g(b.scrollHeight-b.scrollTop-b.clientHeight>140))},[]);w.useLayoutEffect(()=>{f.current=!0,g(!1)},[a]),w.useLayoutEffect(m,[e,t]),w.useEffect(()=>{const b=l.current,x=u.current;if(!b||!x||typeof ResizeObserver>"u")return;const S=new ResizeObserver(m);return S.observe(b),S.observe(x),()=>S.disconnect()},[m]);const _=Oue(e);return p.jsxs("div",{className:"relative flex min-h-0 flex-1 flex-col",children:[p.jsx("div",{ref:l,role:"log","aria-label":"会话时间线",onClickCapture:b=>{b.target instanceof Element&&b.target.closest("button[aria-expanded]")&&(f.current=!1)},onScroll:b=>{const x=b.currentTarget,S=x.scrollHeight-x.scrollTop-x.clientHeight;f.current=S<70,g(S>140)},className:"min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-7 [scrollbar-gutter:stable]",children:p.jsxs("div",{ref:u,className:"mx-auto w-full max-w-[760px] space-y-8 pb-5",children:[i?p.jsxs("p",{role:"status",className:"text-[11px] text-ink-3",children:["上下文已压缩",i.degraded?"(降级:超出部分已截断)":""]}):null,t?p.jsx("div",{role:"status",className:"py-8 text-[12px] text-ink-3",children:"正在加载对话…"}):e.length?_.map((b,x)=>p.jsx(jue,{group:b,active:n&&(s===b.id||s===null&&x===_.length-1)},`${a}:${b.id}`)):p.jsx(Aue,{})]})}),p.jsx("div",{"aria-hidden":"true",className:"conversation-scroll-edge conversation-scroll-edge-top"}),p.jsx("div",{"aria-hidden":"true",className:"conversation-scroll-edge conversation-scroll-edge-bottom"}),h?p.jsx("button",{type:"button","aria-label":"回到最新消息",onClick:()=>{f.current=!0,m(),g(!1)},className:"absolute bottom-3 left-1/2 z-10 flex h-8 w-8 -translate-x-1/2 items-center justify-center rounded-full border border-line bg-surface text-accent shadow-[var(--shadow-card)] transition-colors hover:bg-accent-soft",children:p.jsx(Sj,{size:14})}):null]})}function Mue(){const{data:e}=qr(),{projectId:t,sessionId:n,resourceCollapsed:i,toggleResource:s}=at();L1(m=>m.extra);const a=zn(),[l,u]=w.useState(!1),f=[...e.sessions].find(m=>m.id===n),h=e.projects.find(m=>m.id===t),g=async()=>{if(!(!f||Bc))try{await _3(f.id),await a.invalidateQueries({queryKey:["workspace"]})}catch(m){window.dispatchEvent(new CustomEvent("larness:workspace-error",{detail:m instanceof Error?m.message:"归档会话失败"}))}};return p.jsxs("main",{className:"conversation-surface flex min-h-0 min-w-0 flex-1 flex-col bg-canvas/55",children:[p.jsxs("header",{className:"flex h-12 shrink-0 items-center gap-3 px-4 sm:px-7",children:[p.jsx("h1",{className:"min-w-0 truncate text-[12px] font-medium",children:f?.title??"新会话"}),p.jsx("span",{className:"ml-auto hidden max-w-[40%] truncate text-[11px] text-ink-3 md:block",children:h?.name??I1(n,e.sessions)}),p.jsxs("div",{className:"ml-auto flex items-center gap-0.5 md:ml-0",children:[p.jsx(bi,{label:i?"展开项目资源":"折叠项目资源",className:"hidden xl:inline-flex",onClick:s,children:p.jsx(D$,{size:14})}),p.jsxs(Oc,{children:[p.jsx(jc,{asChild:!0,children:p.jsx(bi,{label:"会话操作",children:p.jsx($j,{size:15})})}),p.jsxs(cl,{align:"end",className:"w-[190px]",children:[p.jsx(na,{disabled:!f,onSelect:()=>u(!0),children:"重命名会话"}),p.jsx(B0,{}),p.jsx(na,{disabled:!f||Bc,onSelect:()=>{g()},className:"text-danger focus:text-danger",children:"归档会话"})]})]})]})]}),p.jsx(zue,{}),p.jsx(R3,{session:f?{id:f.id,title:f.title}:null,onClose:()=>u(!1),open:l}),p.jsx("div",{"data-testid":"composer-dock",className:"relative shrink-0 px-4 pb-3 pt-1 sm:px-7",children:p.jsxs("div",{className:"relative mx-auto w-full max-w-[760px]",children:[p.jsx(Nie,{}),p.jsx(jie,{}),p.jsx(Aie,{})]})})]})}function Iue(e){const t=Dt(i=>i.load),n=Dt(i=>i.disconnect);w.useEffect(()=>(t(e),()=>n()),[n,t,e])}function Pue(){const{data:e,isPending:t,isError:n}=qr(),i=at(k=>k.sessionId),s=at(k=>k.reconcileWorkspace),a=at(k=>k.sidebarCollapsed),l=at(k=>k.sidebarWidth),u=at(k=>k.resourceWidth),f=at(k=>k.resourceCollapsed),h=at(k=>k.setSidebarWidth),g=at(k=>k.setResourceWidth),m=at(k=>k.mobileSidebarOpen),_=at(k=>k.toggleSidebar),b=at(k=>k.setMobileSidebar),x=O3(),[S,C]=w.useState(null);return Iue(i),w.useEffect(()=>{const k=R=>{const N=R.detail;C(typeof N=="string"?N:"操作失败")};return window.addEventListener("larness:workspace-error",k),()=>window.removeEventListener("larness:workspace-error",k)},[]),w.useEffect(()=>{t||n||s(e.projects.map(k=>k.id),e.sessions)},[e.projects,e.sessions,t,n,s]),w.useEffect(()=>{const k=R=>{if(R.defaultPrevented)return;const N=R.metaKey||R.ctrlKey,A=R.key.toLowerCase();if(N&&A==="k"){R.preventDefault(),x();return}if(N&&A==="b"){R.preventDefault(),_();return}if(R.key==="Escape"&&!N){const I=et.getState(),T=at.getState(),D=qt.getQueryData(["workspace"])?.sessions??[],L=M1(T.projectId,T.sessionId,D),ee=I.windows.filter(U=>!U.minimized&&Tc(U)===L).sort((U,F)=>F.z-U.z)[0];ee&&(R.preventDefault(),I.hide(ee.id))}};return window.addEventListener("keydown",k),()=>window.removeEventListener("keydown",k)},[x,_]),p.jsxs("div",{className:"flex h-screen flex-col overflow-hidden bg-canvas text-ink","data-testid":"workspace-home",children:[p.jsx(jQ,{}),p.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[a?null:p.jsx(fR,{}),a?null:p.jsx(vR,{side:"left",label:"调整项目侧栏宽度",value:l,min:220,max:360,defaultValue:268,onChange:h,className:"hidden md:block"}),p.jsx(Mue,{}),f?null:p.jsxs(p.Fragment,{children:[p.jsx(vR,{side:"right",label:"调整资源侧栏宽度",value:u,min:280,max:460,defaultValue:340,onChange:g,className:"hidden xl:block"}),p.jsx(IX,{})]}),p.jsx(Eie,{})]}),S?p.jsxs("div",{className:"fixed bottom-4 left-1/2 z-[200] flex -translate-x-1/2 items-center gap-3 rounded-lg border border-danger/25 bg-surface px-3 py-2 text-[11.5px] text-danger shadow-[var(--shadow-pop)]",children:[p.jsx("span",{children:S}),p.jsx("button",{type:"button",className:"text-ink-3 hover:text-ink",onClick:()=>C(null),children:"关闭"})]}):null,m?p.jsxs("div",{className:"fixed inset-0 z-[150] md:hidden",children:[p.jsx("button",{type:"button","aria-label":"关闭导航",onClick:()=>b(!1),className:"absolute inset-0 bg-black/30 backdrop-blur-[2px]"}),p.jsx("div",{className:"absolute inset-y-0 left-0 w-[280px] shadow-[var(--shadow-window)]",children:p.jsx(fR,{mobile:!0})})]}):null]})}function Lue(){const e=zn();w.useEffect(()=>{let t=!1,n,i;const s=window.location.protocol==="https:"?"wss":"ws",a={queryKey:["workspace"],exact:!0},l=async()=>{e.getQueryData(a.queryKey)===void 0&&await e.cancelQueries(a),t||await e.invalidateQueries(a)},u=()=>{const f=new WebSocket(`${s}://${window.location.host}/ws`);n=f;let h=!1;f.addEventListener("open",()=>{h=!0,f.send(JSON.stringify({type:"subscribe",subscriptions:[{topic:"system",resourceId:"system"}]}))}),f.addEventListener("message",g=>{if(!(t||typeof g.data!="string"))try{const m=JSON.parse(g.data);iY.safeParse(m).success&&l(),rY.safeParse(m).success&&e.invalidateQueries({queryKey:["jobs"]})}catch{}}),f.addEventListener("close",()=>{t||(h&&(e.invalidateQueries({queryKey:["session"]}),e.invalidateQueries({queryKey:["bootstrap"]})),i=window.setTimeout(u,1e3))}),f.addEventListener("error",()=>f.close())};return u(),()=>{t=!0,window.clearTimeout(i),n?.close()}},[e])}function Bue(){return Lue(),p.jsx(Pue,{})}function eP({label:e="正在加载…"}){return p.jsx("main",{className:"flex min-h-screen items-center justify-center bg-canvas text-ink",children:p.jsxs("div",{className:"flex items-center gap-2 text-sm text-ink-2",children:[p.jsx("span",{className:"inline-flex size-7 items-center justify-center rounded-md bg-accent text-[13px] font-semibold text-accent-ink",children:"L"}),e]})})}function Fue({message:e,onRetry:t}){return p.jsx("main",{className:"flex min-h-screen items-center justify-center bg-canvas px-6 text-ink",children:p.jsxs("section",{className:"w-full max-w-[420px] rounded-[18px] border border-line bg-surface p-7 shadow-card",children:[p.jsx("h1",{className:"text-lg font-semibold",children:"无法连接本机服务"}),p.jsx("p",{className:"mt-2 text-sm text-ink-2",children:e}),t?p.jsx("button",{type:"button",className:"mt-5 h-10 rounded-md bg-accent px-4 text-sm font-medium text-accent-ink",onClick:t,children:"重试"}):null]})})}function Uue({children:e,redirectTo:t="/login"}){const n=P1(),i=Nr();if(n.isPending)return p.jsx(eP,{});if(!n.data){const s=t==="/login"?`/login?returnTo=${encodeURIComponent(i.pathname+i.search)}`:t;return p.jsx(Im,{to:s,replace:!0})}return p.jsx(p.Fragment,{children:e})}function Hue(){const e=N3();if(e.isPending)return p.jsx(eP,{label:"正在检查工作空间…"});if(e.isError||!e.data)return p.jsx(Fue,{message:e.error instanceof Error?e.error.message:"本机服务未启动",onRetry:()=>{e.refetch()}});const t=e.data.auth,n=window.location.origin===t.passkeyOrigin,s=t.passkeyEnabled&&n&&t.passkeyRegistered?"/login":"/pair";return p.jsx(Uue,{redirectTo:s,children:p.jsx(Bue,{})})}function ps(e){const t=new Uint8Array(e);let n="";for(const s of t)n+=String.fromCharCode(s);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function _m(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=(4-t.length%4)%4,i=t.padEnd(t.length+n,"="),s=atob(i),a=new ArrayBuffer(s.length),l=new Uint8Array(a);for(let u=0;u<s.length;u++)l[u]=s.charCodeAt(u);return a}function lh(){return $ue.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential=="function")}const $ue={stubThis:e=>e};function tP(e){const{id:t}=e;return{...e,id:_m(t),transports:e.transports,type:e.type}}function nP(e){return e==="localhost"||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}class ti extends Error{constructor({message:t,code:n,cause:i,name:s}){super(t,{cause:i}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s??i.name,this.code=n}}function que({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new ti({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(n.authenticatorSelection?.requireResidentKey===!0)return new ti({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&n.authenticatorSelection?.userVerification==="required")return new ti({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(n.authenticatorSelection?.userVerification==="required")return new ti({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new ti({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new ti({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return n.pubKeyCredParams.filter(s=>s.type==="public-key").length===0?new ti({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new ti({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const i=globalThis.location.hostname;if(nP(i)){if(n.rp.id!==i)return new ti({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new ti({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new ti({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new ti({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return e}class Wue{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const iP=new Wue,Kue=["cross-platform","platform"];function rP(e){if(e&&!(Kue.indexOf(e)<0))return e}async function Vue(e){!e.optionsJSON&&e.challenge&&(console.warn("startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});const{optionsJSON:t,useAutoRegister:n=!1}=e;if(!lh())throw new Error("WebAuthn is not supported in this browser");const i={...t,challenge:_m(t.challenge),user:{...t.user,id:_m(t.user.id)},excludeCredentials:t.excludeCredentials?.map(tP)},s={};n&&(s.mediation="conditional"),s.publicKey=i,s.signal=iP.createNewAbortSignal();let a;try{a=await navigator.credentials.create(s)}catch(x){throw que({error:x,options:s})}if(!a)throw new Error("Registration was not completed");const{id:l,rawId:u,response:f,type:h}=a;let g;typeof f.getTransports=="function"&&(g=f.getTransports());let m;if(typeof f.getPublicKeyAlgorithm=="function")try{m=f.getPublicKeyAlgorithm()}catch(x){cb("getPublicKeyAlgorithm()",x)}let _;if(typeof f.getPublicKey=="function")try{const x=f.getPublicKey();x!==null&&(_=ps(x))}catch(x){cb("getPublicKey()",x)}let b;if(typeof f.getAuthenticatorData=="function")try{b=ps(f.getAuthenticatorData())}catch(x){cb("getAuthenticatorData()",x)}return{id:l,rawId:ps(u),response:{attestationObject:ps(f.attestationObject),clientDataJSON:ps(f.clientDataJSON),transports:g,publicKeyAlgorithm:m,publicKey:_,authenticatorData:b},type:h,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:rP(a.authenticatorAttachment)}}function cb(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
158
- `,t)}function Gue(){if(!lh())return ub.stubThis(new Promise(t=>t(!1)));const e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?ub.stubThis(new Promise(t=>t(!1))):ub.stubThis(e.isConditionalMediationAvailable())}const ub={stubThis:e=>e};function Zue({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new ti({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new ti({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const i=globalThis.location.hostname;if(nP(i)){if(n.rpId!==i)return new ti({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new ti({message:`${globalThis.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new ti({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return e}async function Yue(e){!e.optionsJSON&&e.challenge&&(console.warn("startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information."),e={optionsJSON:e});const{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:i=!0}=e;if(!lh())throw new Error("WebAuthn is not supported in this browser");let s;t.allowCredentials?.length!==0&&(s=t.allowCredentials?.map(tP));const a={...t,challenge:_m(t.challenge),allowCredentials:s},l={};if(n){if(!await Gue())throw Error("Browser does not support WebAuthn autofill");if(document.querySelectorAll("input[autocomplete$='webauthn']").length<1&&i)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');l.mediation="conditional",a.allowCredentials=[]}l.publicKey=a,l.signal=iP.createNewAbortSignal();let u;try{u=await navigator.credentials.get(l)}catch(b){throw Zue({error:b,options:l})}if(!u)throw new Error("Authentication was not completed");const{id:f,rawId:h,response:g,type:m}=u;let _;return g.userHandle&&(_=ps(g.userHandle)),{id:f,rawId:ps(h),response:{authenticatorData:ps(g.authenticatorData),clientDataJSON:ps(g.clientDataJSON),signature:ps(g.signature),userHandle:_},type:m,clientExtensionResults:u.getClientExtensionResults(),authenticatorAttachment:rP(u.authenticatorAttachment)}}function Xue(e){return e===null||!e.startsWith("/")||e.startsWith("//")||e==="/login"?"/":e}function wD(e){return e instanceof rr?e.code==="CHALLENGE_EXPIRED"?"登录挑战已过期,请重试":e.code==="PASSKEY_AUTH_FAILED"?"Passkey 登录失败;如果设备已被撤销,请重新配对":e.code==="WEBAUTHN_NOT_CONFIGURED"||e.code==="ORIGIN_INVALID"?"当前来源不能使用 Passkey,请改用 localhost / HTTPS 或使用配对码":e.message:e instanceof DOMException&&e.name==="NotAllowedError"?"已取消 Passkey 登录":e instanceof Error?e.message:"登录失败"}function Que(){const[e]=ZH(),t=Xue(e.get("returnTo")),n=N3(),i=P1(),s=zn(),[a,l]=w.useState(null),[u,f]=w.useState(!1),[h,g]=w.useState(null),m=lh(),_=n.data!==void 0&&window.location.origin===n.data.auth.passkeyOrigin,b=n.data!==void 0&&n.data.initialized&&n.data.auth.passkeyEnabled&&_&&m,x=w.useCallback(async()=>{try{const C=await we("/api/webauthn/authentication/options",{method:"POST"});return l(C),C}catch(C){return g(wD(C)),null}},[]);if(w.useEffect(()=>{b&&x()},[b,x]),i.data)return p.jsx(Im,{to:t,replace:!0});const S=async()=>{f(!0),g(null);try{const C=a??await x();if(C===null)return;const k=await Yue({optionsJSON:C.options});await we("/api/webauthn/authentication/verify",{method:"POST",body:{challengeId:C.challengeId,response:k}}),await s.invalidateQueries({queryKey:["session"]}),await s.invalidateQueries({queryKey:["bootstrap"]})}catch(C){g(wD(C)),C instanceof rr&&C.code==="CHALLENGE_EXPIRED"&&(l(null),await x())}finally{f(!1)}};return p.jsx("main",{className:"flex min-h-screen items-center justify-center bg-canvas px-6 py-10 text-ink",children:p.jsxs("section",{className:"w-full max-w-[420px] rounded-[18px] border border-line bg-surface p-7 shadow-card",children:[p.jsxs("div",{className:"mb-6 flex items-center gap-2",children:[p.jsx("span",{className:"inline-flex size-7 items-center justify-center rounded-md bg-accent text-[13px] font-semibold text-accent-ink",children:"L"}),p.jsx("span",{className:"text-[15px] font-semibold tracking-tight",children:"Larness"}),p.jsx("span",{className:"ml-auto text-xs text-ink-3",children:n.data?.app.version})]}),p.jsx("h1",{className:"text-lg font-semibold",children:"使用 Passkey 登录"}),p.jsx("p",{className:"mt-1 text-sm text-ink-2",children:"使用 Face ID、指纹或系统 PIN 解锁当前工作空间。"}),n.data?null:p.jsx("p",{className:"mt-6 text-sm text-ink-2",children:n.isError?"无法连接本机服务":"正在读取工作空间状态…"}),n.data&&!n.data.initialized?p.jsxs("p",{className:"mt-6 rounded-md bg-surface-2 p-3 text-sm text-ink-2",children:["工作空间尚未初始化。请先在本机运行 ",p.jsx("code",{children:"pnpm run tui"})," 完成初始化。"]}):null,n.data&&n.data.initialized&&!_?p.jsxs("p",{className:"mt-6 rounded-md bg-surface-2 p-3 text-sm text-ink-2",children:["当前来源 ",p.jsx("code",{children:window.location.origin})," 不是 canonical origin"," ",p.jsx("code",{children:n.data.auth.passkeyOrigin}),"。请改用 localhost 或 HTTPS 域名,或使用下方的“使用配对码”入口。"]}):null,n.data&&n.data.initialized&&_&&!m?p.jsx("p",{className:"mt-6 rounded-md bg-surface-2 p-3 text-sm text-ink-2",children:"当前浏览器不支持 WebAuthn / Passkey,请使用配对码入口。"}):null,n.data&&n.data.initialized&&!n.data.auth.passkeyEnabled?p.jsx("p",{className:"mt-6 rounded-md bg-surface-2 p-3 text-sm text-ink-2",children:"WebAuthn 配置无效(RP ID / Origin),Passkey 不可用;请使用配对码入口。"}):null,b?p.jsx("button",{type:"button",className:"mt-6 flex h-10 w-full items-center justify-center rounded-md bg-accent px-4 text-sm font-medium text-accent-ink transition hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50",disabled:u||a===null,onClick:()=>{S()},children:u?"正在验证…":a===null?"正在准备…":"使用 Passkey 登录"}):null,h?p.jsx("p",{role:"alert",className:"mt-4 rounded-md bg-surface-2 p-3 text-sm text-danger",children:h}):null,p.jsxs("div",{className:"mt-5 flex items-center justify-between text-sm",children:[p.jsx(Bm,{className:"text-accent hover:underline",to:"/pair",children:"使用配对码"}),b&&a===null?p.jsx("button",{type:"button",className:"text-ink-2 hover:text-ink",onClick:()=>{x()},children:"重试准备"}):null]})]})})}const CS="larness.pairing.request";function ds(){try{window.sessionStorage.removeItem(CS)}catch{}}function Jue(){try{const e=window.sessionStorage.getItem(CS);if(e===null)return null;const t=JSON.parse(e);return typeof t.requestId=="string"&&typeof t.shortCode=="string"&&typeof t.pollToken=="string"&&typeof t.expiresAt=="number"&&t.expiresAt>Date.now()+1e3?t:(ds(),null)}catch{return ds(),null}}function ede(e){try{window.sessionStorage.setItem(CS,JSON.stringify(e))}catch{}}function vd(e){if(e instanceof rr){if(e.code==="NOT_INITIALIZED")return"工作空间尚未初始化。请先在本机运行 pnpm run tui。";if(e.code==="CODE_INVALID"){const t=e.details?.attemptsLeft;return t===void 0?"配对码不正确":`配对码不正确,剩余 ${t} 次尝试`}return e.code==="PAIRING_DENIED"?"本机已拒绝本次配对申请":e.code==="PAIRING_EXPIRED"?"配对申请或配对码已过期,请重新申请":e.code==="RATE_LIMITED"?"尝试过于频繁,请稍后再试":e.code==="ENROLLMENT_EXPIRED"?"Passkey 注册窗口已过期,请重新配对":e.code==="ORIGIN_INVALID"||e.code==="WEBAUTHN_NOT_CONFIGURED"?"当前来源不能注册 Passkey,请改用 localhost / HTTPS,或在 TUI 中选择“允许本次”":e.code==="PASSKEY_REGISTRATION_FAILED"?"Passkey 注册失败,请重试或重新配对":e.message}return e instanceof DOMException&&e.name==="NotAllowedError"?"已取消 Passkey 注册":e instanceof Error?e.message:"操作失败"}function tde(){const e=P1(),t=zn(),n=w.useRef(!1),[i,s]=w.useState("creating"),[a,l]=w.useState(null),[u,f]=w.useState(null),[h,g]=w.useState(""),[m,_]=w.useState(null),[b,x]=w.useState(null),[S,C]=w.useState(null),[k,R]=w.useState(!1),N=lh();w.useEffect(()=>{e.data&&ds()},[e.data]);const A=w.useCallback(async()=>{ds(),s("creating"),C(null),l(null),_(null),x(null),f(null),g("");try{const L=await we("/api/pairing/requests",{method:"POST",body:{clientLabel:navigator.userAgent.slice(0,100)}});ede(L),l(L),s("waiting")}catch(L){C(vd(L)),s("error")}},[]);w.useEffect(()=>{if(n.current)return;n.current=!0;const L=Jue();if(L!==null){l(L),s("waiting");return}A()},[A]),w.useEffect(()=>{if(i!=="waiting"||a===null)return;let L=!1;const ee=setInterval(()=>{(async()=>{try{const U=await we(`/api/pairing/requests/${a.requestId}`,{headers:{"x-pairing-token":a.pollToken}});if(L)return;U.status==="approved"?(f(U.decision),s("code")):U.status==="enrollment_pending"?(f("trust"),s("enrollment")):U.status==="denied"?(ds(),C("本机已拒绝本次配对申请"),s("error")):U.status==="expired"?(ds(),C("配对申请已过期,请重新申请"),s("error")):U.status==="redeemed"&&(ds(),await t.invalidateQueries({queryKey:["session"]}),s("error"),C("该申请已完成配对,请返回工作台"))}catch(U){L||(U instanceof rr&&U.code==="NOT_FOUND"&&ds(),C(vd(U)),s("error"))}})()},2e3);return()=>{L=!0,clearInterval(ee)}},[i,a,t]);const I=w.useCallback(async()=>{try{const L=await we("/api/webauthn/registration/options",{method:"POST"});return x(L),L}catch(L){return C(vd(L)),null}},[]);if(w.useEffect(()=>{i==="enrollment"&&N&&I()},[i,N,I]),e.data)return p.jsx(Im,{to:"/",replace:!0});const T=async L=>{if(L.preventDefault(),a!==null){R(!0),C(null);try{const ee=await we("/api/pairing/redeem",{method:"POST",body:{requestId:a.requestId,code:h.trim()}});if(ee.status==="session"){ds(),await t.invalidateQueries({queryKey:["session"]}),await t.invalidateQueries({queryKey:["bootstrap"]}),s("error"),C("配对成功,正在进入工作台…"),await t.refetchQueries({queryKey:["session"]});return}_(ee),s("enrollment")}catch(ee){C(vd(ee))}finally{R(!1)}}},D=async()=>{if(b!==null){R(!0),C(null);try{const L=await Vue({optionsJSON:b.options});await we("/api/webauthn/registration/verify",{method:"POST",body:{challengeId:b.challengeId,response:L}}),ds(),await t.invalidateQueries({queryKey:["session"]}),await t.invalidateQueries({queryKey:["bootstrap"]}),C("Passkey 已创建,正在进入工作台…"),await t.refetchQueries({queryKey:["session"]})}catch(L){C(vd(L)),L instanceof rr&&(L.code==="CHALLENGE_EXPIRED"||L.code==="PASSKEY_REGISTRATION_FAILED"||L.code==="ENROLLMENT_EXPIRED")&&(x(null),await I())}finally{R(!1)}}};return p.jsx("main",{className:"flex min-h-screen items-center justify-center bg-canvas px-6 py-10 text-ink",children:p.jsxs("section",{className:"w-full max-w-[460px] rounded-[18px] border border-line bg-surface p-7 shadow-card","data-request-id":a?.requestId??"","data-stage":i,children:[p.jsxs("div",{className:"mb-6 flex items-center gap-2",children:[p.jsx("span",{className:"inline-flex size-7 items-center justify-center rounded-md bg-accent text-[13px] font-semibold text-accent-ink",children:"L"}),p.jsx("span",{className:"text-[15px] font-semibold tracking-tight",children:"Larness"})]}),p.jsx("h1",{className:"text-lg font-semibold",children:"配对这台浏览器"}),p.jsx("p",{className:"mt-1 text-sm text-ink-2",children:"申请需要在本机 TUI 中批准;配对码只显示一次。"}),i==="creating"?p.jsx("p",{className:"mt-6 text-sm text-ink-2",children:"正在创建配对申请…"}):null,i==="waiting"&&a?p.jsxs("div",{className:"mt-6",children:[p.jsx("p",{className:"text-xs uppercase tracking-wide text-ink-3",children:"短编号"}),p.jsx("p",{className:"mt-1 font-mono text-3xl font-semibold tracking-[0.18em] text-ink",children:a.shortCode}),p.jsx("p",{className:"mt-3 text-sm text-ink-2",children:"等待本机 TUI 批准。批准后在此输入一次性配对码。"}),p.jsx("button",{type:"button",className:"mt-4 text-sm text-accent hover:underline",onClick:()=>{A()},children:"重新申请"})]}):null,i==="code"&&a?p.jsxs("form",{className:"mt-6",onSubmit:L=>{T(L)},children:[p.jsxs("p",{className:"text-sm text-ink-2",children:["已获批准(",u==="trust"?"始终允许,需要创建 Passkey":"允许本次",")。 请输入 TUI 显示的配对码。"]}),p.jsx("label",{className:"mt-4 block text-xs font-medium text-ink-2",htmlFor:"pair-code",children:"配对码"}),p.jsx("input",{id:"pair-code",className:"mt-1 h-11 w-full rounded-md border border-line bg-surface-2 px-3 font-mono text-lg tracking-[0.14em] outline-none focus:border-accent",value:h,onChange:L=>g(L.target.value.toUpperCase()),placeholder:"XXXXX-XXXXX",autoComplete:"one-time-code"}),p.jsx("button",{type:"submit",className:"mt-4 flex h-10 w-full items-center justify-center rounded-md bg-accent px-4 text-sm font-medium text-accent-ink transition hover:opacity-90 disabled:opacity-50",disabled:k||h.trim().length===0,children:k?"正在兑换…":"兑换配对码"}),p.jsx("button",{type:"button",className:"mt-3 text-sm text-ink-2 hover:text-ink",onClick:()=>{A()},children:"重新申请"})]}):null,i==="enrollment"?p.jsxs("div",{className:"mt-6",children:[p.jsx("p",{className:"text-sm text-ink-2",children:"配对码已兑换。必须在窗口过期前创建 Passkey,之后才能进入工作台。"}),m===null?p.jsx("p",{className:"mt-2 text-xs text-ink-3",children:"已恢复同一配对申请的注册窗口。"}):null,N?null:p.jsx("p",{className:"mt-3 rounded-md bg-surface-2 p-3 text-sm text-ink-2",children:"当前浏览器不支持 WebAuthn。请重新配对,并在 TUI 中选择“允许本次”。"}),N?p.jsx("button",{type:"button",className:"mt-4 flex h-10 w-full items-center justify-center rounded-md bg-accent px-4 text-sm font-medium text-accent-ink transition hover:opacity-90 disabled:opacity-50",disabled:k||b===null,onClick:()=>{D()},children:k?"正在创建…":b===null?"正在准备…":"创建 Passkey"}):null,p.jsx("button",{type:"button",className:"mt-3 text-sm text-ink-2 hover:text-ink",onClick:()=>{A()},children:"重新配对"})]}):null,i==="error"?p.jsxs("div",{className:"mt-6",children:[p.jsx("button",{type:"button",className:"mt-2 flex h-10 w-full items-center justify-center rounded-md bg-accent px-4 text-sm font-medium text-accent-ink transition hover:opacity-90",onClick:()=>{A()},children:"重新申请"}),p.jsx(Bm,{className:"mt-3 inline-block text-sm text-ink-2 hover:text-ink",to:"/login",children:"返回登录"})]}):null,S?p.jsx("p",{role:"alert",className:"mt-4 rounded-md bg-surface-2 p-3 text-sm text-danger",children:S}):null,a?p.jsxs("p",{className:"mt-5 text-xs text-ink-3",children:["申请有效期至 ",new Date(a.expiresAt).toLocaleTimeString(),";配对码在其他设备上不显示。"]}):null]})})}function nde(){return PX(),p.jsxs(_H,{children:[p.jsx(yd,{path:"/",element:p.jsx(Hue,{})}),p.jsx(yd,{path:"/login",element:p.jsx(Que,{})}),p.jsx(yd,{path:"/pair",element:p.jsx(tde,{})}),p.jsx(yd,{path:"*",element:p.jsx(Im,{to:"/",replace:!0})})]})}function ide(){return p.jsx(nde,{})}const sP=document.getElementById("root");if(!sP)throw new Error("Root element not found");_7.createRoot(sP).render(p.jsx(w.StrictMode,{children:p.jsx(TQ,{children:p.jsx(DU,{client:qt,children:p.jsx(RU,{delayDuration:250,children:p.jsx(qH,{children:p.jsx(ide,{})})})})})}));export{xp as W,$1 as _,p as j,w as r,DQ as u};