@oscloudlab/knowledge-card 0.0.21 → 0.0.22

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 (312) hide show
  1. package/dist/{abap-DB5Mfrxg.js → abap-DRc5NyrE.js} +1 -1
  2. package/dist/{abnf-AW8CRQ_H.js → abnf-Ce7_excq.js} +1 -1
  3. package/dist/{actionscript-fxk2CB_d.js → actionscript-B1f8q8Kk.js} +1 -1
  4. package/dist/{ada-D1b2eAnY.js → ada-COS79p7P.js} +1 -1
  5. package/dist/{agda-H128FJdI.js → agda-BJ-H5kQF.js} +1 -1
  6. package/dist/{al-Cv5lkaO8.js → al-CaQFccrJ.js} +1 -1
  7. package/dist/{antlr4-VMY7VMMr.js → antlr4-C7zfJjas.js} +1 -1
  8. package/dist/{apacheconf--CibNTrN.js → apacheconf-D8Qdy2eL.js} +1 -1
  9. package/dist/{apex-DyMs08mA.js → apex-ZNBeqpa5.js} +1 -1
  10. package/dist/{apl-CHGq4yjJ.js → apl-Cym27Meh.js} +1 -1
  11. package/dist/{applescript-BMQgQCq0.js → applescript-D2uwE6go.js} +1 -1
  12. package/dist/{aql-BoC39JS7.js → aql-CRWRFWxz.js} +1 -1
  13. package/dist/{arduino-Bq89ZylV.js → arduino-DFr1ibN5.js} +1 -1
  14. package/dist/{arff-wuypswok.js → arff-Brckqt51.js} +1 -1
  15. package/dist/{asciidoc-2qU2xKxj.js → asciidoc-BF1hOVvr.js} +1 -1
  16. package/dist/{asm6502-a4W5VbQr.js → asm6502-BF-bEVOr.js} +1 -1
  17. package/dist/{asmatmel-i-5Fn1P_.js → asmatmel-0BRppUaN.js} +1 -1
  18. package/dist/{aspnet-4lWuIaDq.js → aspnet-RgWg2aKK.js} +1 -1
  19. package/dist/{autohotkey-rINFqa2k.js → autohotkey-BsU0CT8q.js} +1 -1
  20. package/dist/autohotkey-BsU0CT8q.js.gz +0 -0
  21. package/dist/{autoit-C_j68ZGR.js → autoit-BsbC8jbq.js} +1 -1
  22. package/dist/{avisynth-B7f09U-G.js → avisynth-BA-QQZQ3.js} +1 -1
  23. package/dist/{avro-idl-SKF8E78z.js → avro-idl-KO_tEuXh.js} +1 -1
  24. package/dist/{bash-QQHgAbf7.js → bash-C_VAa3JX.js} +1 -1
  25. package/dist/{basic-DRwS5iXn.js → basic-CDKJ2LdQ.js} +1 -1
  26. package/dist/{batch-ld-_mvER.js → batch-BAz98G0I.js} +1 -1
  27. package/dist/{bbcode-BcGPWYMG.js → bbcode-LZc6_JHH.js} +1 -1
  28. package/dist/{bicep-DT16J5mN.js → bicep-wZO8g2OE.js} +1 -1
  29. package/dist/{birb-I-jXcUrz.js → birb-C1g__jlx.js} +1 -1
  30. package/dist/{bison-DDReCBKN.js → bison-8T1LzQt2.js} +1 -1
  31. package/dist/{bnf-Bn9b4u84.js → bnf-BdWS79Yg.js} +1 -1
  32. package/dist/{brainfuck-BC4JEUHj.js → brainfuck-nkA1NQw1.js} +1 -1
  33. package/dist/{brightscript-BE1X8VLJ.js → brightscript-C0xIAk9p.js} +1 -1
  34. package/dist/{bro-B6rzcLzB.js → bro-BJrBOghf.js} +1 -1
  35. package/dist/{bsl-BDzDhyAz.js → bsl-CblF7-yy.js} +1 -1
  36. package/dist/{c-634h_Qoi.js → c-DrXjx0jY.js} +1 -1
  37. package/dist/{cfscript-D5CifOCw.js → cfscript-CSptB2C9.js} +1 -1
  38. package/dist/{chaiscript-BhdUBDva.js → chaiscript-BFTNxSer.js} +1 -1
  39. package/dist/{cil-1GqaySc4.js → cil-Dg9ycJNJ.js} +1 -1
  40. package/dist/{clike-B9TIBaQ3.js → clike-B02ctXkH.js} +1 -1
  41. package/dist/{clojure-Dpo1Ebzu.js → clojure-Cc5x43sU.js} +1 -1
  42. package/dist/{cmake-ClwqTS9b.js → cmake-YHBcqcEK.js} +1 -1
  43. package/dist/cmake-YHBcqcEK.js.gz +0 -0
  44. package/dist/{cobol-BaolRVT5.js → cobol-OYgZAINY.js} +1 -1
  45. package/dist/{coffeescript-zlOHoqJz.js → coffeescript-DK14r5ga.js} +1 -1
  46. package/dist/{concurnas-M2as3lP5.js → concurnas-Bxzk9hMa.js} +1 -1
  47. package/dist/{coq-BnxD-9tS.js → coq-BOPrjIDW.js} +1 -1
  48. package/dist/{core-sOODCgGc.js → core-D_FcF90z.js} +5 -5
  49. package/dist/core-D_FcF90z.js.gz +0 -0
  50. package/dist/{cpp-eS45G1Ot.js → cpp-BwzLlRtR.js} +1 -1
  51. package/dist/{crystal-CDmXS0KT.js → crystal-DlgyjltN.js} +1 -1
  52. package/dist/{csharp-SWnP9IkM.js → csharp-BT3zHZsJ.js} +1 -1
  53. package/dist/{cshtml-B-r3v7z9.js → cshtml-UQpZHpi0.js} +1 -1
  54. package/dist/{csp-BhlSYuvw.js → csp-BmfLrJj0.js} +1 -1
  55. package/dist/{css-BmU69n6U.js → css-D3X5FcPd.js} +1 -1
  56. package/dist/{css-extras-Bd0VnEnf.js → css-extras-Ch5yeHLS.js} +1 -1
  57. package/dist/{csv-D4cKQ48F.js → csv-dLtBRwBV.js} +1 -1
  58. package/dist/{cypher-YTNpNRWx.js → cypher-Cla3Efb4.js} +1 -1
  59. package/dist/{d-BJOzdoHC.js → d-AecB5XEA.js} +1 -1
  60. package/dist/{dart-U1SpYy9v.js → dart-BnZeTfSc.js} +1 -1
  61. package/dist/{dataweave-D0Vw99tu.js → dataweave-BvyjBdkG.js} +1 -1
  62. package/dist/{dax-B5FW6NCK.js → dax-CqEZA5Jy.js} +1 -1
  63. package/dist/{dhall-BQ-PZINF.js → dhall-DOWQn4a6.js} +1 -1
  64. package/dist/{diff-CW0Pkzhp.js → diff-D1U7Jmyt.js} +1 -1
  65. package/dist/{django-C8CQH6jc.js → django-mc6PJLcx.js} +1 -1
  66. package/dist/{dns-zone-file-CGL0gvmC.js → dns-zone-file-BzW4622Q.js} +1 -1
  67. package/dist/{docker-DMu5ZQUO.js → docker-C7v9E9En.js} +1 -1
  68. package/dist/{dot-BWxQLTCt.js → dot-CWPeCyF5.js} +1 -1
  69. package/dist/{ebnf-TjGpIF71.js → ebnf-_cWCMfSh.js} +1 -1
  70. package/dist/{editorconfig-tYRgQSoi.js → editorconfig-x3b1pTzN.js} +1 -1
  71. package/dist/{eiffel-CQYbet9-.js → eiffel-D-9GUhRd.js} +1 -1
  72. package/dist/{ejs-vJ7HqT-q.js → ejs-BgP2aUTN.js} +1 -1
  73. package/dist/{elixir-Dp3M3RqV.js → elixir-DjOaolSq.js} +1 -1
  74. package/dist/{elm-B1VqG3sT.js → elm-9Mx7hmQ5.js} +1 -1
  75. package/dist/{erb-DtafQ8lU.js → erb-QpCHi9Zs.js} +1 -1
  76. package/dist/{erlang-ylb0j-wI.js → erlang-BDdGgm4J.js} +1 -1
  77. package/dist/{etlua-l6WqvHLG.js → etlua-E8FLk7Fn.js} +1 -1
  78. package/dist/{excel-formula-B7Xmyv31.js → excel-formula-8prykwOT.js} +1 -1
  79. package/dist/{factor-BDn6Aj8P.js → factor-CFxKCF2x.js} +1 -1
  80. package/dist/{factor-BDn6Aj8P.js.gz → factor-CFxKCF2x.js.gz} +0 -0
  81. package/dist/{false-B_qoYfyi.js → false-ASIrAR1y.js} +1 -1
  82. package/dist/{firestore-security-rules-BFy6on4-.js → firestore-security-rules-Dj9UTFus.js} +1 -1
  83. package/dist/{flow-Dmi1trLT.js → flow-kMs2kXZ1.js} +1 -1
  84. package/dist/{fortran-DTdtaDjb.js → fortran-BH5KvwUb.js} +1 -1
  85. package/dist/{fsharp-4H92n65j.js → fsharp-CTQBapLf.js} +1 -1
  86. package/dist/{ftl-wMYZwcTj.js → ftl-DeUopoNg.js} +1 -1
  87. package/dist/{gap-BlnrIa-5.js → gap-wvJCYS-J.js} +1 -1
  88. package/dist/{gcode-DtWefhXO.js → gcode-ltszSCYL.js} +1 -1
  89. package/dist/{gdscript-BhaEHOwJ.js → gdscript-DSmJDemI.js} +1 -1
  90. package/dist/{gedcom-g87LTQeG.js → gedcom-DLNRrH1d.js} +1 -1
  91. package/dist/{gherkin-CfV8-qi4.js → gherkin-CHazp3IJ.js} +1 -1
  92. package/dist/gherkin-CHazp3IJ.js.gz +0 -0
  93. package/dist/{git-DhKsHX-0.js → git-CLe6xywW.js} +1 -1
  94. package/dist/{glsl-C_BGh8ho.js → glsl-Blcz7lyG.js} +1 -1
  95. package/dist/{gml-Bhf_pjK9.js → gml-BMdnUTNE.js} +1 -1
  96. package/dist/{gn-YT4DyIK8.js → gn-BHCiX-cK.js} +1 -1
  97. package/dist/{go-module-CGiD6h0r.js → go-module-Cw3sOFtE.js} +1 -1
  98. package/dist/{go-D1Pto_Q2.js → go-wvMLo6Ij.js} +1 -1
  99. package/dist/{graphql-CC_nwQpl.js → graphql-BxcO_b0t.js} +1 -1
  100. package/dist/{groovy-CANV0moX.js → groovy-m8Qktp5u.js} +1 -1
  101. package/dist/{haml-CDbLCk3v.js → haml-CzVD7Dt-.js} +1 -1
  102. package/dist/{handlebars-DLU4yfSz.js → handlebars-DjW4Nt45.js} +1 -1
  103. package/dist/{haskell-DGkEnBcg.js → haskell-B6tF2d41.js} +1 -1
  104. package/dist/{haxe-Dha1fvx0.js → haxe-C_GNI8pR.js} +1 -1
  105. package/dist/{hcl-BW5xHYsF.js → hcl-CjtPDKAA.js} +1 -1
  106. package/dist/{hlsl-BTYLSDe5.js → hlsl-DM5z7tzs.js} +1 -1
  107. package/dist/{hoon-BuVkYwFU.js → hoon-8affzDX5.js} +1 -1
  108. package/dist/{hpkp-DBXpFiV0.js → hpkp-D9m278Wl.js} +1 -1
  109. package/dist/{hsts-w2BW6I4w.js → hsts-Cr6UwIiu.js} +1 -1
  110. package/dist/{http-BO0icNsW.js → http-Z1YGYNbm.js} +1 -1
  111. package/dist/{ichigojam-BWbNmuBT.js → ichigojam-B37m9o86.js} +1 -1
  112. package/dist/{icon-CuFtjsGm.js → icon-RSMFcWdo.js} +1 -1
  113. package/dist/{icu-message-format-nM6CNUVh.js → icu-message-format-Dk5nt1Nx.js} +1 -1
  114. package/dist/{idris-CFHvBSl-.js → idris-B99fOwy9.js} +1 -1
  115. package/dist/{iecst-z48Xs5jv.js → iecst-DDlmffTC.js} +1 -1
  116. package/dist/{ignore-Co0uMjPA.js → ignore-Pdjphcia.js} +1 -1
  117. package/dist/{index-Cv3HWh1-.js → index-CTdm428_.js} +291 -287
  118. package/dist/{index-Cv3HWh1-.js.gz → index-CTdm428_.js.gz} +0 -0
  119. package/dist/{inform7-CVCfe9ow.js → inform7-Dtmplv3G.js} +1 -1
  120. package/dist/{ini-CHGOggmm.js → ini-C3LzPSfU.js} +1 -1
  121. package/dist/{io-T3-8JcI3.js → io-DEH3ifpV.js} +1 -1
  122. package/dist/{j-B5bQe3wX.js → j-CuB9i2rG.js} +1 -1
  123. package/dist/{java-DcpwhXv4.js → java-Cxzc_ucQ.js} +1 -1
  124. package/dist/{javadoc-BuezZ5m2.js → javadoc-BMnk4Fwz.js} +1 -1
  125. package/dist/{javadoclike-B3almXZi.js → javadoclike-6Fb-drXa.js} +1 -1
  126. package/dist/{javascript-zw2vw7rX.js → javascript-B52ZSuS5.js} +1 -1
  127. package/dist/{javastacktrace-DruKwdyz.js → javastacktrace-DLilJvlF.js} +1 -1
  128. package/dist/{jexl-nzWTU387.js → jexl-ytgMh0bQ.js} +1 -1
  129. package/dist/{jolie-DevrdKRq.js → jolie-BLetqxhW.js} +1 -1
  130. package/dist/{jq-DH1rQGOa.js → jq-CoNsWqe0.js} +1 -1
  131. package/dist/{js-extras-Cn7dUDC4.js → js-extras-DhUtE0ya.js} +1 -1
  132. package/dist/{js-templates-Cv9qDVE3.js → js-templates-rYExZjF0.js} +1 -1
  133. package/dist/{jsdoc-0GssAhPO.js → jsdoc-D3YwQ3g4.js} +1 -1
  134. package/dist/{json-DWWgFU_u.js → json-BXxsmz8h.js} +1 -1
  135. package/dist/{json5--Z5fYWUv.js → json5-BmVcoFEr.js} +1 -1
  136. package/dist/{jsonp-DDIFo4MH.js → jsonp-DW0SJ-dH.js} +1 -1
  137. package/dist/{jsstacktrace-DLmrmM5s.js → jsstacktrace-BRj_h3n3.js} +1 -1
  138. package/dist/{jsx-C1PmkT-J.js → jsx-Xf-xBm2_.js} +1 -1
  139. package/dist/{julia-DOtiwQr5.js → julia-BPpvOJr1.js} +1 -1
  140. package/dist/{keepalived-CNhEdinW.js → keepalived-C8Ma1sFD.js} +1 -1
  141. package/dist/{keyman-8VyaxYaB.js → keyman-BAyDHjlA.js} +1 -1
  142. package/dist/knowledge-card.es.js +1 -1
  143. package/dist/knowledge-card.umd.js +1 -1
  144. package/dist/knowledge-card.umd.js.gz +0 -0
  145. package/dist/{kotlin-BiyQ4DZX.js → kotlin-BRSg5UQu.js} +1 -1
  146. package/dist/{kumir-ByunyTD9.js → kumir-CeO8WIBk.js} +1 -1
  147. package/dist/{kusto-BQwzXLSL.js → kusto-DLr5-6Lm.js} +1 -1
  148. package/dist/{latex-Cd3SgyNj.js → latex-BbdAWl01.js} +1 -1
  149. package/dist/{latte-DicKQicH.js → latte-5J_cqplM.js} +1 -1
  150. package/dist/{less-CWM5Iigk.js → less-UcBc-tYl.js} +1 -1
  151. package/dist/{lilypond-mruIYqo8.js → lilypond-ogkyF4An.js} +1 -1
  152. package/dist/{liquid-BbSqeffX.js → liquid-CnMBn2yZ.js} +1 -1
  153. package/dist/{lisp-BUpAvBkt.js → lisp-eHqbw2cH.js} +1 -1
  154. package/dist/{livescript-D1UG9JFX.js → livescript-DBCkiLRU.js} +1 -1
  155. package/dist/{llvm-BL58WoJH.js → llvm-B-QN9ZFY.js} +1 -1
  156. package/dist/{log-MYQ25Xfu.js → log-sA5Yr4sm.js} +1 -1
  157. package/dist/{lolcode-B9m5dgyp.js → lolcode-BfYgBfiE.js} +1 -1
  158. package/dist/{lua-Bnkfxr5V.js → lua-B_u1BGKR.js} +1 -1
  159. package/dist/{magma-DMCAL3hw.js → magma-CSv1tsBW.js} +1 -1
  160. package/dist/{makefile-lJJ8Z7WE.js → makefile-CpKuBfPq.js} +1 -1
  161. package/dist/{markdown-DufvqFii.js → markdown-CdDxB6iX.js} +1 -1
  162. package/dist/markdown-CdDxB6iX.js.gz +0 -0
  163. package/dist/{markup-CECRTWNC.js → markup-DAGzgNmH.js} +1 -1
  164. package/dist/{markup-templating-CETpQRdW.js → markup-templating-kp1pOTMw.js} +1 -1
  165. package/dist/{matlab-zqhEZtpN.js → matlab-B-JBfZNl.js} +1 -1
  166. package/dist/{maxscript-C_IJQhqJ.js → maxscript-D_7qvl-q.js} +1 -1
  167. package/dist/{mel-BoHlWoIK.js → mel-CRKtK112.js} +1 -1
  168. package/dist/mel-CRKtK112.js.gz +0 -0
  169. package/dist/{mermaid-D7t8JYwy.js → mermaid-DA2tPebU.js} +1 -1
  170. package/dist/{mizar-BCgtMamP.js → mizar-CoH-iIIV.js} +1 -1
  171. package/dist/{mongodb-BqTmFrwF.js → mongodb-D7ovWvoo.js} +1 -1
  172. package/dist/{monkey-Baavi2H3.js → monkey-C52b1Trb.js} +1 -1
  173. package/dist/{moonscript-D8kty9Fp.js → moonscript-Co2ibB8M.js} +1 -1
  174. package/dist/{n1ql-eDhQpIb6.js → n1ql-Ddz0mlRd.js} +1 -1
  175. package/dist/{n4js-DYq6Y74b.js → n4js-WZ4i5A-V.js} +1 -1
  176. package/dist/{nand2tetris-hdl-B4CUOGJw.js → nand2tetris-hdl-DuHa2GvG.js} +1 -1
  177. package/dist/{naniscript-BJYcdqo3.js → naniscript-AkMHqA7D.js} +1 -1
  178. package/dist/{nasm-kXWSzBT5.js → nasm-BRYktx6m.js} +1 -1
  179. package/dist/{neon-9zR3NDfQ.js → neon-BicrXFao.js} +1 -1
  180. package/dist/{nevod-DYO-i2Gh.js → nevod-BFkSJBHG.js} +1 -1
  181. package/dist/{nginx-D4phCvJr.js → nginx-DBe3pHGI.js} +1 -1
  182. package/dist/{nim-mLpJTelf.js → nim-CYqzANDd.js} +1 -1
  183. package/dist/{nix-DCdbHAw4.js → nix-C58g9rZv.js} +1 -1
  184. package/dist/{nsis-D3zPh92q.js → nsis-BMCvBg1s.js} +1 -1
  185. package/dist/{objectivec-Bf4aODqC.js → objectivec-CvyLIKlI.js} +1 -1
  186. package/dist/{ocaml-BsjO8a7o.js → ocaml-DavKvWWs.js} +1 -1
  187. package/dist/{opencl-DRPJgMFh.js → opencl-C_NZSF5h.js} +1 -1
  188. package/dist/opencl-C_NZSF5h.js.gz +0 -0
  189. package/dist/{openqasm-B-1dDYon.js → openqasm-9E8bSlmx.js} +1 -1
  190. package/dist/{oz-Cn_wOG54.js → oz-CLXucMIU.js} +1 -1
  191. package/dist/{parigp-bKMUUA9X.js → parigp-150t5scG.js} +1 -1
  192. package/dist/{parser-DjSgGj4B.js → parser-Xk7r6_ak.js} +1 -1
  193. package/dist/{pascal-Do5GnhqG.js → pascal-CIBJrPrV.js} +1 -1
  194. package/dist/{pascaligo-CIjqsJVo.js → pascaligo-CrfR6DKH.js} +1 -1
  195. package/dist/{pcaxis-BCHrGQ42.js → pcaxis-DZvAudim.js} +1 -1
  196. package/dist/{peoplecode-o6w9N0K5.js → peoplecode-Dvhvu60F.js} +1 -1
  197. package/dist/{perl-BR23V1Wg.js → perl-CSvnJ6v_.js} +1 -1
  198. package/dist/{php-extras-DetDMn1l.js → php-extras-C4pICkAA.js} +1 -1
  199. package/dist/{php-oWBnWtn9.js → php-nA17FNqG.js} +1 -1
  200. package/dist/{phpdoc-pWJCNfkD.js → phpdoc-C0-aJG0E.js} +1 -1
  201. package/dist/{plsql-dLX_nmwx.js → plsql-CI3KJuRG.js} +1 -1
  202. package/dist/{powerquery-zM3wG-7E.js → powerquery-CQJ3axcM.js} +1 -1
  203. package/dist/{powershell-DjWqKT0o.js → powershell-Di2Opqm8.js} +1 -1
  204. package/dist/{processing-CQ0KPJa0.js → processing-DQyeTekC.js} +1 -1
  205. package/dist/{prolog-BYck8tJB.js → prolog-DjOh21MS.js} +1 -1
  206. package/dist/{promql-pC0ayfzM.js → promql-BNAYHVXT.js} +1 -1
  207. package/dist/{properties-Ciou1F-y.js → properties-D2bnhQgr.js} +1 -1
  208. package/dist/{protobuf-CBFaYpN5.js → protobuf-Dni_7oNK.js} +1 -1
  209. package/dist/{psl-D8fn9d2x.js → psl-BEYK0I01.js} +1 -1
  210. package/dist/{pug-B57FVx4f.js → pug-Cj_8roem.js} +1 -1
  211. package/dist/{puppet-Bj2QWf7r.js → puppet-D5gJN3_q.js} +1 -1
  212. package/dist/{pure-Dto3maqu.js → pure-DjLIPlac.js} +1 -1
  213. package/dist/{purebasic-D4qGEkNo.js → purebasic-DY8v8vhZ.js} +1 -1
  214. package/dist/{purescript-Cr8rBYw1.js → purescript-Blbs1Vfp.js} +1 -1
  215. package/dist/{python-CaU_8bnc.js → python-Dt1FKPdT.js} +1 -1
  216. package/dist/{q-9Kn39B0A.js → q-C9DGHux0.js} +1 -1
  217. package/dist/{qml-BcvnMrfI.js → qml-BfUt2EmM.js} +1 -1
  218. package/dist/{qore-DTcwOWX4.js → qore-aRpwbq1X.js} +1 -1
  219. package/dist/{qsharp-CuiQ6k01.js → qsharp-DBPk_6Ap.js} +1 -1
  220. package/dist/{r-BEAxvh_u.js → r-35ES9afA.js} +1 -1
  221. package/dist/{racket-CcMA4gNN.js → racket-Coj6PC8w.js} +1 -1
  222. package/dist/{reason-DG4Y8YvL.js → reason-Dt5i_aQF.js} +1 -1
  223. package/dist/{regex-Zm1BvnAP.js → regex-DzZ7qnJG.js} +1 -1
  224. package/dist/{rego-T5g7QOv2.js → rego-DYUFDfLT.js} +1 -1
  225. package/dist/{renpy-DtqVa_MQ.js → renpy-RCIYIpKW.js} +1 -1
  226. package/dist/{rest-Bhtq04fV.js → rest-Co5A7VF7.js} +1 -1
  227. package/dist/{rip-BYtJSAGV.js → rip-CA5txq9p.js} +1 -1
  228. package/dist/{roboconf-CSqmvitN.js → roboconf-DZMzArTj.js} +1 -1
  229. package/dist/{robotframework-UBTXWULg.js → robotframework-CXTGzFD5.js} +1 -1
  230. package/dist/{ruby-BUAknpjE.js → ruby-Bs7ov-su.js} +1 -1
  231. package/dist/{rust-DUYF1Q7Q.js → rust-BrJM7w0i.js} +1 -1
  232. package/dist/{sas-NfMaQml6.js → sas-CnIVvpTI.js} +1 -1
  233. package/dist/sas-CnIVvpTI.js.gz +0 -0
  234. package/dist/{sass-Nk9OhobW.js → sass-CTK-UrjH.js} +1 -1
  235. package/dist/{scala-B5Iku2eH.js → scala-DTmGSMBW.js} +1 -1
  236. package/dist/{scheme-evf2IzPn.js → scheme-DqAdtgrW.js} +1 -1
  237. package/dist/{scss-ChVwor8x.js → scss-GVHeA0bK.js} +1 -1
  238. package/dist/{shell-session-C0XCEL3H.js → shell-session-CDr6Einv.js} +1 -1
  239. package/dist/{smali-Prpk_HMS.js → smali-kPOoi5UY.js} +1 -1
  240. package/dist/{smalltalk-C3tf__KX.js → smalltalk-C2YFbc4Z.js} +1 -1
  241. package/dist/{smarty-DG6FCPKD.js → smarty-_A7MXRLz.js} +1 -1
  242. package/dist/{sml-BtKZdrJW.js → sml-CWW2YxNL.js} +1 -1
  243. package/dist/{solidity-CK-pMfTb.js → solidity-CKmZLLKH.js} +1 -1
  244. package/dist/{solution-file-BxkAHuM7.js → solution-file-BRA06s3V.js} +1 -1
  245. package/dist/{soy-BTiQF18P.js → soy-CqL7oK7L.js} +1 -1
  246. package/dist/{sparql-m0rTqWEE.js → sparql-QxtP609I.js} +1 -1
  247. package/dist/{splunk-spl-DSN6Ok6G.js → splunk-spl-oOocc6FA.js} +1 -1
  248. package/dist/{sqf-BsGvu0rx.js → sqf-D4_hxAUe.js} +1 -1
  249. package/dist/sqf-D4_hxAUe.js.gz +0 -0
  250. package/dist/{sql-C5xD-NR-.js → sql-Diujj3xq.js} +1 -1
  251. package/dist/{squirrel-Cgf2YM1n.js → squirrel-VZGGfI9L.js} +1 -1
  252. package/dist/{stan-CsPUF07V.js → stan-goqwrpgs.js} +1 -1
  253. package/dist/{stylus-En_AvflY.js → stylus-_c5Nsi_J.js} +1 -1
  254. package/dist/{swift-op70jfop.js → swift-BbjLBCUH.js} +1 -1
  255. package/dist/{systemd-BIhllZBm.js → systemd-BWpGYN2X.js} +1 -1
  256. package/dist/{t4-cs-y8E1tncu.js → t4-cs-BTaVfFLQ.js} +1 -1
  257. package/dist/{t4-templating-CgbQ3mCt.js → t4-templating-82z1UN2T.js} +1 -1
  258. package/dist/{t4-vb-CJ9kNxdx.js → t4-vb-D-adDZIp.js} +1 -1
  259. package/dist/{tap-CaQ91rmN.js → tap-CV8Tz8-Q.js} +1 -1
  260. package/dist/{tcl-BldTYyNQ.js → tcl-xlkMOsWf.js} +1 -1
  261. package/dist/{textile--G7GOPtS.js → textile-DurZc3Ra.js} +1 -1
  262. package/dist/textile-DurZc3Ra.js.gz +0 -0
  263. package/dist/{toml-BkfPe9w8.js → toml-UIPggOCe.js} +1 -1
  264. package/dist/{tremor-C-TyFYbH.js → tremor-BjUoq7uy.js} +1 -1
  265. package/dist/{tsx-b257PfLu.js → tsx-WuwvwuJK.js} +1 -1
  266. package/dist/{tt2-B6d6RdTI.js → tt2-CvCpeqD3.js} +1 -1
  267. package/dist/{turtle-BbhjYXqp.js → turtle-CIocO9Z2.js} +1 -1
  268. package/dist/{twig-DVbyhpUh.js → twig-BYothawq.js} +1 -1
  269. package/dist/types/components/CodePlayer/index.d.ts +1 -0
  270. package/dist/types/components/ExampleCard/index.d.ts +1 -0
  271. package/dist/types/components/ExampleTools/ExCodePlayer/index.d.ts +2 -0
  272. package/dist/types/components/ExampleTools/index.d.ts +1 -0
  273. package/dist/types/components/KnowledgeCard/index.d.ts +1 -1
  274. package/dist/{typescript-MykRYuOm.js → typescript-Cf1gbOle.js} +1 -1
  275. package/dist/{typoscript-DHhmsxp4.js → typoscript-DBps8v04.js} +1 -1
  276. package/dist/{unrealscript-Cm4M4gaV.js → unrealscript-BusyY_R6.js} +1 -1
  277. package/dist/{uorazor-ChxbhiM2.js → uorazor-CxAsyTm-.js} +1 -1
  278. package/dist/{uri-BidAgpIY.js → uri-C1Zwadn9.js} +1 -1
  279. package/dist/{v-DIVQQwUj.js → v-ChhnN2cO.js} +1 -1
  280. package/dist/{vala-CU06L6Ou.js → vala-BtooD3Zy.js} +1 -1
  281. package/dist/{vbnet-B06QDldv.js → vbnet-CuacpWGZ.js} +1 -1
  282. package/dist/{velocity-D31MsUMV.js → velocity-Dw2YaFBl.js} +1 -1
  283. package/dist/{verilog-Bcn8FUOI.js → verilog-BhnT_-f6.js} +1 -1
  284. package/dist/{vhdl-iGkOa65N.js → vhdl-B7iNpy7E.js} +1 -1
  285. package/dist/{vim-DEJ2jpIl.js → vim-D2nLzugf.js} +1 -1
  286. package/dist/vim-D2nLzugf.js.gz +0 -0
  287. package/dist/{visual-basic-j3QPoaYD.js → visual-basic-DKgK6MFL.js} +1 -1
  288. package/dist/{warpscript-Qxhi2CTi.js → warpscript-CUocSTw2.js} +1 -1
  289. package/dist/{wasm-COolq7iZ.js → wasm-CSHeg0xx.js} +1 -1
  290. package/dist/{web-idl-D16cFj10.js → web-idl-B2WiLxgN.js} +1 -1
  291. package/dist/{wiki-_tItcYEb.js → wiki-D-z9cBjd.js} +1 -1
  292. package/dist/{wolfram-DYHi_Xlk.js → wolfram-BULZcnTX.js} +1 -1
  293. package/dist/{wren-B2-9UQ7w.js → wren-DVB32t_e.js} +1 -1
  294. package/dist/{xeora-O1srYL2D.js → xeora-D_OhB_Wc.js} +1 -1
  295. package/dist/{xml-doc-BnD69TXI.js → xml-doc-CH0uhWjm.js} +1 -1
  296. package/dist/{xojo-DDmKhpZ8.js → xojo-BG_M2ELX.js} +1 -1
  297. package/dist/{xquery-D-4rLO5f.js → xquery-Cn3VIW06.js} +1 -1
  298. package/dist/{yaml-DjyNVWGx.js → yaml-AyzEOKPE.js} +1 -1
  299. package/dist/{yang-KHsWl3nH.js → yang-DOWenvKA.js} +1 -1
  300. package/dist/{zig-Coq71Nj4.js → zig-CauFne4n.js} +1 -1
  301. package/package.json +1 -1
  302. package/dist/autohotkey-rINFqa2k.js.gz +0 -0
  303. package/dist/cmake-ClwqTS9b.js.gz +0 -0
  304. package/dist/core-sOODCgGc.js.gz +0 -0
  305. package/dist/gherkin-CfV8-qi4.js.gz +0 -0
  306. package/dist/markdown-DufvqFii.js.gz +0 -0
  307. package/dist/mel-BoHlWoIK.js.gz +0 -0
  308. package/dist/opencl-DRPJgMFh.js.gz +0 -0
  309. package/dist/sas-NfMaQml6.js.gz +0 -0
  310. package/dist/sqf-BsGvu0rx.js.gz +0 -0
  311. package/dist/textile--G7GOPtS.js.gz +0 -0
  312. package/dist/vim-DEJ2jpIl.js.gz +0 -0
@@ -225,7 +225,7 @@ var kse=function(){return kse=Object.assign||function(e){for(var t,r=1,n=argumen
225
225
  Copyright (c) 2018 Jed Watson.
226
226
  Licensed under the MIT License (MIT), see
227
227
  http://jedwatson.github.io/classnames
228
- */!function(e){!function(){var t={}.hasOwnProperty;function r(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=i(e,n(r)))}return e}function n(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var n="";for(var o in e)t.call(e,o)&&e[o]&&(n=i(n,o));return n}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):window.classNames=r}()}(classnames);var classnamesExports=classnames.exports;const classNames=getDefaultExportFromCjs(classnamesExports),Show=e=>{const{height:t="300px",value:r,maskTip:n=!1,maskClick:i}=e,o=React.useRef(null),a=React.useRef(null);React.useEffect(()=>(o.current&&l(o.current),()=>{var e;null==(e=a.current)||e.dispose()}),[]);const s=React.useRef(null);React.useEffect(()=>{var e,t;return(null==r?void 0:r.cells)&&(null==(e=a.current)||e.fromJSON(r.cells),null==(t=a.current)||t.centerContent(),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{var e;null==(e=a.current)||e.zoomToFit({maxScale:1,padding:20})},500)),()=>{s.current&&clearTimeout(s.current)}},[r]);const l=e=>{a.current=new Graph({container:e,autoResize:!0,background:{color:"#ffffff"},grid:{visible:!0,size:10,type:"dot",args:{color:"#a0a0a0",thickness:1}},panning:{enabled:!0,modifiers:["ctrl","meta"]},mousewheel:{enabled:!0,zoomAtMousePosition:!0,modifiers:["ctrl","meta"],minScale:.5,maxScale:3},interacting:!1})};return jsxRuntimeExports.jsxs("div",{className:classNames("drawx6","drawx6-show"),style:{height:t},children:[jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%"},children:jsxRuntimeExports.jsx("div",{ref:o,className:"drawx6-container"})}),!!n&&jsxRuntimeExports.jsx("div",{className:"drawx6-show-mask",onClick:i,children:"string"==typeof n&&jsxRuntimeExports.jsxs("div",{className:"drawx6-center drawx6-show-mask-tip",children:[n,jsxRuntimeExports.jsxs("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{d:"M2.00477 7.0309L2.00977 7.0949L2.02377 7.2249C2.12977 7.9959 2.61077 8.2449 4.92477 8.9539L6.42377 9.4079L6.59977 9.4679C6.6472 9.48276 6.69282 9.50289 6.73577 9.5279L6.75177 9.5419L6.77077 9.5659C6.79377 9.6029 6.82377 9.6759 6.87377 9.8329L6.96077 10.1149L7.39277 11.5389L7.55677 12.0599C8.12777 13.8389 8.39877 14.1999 9.13677 14.2799L9.19777 14.2849C10.1658 14.3669 10.4048 13.9549 11.3768 11.2969L13.4548 5.5859L13.6278 5.0929C14.1158 3.6729 14.1238 3.2479 13.6518 2.7489L13.5998 2.6949C13.0028 2.0989 12.5648 2.1669 10.5338 2.9019L4.64877 5.0459L3.98577 5.2959C2.27677 5.9549 1.95477 6.2519 2.00477 7.0309ZM5.11877 6.1719L11.0628 4.0079C12.3268 3.5549 12.6708 3.4909 12.7368 3.5569L12.7488 3.5769L12.7568 3.6069C12.7768 3.7509 12.6618 4.1899 12.2348 5.3749L10.1218 11.1749L9.86377 11.8509C9.49577 12.7919 9.33777 13.0729 9.30177 13.0709L9.28477 13.0509L9.25677 13.0109C9.19758 12.9171 9.14511 12.8192 9.09977 12.7179L9.01777 12.5329L8.96177 12.3959C8.81703 12.0073 8.68595 11.6137 8.56877 11.2159L8.08877 9.6349C7.92877 9.1119 7.83877 8.9049 7.61377 8.6799C7.58752 8.65373 7.56016 8.62871 7.53177 8.6049L7.43677 8.5299C7.28077 8.4159 7.12077 8.3499 6.76877 8.2399L4.72477 7.6159L4.34077 7.4909C4.133 7.42316 3.92815 7.34676 3.72677 7.2619L3.65577 7.2319C3.31577 7.0799 3.22377 6.9949 3.22377 6.9919L3.22877 6.9809L3.24777 6.9639C3.35177 6.8809 3.83277 6.6509 5.11977 6.1719H5.11877Z"}),jsxRuntimeExports.jsx("path",{d:"M7.24609 9.07483L9.69727 6.8866",strokeLinecap:"round"})]})]})})]})},content$4=".x6-widget-dnd {\n position: absolute;\n top: -10000px;\n left: -10000px;\n z-index: 999999;\n display: none;\n cursor: move;\n opacity: 0.7;\n pointer-events: 'cursor';\n}\n.x6-widget-dnd.dragging {\n display: inline-block;\n}\n.x6-widget-dnd.dragging * {\n pointer-events: none !important;\n}\n.x6-widget-dnd .x6-graph {\n background: transparent;\n box-shadow: none;\n}\n";var __decorate$b=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Dnd2;class Dnd extends View{get targetScroller(){return this.options.target.getPlugin("scroller")}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}get snapline(){return this.options.target.getPlugin("snapline")}constructor(e){super(),this.name="dnd",this.options=Object.assign(Object.assign({},Dnd.defaults),e),this.init()}init(){ensure(this.name,content$4),this.container=document.createElement("div"),addClass(this.container,this.prefixClassName("widget-dnd")),this.draggingGraph=new Graph(Object.assign(Object.assign({},this.options.delegateGraphOptions),{container:document.createElement("div"),width:1,height:1,async:!1})),append(this.container,this.draggingGraph.container)}start(e,t){const r=t;r.preventDefault(),this.targetModel.startBatch("dnd"),addClass(this.container,"dragging"),appendTo(this.container,this.options.draggingContainer||document.body),this.sourceNode=e,this.prepareDragging(e,r.clientX,r.clientY);const n=this.updateNodePosition(r.clientX,r.clientY);this.isSnaplineEnabled()&&(this.snapline.captureCursorOffset({e:r,node:e,cell:e,view:this.draggingView,x:n.x,y:n.y}),this.draggingNode.on("change:position",this.snap,this)),this.delegateDocumentEvents(Dnd.documentEvents,r.data)}isSnaplineEnabled(){return this.snapline&&this.snapline.isEnabled()}prepareDragging(e,t,r){const n=this.draggingGraph,i=n.model,o=this.options.getDragNode(e,{sourceNode:e,draggingGraph:n,targetGraph:this.targetGraph});o.position(0,0);let a=5;if(this.isSnaplineEnabled()&&(a+=this.snapline.options.tolerance||0),this.isSnaplineEnabled()||this.options.scaled){const e=this.targetGraph.transform.getScale();n.scale(e.sx,e.sy),a*=Math.max(e.sx,e.sy)}else n.scale(1,1);this.clearDragging(),i.resetCells([o]);const s=n.findViewByCell(o);s.undelegateEvents(),s.cell.off("changed"),n.fitToContent({padding:a,allowNewOrigin:"any",useCellGeometry:!1});const l=s.getBBox();this.geometryBBox=s.getBBox({useCellGeometry:!0}),this.delta=this.geometryBBox.getTopLeft().diff(l.getTopLeft()),this.draggingNode=o,this.draggingView=s,this.draggingBBox=o.getBBox(),this.padding=a,this.originOffset=this.updateGraphPosition(t,r)}updateGraphPosition(e,t){const r=document.body.scrollTop||document.documentElement.scrollTop,n=document.body.scrollLeft||document.documentElement.scrollLeft,i=this.delta,o=this.geometryBBox,a=this.padding||5,s={left:e-i.x-o.width/2-a+n,top:t-i.y-o.height/2-a+r};return this.draggingGraph&&css$3(this.container,{left:`${s.left}px`,top:`${s.top}px`}),s}updateNodePosition(e,t){const r=this.targetGraph.clientToLocal(e,t),n=this.draggingBBox;return r.x-=n.width/2,r.y-=n.height/2,this.draggingNode.position(r.x,r.y),r}snap({cell:e,current:t,options:r}){const n=e;if(r.snapped){const e=this.draggingBBox;n.position(e.x+r.tx,e.y+r.ty,{silent:!0}),this.draggingView.translate(),n.position(t.x,t.y,{silent:!0}),this.snapOffset={x:r.tx,y:r.ty}}else this.snapOffset=null}onDragging(e){const t=this.draggingView;if(t){e.preventDefault();const r=this.normalizeEvent(e),n=r.clientX,i=r.clientY;this.updateGraphPosition(n,i);const o=this.updateNodePosition(n,i),a=this.targetGraph.options.embedding.enabled,s=(a||this.isSnaplineEnabled())&&this.isInsideValidArea({x:n,y:i});if(a){t.setEventData(r,{graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView});const e=t.getEventData(r);s?t.processEmbedding(r,e):t.clearEmbedding(e),this.candidateEmbedView=e.candidateEmbedView}this.isSnaplineEnabled()&&(s?this.snapline.snapOnMoving({e:r,view:t,x:o.x,y:o.y}):this.snapline.hide())}}onDragEnd(e){const t=this.draggingNode;if(t){const r=this.normalizeEvent(e),n=this.draggingView,i=this.draggingBBox,o=this.snapOffset;let a=i.x,s=i.y;o&&(a+=o.x,s+=o.y),t.position(a,s,{silent:!0});const l=this.drop(t,{x:r.clientX,y:r.clientY}),c=e=>{e?(this.onDropped(t),this.targetGraph.options.embedding.enabled&&n&&(n.setEventData(r,{cell:e,graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView}),n.finalizeEmbedding(r,n.getEventData(r)))):this.onDropInvalid(),this.candidateEmbedView=null,this.targetModel.stopBatch("dnd")};isAsync(l)?(this.undelegateDocumentEvents(),l.then(c)):c(l)}}clearDragging(){this.draggingNode&&(this.sourceNode=null,this.draggingNode.remove(),this.draggingNode=null,this.draggingView=null,this.delta=null,this.padding=null,this.snapOffset=null,this.originOffset=null,this.undelegateDocumentEvents())}onDropped(e){this.draggingNode===e&&(this.clearDragging(),removeClass(this.container,"dragging"),remove(this.container))}onDropInvalid(){const e=this.draggingNode;e&&this.onDropped(e)}isInsideValidArea(e){let t,r=null;const n=this.targetGraph,i=this.targetScroller;this.options.dndContainer&&(r=this.getDropArea(this.options.dndContainer));const o=r&&r.containsPoint(e);if(i)if(i.options.autoResize)t=this.getDropArea(i.container);else{const e=this.getDropArea(i.container);t=this.getDropArea(n.container).intersectsWithRect(e)}else t=this.getDropArea(n.container);return!o&&t&&t.containsPoint(e)}getDropArea(e){const t=offset$1(e),r=document.body.scrollTop||document.documentElement.scrollTop,n=document.body.scrollLeft||document.documentElement.scrollLeft;return Rectangle.create({x:t.left+parseInt(css$3(e,"border-left-width"),10)-n,y:t.top+parseInt(css$3(e,"border-top-width"),10)-r,width:e.clientWidth,height:e.clientHeight})}drop(e,t){if(this.isInsideValidArea(t)){const r=this.targetGraph,n=r.model,i=r.clientToLocal(t),o=this.sourceNode,a=this.options.getDropNode(e,{sourceNode:o,draggingNode:e,targetGraph:this.targetGraph,draggingGraph:this.draggingGraph}),s=a.getBBox();i.x+=s.x-s.width/2,i.y+=s.y-s.height/2;const l=this.snapOffset?1:r.getGridSize();a.position(GeometryUtil.snapToGrid(i.x,l),GeometryUtil.snapToGrid(i.y,l)),a.removeZIndex();const c=this.options.validateNode,u=!c||c(a,{sourceNode:o,draggingNode:e,droppingNode:a,targetGraph:r,draggingGraph:this.draggingGraph});return"boolean"==typeof u?u?(n.addCell(a,{stencil:this.cid}),a):null:toDeferredBoolean(u).then(e=>e?(n.addCell(a,{stencil:this.cid}),a):null)}return null}onRemove(){this.draggingGraph&&(this.draggingGraph.view.remove(),this.draggingGraph.dispose())}dispose(){this.remove(),clean(this.name)}}__decorate$b([View.dispose()],Dnd.prototype,"dispose",null),Dnd2=Dnd||(Dnd={}),Dnd2.defaults={getDragNode:e=>e.clone(),getDropNode:e=>e.clone()},Dnd2.documentEvents={mousemove:"onDragging",touchmove:"onDragging",mouseup:"onDragEnd",touchend:"onDragEnd",touchcancel:"onDragEnd"},Graph.prototype.toSVG=function(e,t){const r=this.getPlugin("export");r&&r.toSVG(e,t)},Graph.prototype.toPNG=function(e,t){const r=this.getPlugin("export");r&&r.toPNG(e,t)},Graph.prototype.toJPEG=function(e,t){const r=this.getPlugin("export");r&&r.toJPEG(e,t)},Graph.prototype.exportPNG=function(e,t){const r=this.getPlugin("export");r&&r.exportPNG(e,t)},Graph.prototype.exportJPEG=function(e,t){const r=this.getPlugin("export");r&&r.exportJPEG(e,t)},Graph.prototype.exportSVG=function(e,t){const r=this.getPlugin("export");r&&r.exportSVG(e,t)};var __decorate$a=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class Export extends Basecoat{constructor(){super(),this.name="export"}get view(){return this.graph.view}init(e){this.graph=e}exportPNG(e="chart",t={}){this.toPNG(t=>{DataUri.downloadDataUri(t,e)},t)}exportJPEG(e="chart",t={}){this.toPNG(t=>{DataUri.downloadDataUri(t,e)},t)}exportSVG(e="chart",t={}){this.toSVG(t=>{DataUri.downloadDataUri(DataUri.svgToDataUrl(t),e)},t)}toSVG(e,t={}){this.notify("before:export",t);const r=this.view.svg,n=Vector.create(r).clone();let i=n.node;const o=n.findOne(`.${this.view.prefixClassName("graph-svg-stage")}`),a=t.viewBox||this.graph.graphToLocal(this.graph.getContentBBox()),s=t.preserveDimensions;if(s){const e="boolean"==typeof s?a:s;n.attr({width:e.width,height:e.height})}if(n.removeAttribute("style").attr("viewBox",[a.x,a.y,a.width,a.height].join(" ")),o.removeAttribute("transform"),!1!==t.copyStyles){const e=r.ownerDocument,t=Array.from(r.querySelectorAll("*")),n=Array.from(i.querySelectorAll("*")),o=e.styleSheets.length,a=[];for(let r=o-1;r>=0;r-=1)a[r]=e.styleSheets[r],e.styleSheets[r].disabled=!0;const s={};t.forEach((e,t)=>{const r=window.getComputedStyle(e,null),n={};Object.keys(r).forEach(e=>{n[e]=r.getPropertyValue(e)}),s[t]=n}),o!==e.styleSheets.length&&a.forEach((t,r)=>{e.styleSheets[r]=t});for(let r=0;r<o;r+=1)e.styleSheets[r].disabled=!1;const l={};t.forEach((e,t)=>{const r=window.getComputedStyle(e,null),n=s[t],i={};Object.keys(r).forEach(e=>{isNumber(e)||r.getPropertyValue(e)===n[e]||(i[e]=r.getPropertyValue(e))}),l[t]=i}),n.forEach((e,t)=>{css$3(e,l[t])})}const l=t.stylesheet;if("string"==typeof l){const e=r.ownerDocument.implementation.createDocument(null,"xml",null).createCDATASection(l);n.prepend(Vector.create("style",{type:"text/css"},[e]))}const c=()=>{const r=t.beforeSerialize;if("function"==typeof r){const e=call$1(r,this.graph,i);e instanceof SVGSVGElement&&(i=e)}const n=(new XMLSerializer).serializeToString(i).replace(/&nbsp;/g," ");this.notify("after:export",t),e(n)};if(t.serializeImages){const e=n.find("image").map(e=>new Promise(t=>{const r=e.attr("xlink:href")||e.attr("href");DataUri.imageToDataUri(r,(r,n)=>{!r&&n&&e.attr("xlink:href",n),t()})}));Promise.all(e).then(c)}else c()}toDataURL(e,t){let r=t.viewBox||this.graph.getContentBBox();const n=normalizeSides(t.padding);t.width&&t.height&&(n.left+n.right>=t.width&&(n.left=n.right=0),n.top+n.bottom>=t.height&&(n.top=n.bottom=0));const i=new Rectangle(-n.left,-n.top,n.left+n.right,n.top+n.bottom);if(t.width&&t.height){const e=r.width+n.left+n.right,o=r.height+n.top+n.bottom;i.scale(e/t.width,o/t.height)}r=Rectangle.create(r).moveAndExpand(i);const o="number"==typeof t.width&&"number"==typeof t.height?{width:t.width,height:t.height}:r;let a=t.ratio?parseFloat(t.ratio):1;Number.isFinite(a)&&0!==a||(a=1);const s={width:Math.max(Math.round(o.width*a),1),height:Math.max(Math.round(o.height*a),1)};{const e=document.createElement("canvas"),t=e.getContext("2d");e.width=s.width,e.height=s.height;const r=s.width-1,n=s.height-1;t.fillStyle="rgb(1,1,1)",t.fillRect(r,n,1,1);const i=t.getImageData(r,n,1,1).data;if(1!==i[0]||1!==i[1]||1!==i[2])throw new Error("size exceeded")}const l=new Image;l.onload=()=>{const r=document.createElement("canvas");r.width=s.width,r.height=s.height;const n=r.getContext("2d");n.fillStyle=t.backgroundColor||"white",n.fillRect(0,0,s.width,s.height);try{n.drawImage(l,0,0,s.width,s.height);const i=r.toDataURL(t.type,t.quality);e(i)}catch(i){}},this.toSVG(e=>{l.src=`data:image/svg+xml,${encodeURIComponent(e)}`},Object.assign(Object.assign({},t),{viewBox:r,serializeImages:!0,preserveDimensions:Object.assign({},s)}))}toPNG(e,t={}){this.toDataURL(e,Object.assign(Object.assign({},t),{type:"image/png"}))}toJPEG(e,t={}){this.toDataURL(e,Object.assign(Object.assign({},t),{type:"image/jpeg"}))}notify(e,t){this.trigger(e,t),this.graph.trigger(e,t)}dispose(){this.off()}}__decorate$a([Basecoat.dispose()],Export.prototype,"dispose",null);var __decorate$9=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Private$1;class TransformImpl extends View{get model(){return this.graph.model}get view(){return this.graph.renderer.findViewByCell(this.node)}get containerClassName(){return this.prefixClassName("widget-transform")}get resizeClassName(){return`${this.containerClassName}-resize`}get rotateClassName(){return`${this.containerClassName}-rotate`}constructor(e,t,r){super(),this.node=t,this.graph=r,this.options=Object.assign(Object.assign({},Private$1.defaultOptions),e),this.render(),this.startListening()}startListening(){this.delegateEvents({[`mousedown .${this.resizeClassName}`]:"startResizing",[`touchstart .${this.resizeClassName}`]:"startResizing",[`mousedown .${this.rotateClassName}`]:"startRotating",[`touchstart .${this.rotateClassName}`]:"startRotating"}),this.model.on("*",this.update,this),this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this),this.node.on("removed",this.remove,this),this.model.on("reseted",this.remove,this),this.view.on("cell:knob:mousedown",this.onKnobMouseDown,this),this.view.on("cell:knob:mouseup",this.onKnobMouseUp,this)}stopListening(){this.undelegateEvents(),this.model.off("*",this.update,this),this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this),this.node.off("removed",this.remove,this),this.model.off("reseted",this.remove,this),this.view.off("cell:knob:mousedown",this.onKnobMouseDown,this),this.view.off("cell:knob:mouseup",this.onKnobMouseUp,this)}renderHandles(){this.container=document.createElement("div");const e=document.createElement("div");attr(e,"draggable","false");const t=e.cloneNode(!0);addClass(t,this.rotateClassName);const r=Private$1.POSITIONS.map(t=>{const r=e.cloneNode(!0);return addClass(r,this.resizeClassName),attr(r,"data-position",t),r});this.empty(),append(this.container,[...r,t])}render(){return this.renderHandles(),this.view&&this.view.addClass(Private$1.NODE_CLS),addClass(this.container,this.containerClassName),toggleClass(this.container,"no-orth-resize",this.options.preserveAspectRatio||!this.options.orthogonalResizing),toggleClass(this.container,"no-resize",!this.options.resizable),toggleClass(this.container,"no-rotate",!this.options.rotatable),this.options.className&&addClass(this.container,this.options.className),this.graph.container.appendChild(this.container),this.update()}update(){const e=this.graph.matrix(),t=this.node.getBBox();t.x*=e.a,t.x+=e.e,t.y*=e.d,t.y+=e.f,t.width*=e.a,t.height*=e.d;const r=Angle.normalize(this.node.getAngle()),n=0!==r?`rotate(${r}deg)`:"";return css$3(this.container,{transform:n,width:t.width,height:t.height,left:t.x,top:t.y}),this.updateResizerDirections(),this}remove(){return this.view&&this.view.removeClass(Private$1.NODE_CLS),super.remove()}onKnobMouseDown(){this.startHandle()}onKnobMouseUp(){this.stopHandle()}updateResizerDirections(){const e=Angle.normalize(this.node.getAngle()),t=Math.floor(e*(Private$1.DIRECTIONS.length/360));if(t!==this.prevShift){const e=Private$1.DIRECTIONS.slice(t).concat(Private$1.DIRECTIONS.slice(0,t)),r=e=>`${this.containerClassName}-cursor-${e}`;this.container.querySelectorAll(`.${this.resizeClassName}`).forEach((t,n)=>{removeClass(t,Private$1.DIRECTIONS.map(e=>r(e)).join(" ")),addClass(t,r(e[n]))}),this.prevShift=t}}getTrueDirection(e){const t=Angle.normalize(this.node.getAngle());let r=Private$1.POSITIONS.indexOf(e);return r+=Math.floor(t*(Private$1.POSITIONS.length/360)),r%=Private$1.POSITIONS.length,Private$1.POSITIONS[r]}toValidResizeDirection(e){return{top:"top-left",bottom:"bottom-right",left:"bottom-left",right:"top-right"}[e]||e}startResizing(e){e.stopPropagation(),this.model.startBatch("resize",{cid:this.cid});const t=attr(e.target,"data-position");this.prepareResizing(e,t),this.startAction(e)}prepareResizing(e,t){const r=this.getTrueDirection(t);let n=0,i=0;t.split("-").forEach(e=>{n={left:-1,right:1}[e]||n,i={top:-1,bottom:1}[e]||i});const o=this.toValidResizeDirection(t),a={"top-right":"bottomLeft","top-left":"bottomRight","bottom-left":"topRight","bottom-right":"topLeft"}[o],s=Angle.normalize(this.node.getAngle());this.setEventData(e,{selector:a,direction:o,trueDirection:r,relativeDirection:t,angle:s,resizeX:n,resizeY:i,action:"resizing"})}startRotating(e){e.stopPropagation(),this.model.startBatch("rotate",{cid:this.cid});const t=this.node.getBBox().getCenter(),r=this.normalizeEvent(e),n=this.graph.snapToGrid(r.clientX,r.clientY);this.setEventData(e,{center:t,action:"rotating",angle:Angle.normalize(this.node.getAngle()),start:Point.create(n).theta(t)}),this.startAction(e)}onMouseMove(e){const t=this.graph.findViewByCell(this.node);let r=this.getEventData(e);if(r.action){const n=this.normalizeEvent(e);let i=n.clientX,o=n.clientY;const a=this.graph.getPlugin("scroller"),s=this.options.restrictedResizing;if(!0===s||"number"==typeof s){const e=!0===s?0:s,t=a?Math.max(e,8):e,r=this.graph.container.getBoundingClientRect();i=clamp(i,r.left+t,r.right-t),o=clamp(o,r.top+t,r.bottom-t)}else this.options.autoScrollOnResizing&&a&&a.autoScroll(i,o);const l=this.graph.snapToGrid(i,o),c=this.graph.getGridSize(),u=this.node,d=this.options;if("resizing"===r.action){r.resized||(t&&(t.addClass("node-resizing"),this.notify("node:resize",e,t)),r.resized=!0);const n=u.getBBox(),i=Point.create(l).rotate(r.angle,n.getCenter()).diff(n[r.selector]);let o=r.resizeX?i.x*r.resizeX:n.width,a=r.resizeY?i.y*r.resizeY:n.height;const s=o,p=a;if(o=GeometryUtil.snapToGrid(o,c),a=GeometryUtil.snapToGrid(a,c),o=Math.max(o,d.minWidth||c),a=Math.max(a,d.minHeight||c),o=Math.min(o,d.maxWidth||1/0),a=Math.min(a,d.maxHeight||1/0),d.preserveAspectRatio){const e=n.width*a/n.height,t=n.height*o/n.width;o<e?a=t:o=e}const h=r.relativeDirection;if(d.allowReverse&&(s<=-o||p<=-a)){let t;"left"===h?s<=-o&&(t="right"):"right"===h?s<=-o&&(t="left"):"top"===h?p<=-a&&(t="bottom"):"bottom"===h?p<=-a&&(t="top"):"top-left"===h?s<=-o&&p<=-a?t="bottom-right":s<=-o?t="top-right":p<=-a&&(t="bottom-left"):"top-right"===h?s<=-o&&p<=-a?t="bottom-left":s<=-o?t="top-left":p<=-a&&(t="bottom-right"):"bottom-left"===h?s<=-o&&p<=-a?t="top-right":s<=-o?t="bottom-right":p<=-a&&(t="top-left"):"bottom-right"===h&&(s<=-o&&p<=-a?t="top-left":s<=-o?t="bottom-left":p<=-a&&(t="top-right"));const r=t;this.stopHandle();const n=this.container.querySelector(`.${this.resizeClassName}[data-position="${r}"]`);this.startHandle(n),this.prepareResizing(e,r),this.onMouseMove(e)}if(n.width!==o||n.height!==a){const n={ui:!0,direction:r.direction,relativeDirection:r.relativeDirection,trueDirection:r.trueDirection,minWidth:d.minWidth,minHeight:d.minHeight,maxWidth:d.maxWidth,maxHeight:d.maxHeight,preserveAspectRatio:!0===d.preserveAspectRatio};u.resize(o,a,n),this.notify("node:resizing",e,t)}}else if("rotating"===r.action){r.rotated||(t&&(t.addClass("node-rotating"),this.notify("node:rotate",e,t)),r.rotated=!0);const n=u.getAngle(),i=r.start-Point.create(l).theta(r.center);let o=r.angle+i;d.rotateGrid&&(o=GeometryUtil.snapToGrid(o,d.rotateGrid)),o=Angle.normalize(o),n!==o&&(u.rotate(o,{absolute:!0}),this.notify("node:rotating",e,t))}}}onMouseUp(e){const t=this.getEventData(e);t.action&&(this.stopAction(e),this.model.stopBatch("resizing"===t.action?"resize":"rotate",{cid:this.cid}))}startHandle(e){if(this.handle=e||null,addClass(this.container,`${this.containerClassName}-active`),e){addClass(e,`${this.containerClassName}-active-handle`);const t=e.getAttribute("data-position");if(t){const e=Private$1.DIRECTIONS[Private$1.POSITIONS.indexOf(t)];addClass(this.container,`${this.containerClassName}-cursor-${e}`)}}}stopHandle(){if(removeClass(this.container,`${this.containerClassName}-active`),this.handle){removeClass(this.handle,`${this.containerClassName}-active-handle`);const e=this.handle.getAttribute("data-position");if(e){const t=Private$1.DIRECTIONS[Private$1.POSITIONS.indexOf(e)];removeClass(this.container,`${this.containerClassName}-cursor-${t}`)}this.handle=null}}startAction(e){this.startHandle(e.target),this.graph.view.undelegateEvents(),this.delegateDocumentEvents(Private$1.documentEvents,e.data)}stopAction(e){this.stopHandle(),this.undelegateDocumentEvents(),this.graph.view.delegateEvents();const t=this.graph.findViewByCell(this.node),r=this.getEventData(e);t&&(t.removeClass(`node-${r.action}`),"resizing"===r.action&&r.resized?this.notify("node:resized",e,t):"rotating"===r.action&&r.rotated&&this.notify("node:rotated",e,t))}notify(e,t,r,n={}){if(r){const i=r.graph,o=i.view.normalizeEvent(t),a=i.snapToGrid(o.clientX,o.clientY);this.trigger(e,Object.assign({e:o,view:r,node:r.cell,cell:r.cell,x:a.x,y:a.y},n))}}dispose(){this.stopListening(),this.remove(),this.off()}}__decorate$9([View.dispose()],TransformImpl.prototype,"dispose",null),function(e){e.NODE_CLS="has-widget-transform",e.DIRECTIONS=["nw","n","ne","e","se","s","sw","w"],e.POSITIONS=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],e.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp"},e.defaultOptions={minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,rotateGrid:15,rotatable:!0,preserveAspectRatio:!1,orthogonalResizing:!0,restrictedResizing:!1,autoScrollOnResizing:!0,allowReverse:!0}}(Private$1||(Private$1={}));const content$3=".x6-widget-transform {\n position: absolute;\n box-sizing: content-box !important;\n margin: -5px 0 0 -5px;\n padding: 4px;\n border: 1px dashed #000;\n border-radius: 5px;\n user-select: none;\n pointer-events: none;\n}\n.x6-widget-transform > div {\n position: absolute;\n box-sizing: border-box;\n background-color: #fff;\n border: 1px solid #000;\n transition: background-color 0.2s;\n pointer-events: auto;\n -webkit-user-drag: none;\n user-drag: none;\n /* stylelint-disable-line */\n}\n.x6-widget-transform > div:hover {\n background-color: #d3d3d3;\n}\n.x6-widget-transform-cursor-n {\n cursor: n-resize;\n}\n.x6-widget-transform-cursor-s {\n cursor: s-resize;\n}\n.x6-widget-transform-cursor-e {\n cursor: e-resize;\n}\n.x6-widget-transform-cursor-w {\n cursor: w-resize;\n}\n.x6-widget-transform-cursor-ne {\n cursor: ne-resize;\n}\n.x6-widget-transform-cursor-nw {\n cursor: nw-resize;\n}\n.x6-widget-transform-cursor-se {\n cursor: se-resize;\n}\n.x6-widget-transform-cursor-sw {\n cursor: sw-resize;\n}\n.x6-widget-transform-resize {\n width: 10px;\n height: 10px;\n border-radius: 6px;\n}\n.x6-widget-transform-resize[data-position='top-left'] {\n top: -5px;\n left: -5px;\n}\n.x6-widget-transform-resize[data-position='top-right'] {\n top: -5px;\n right: -5px;\n}\n.x6-widget-transform-resize[data-position='bottom-left'] {\n bottom: -5px;\n left: -5px;\n}\n.x6-widget-transform-resize[data-position='bottom-right'] {\n right: -5px;\n bottom: -5px;\n}\n.x6-widget-transform-resize[data-position='top'] {\n top: -5px;\n left: 50%;\n margin-left: -5px;\n}\n.x6-widget-transform-resize[data-position='bottom'] {\n bottom: -5px;\n left: 50%;\n margin-left: -5px;\n}\n.x6-widget-transform-resize[data-position='left'] {\n top: 50%;\n left: -5px;\n margin-top: -5px;\n}\n.x6-widget-transform-resize[data-position='right'] {\n top: 50%;\n right: -5px;\n margin-top: -5px;\n}\n.x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='top'],\n.x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='bottom'],\n.x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='left'],\n.x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='right'] {\n display: none;\n}\n.x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='bottom'],\n.x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='left'],\n.x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='right'],\n.x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='top'] {\n display: none;\n}\n.x6-widget-transform.no-resize .x6-widget-transform-resize {\n display: none;\n}\n.x6-widget-transform-rotate {\n top: -20px;\n left: -20px;\n width: 12px;\n height: 12px;\n border-radius: 6px;\n cursor: crosshair;\n}\n.x6-widget-transform.no-rotate .x6-widget-transform-rotate {\n display: none;\n}\n.x6-widget-transform-active {\n border-color: transparent;\n pointer-events: all;\n}\n.x6-widget-transform-active > div {\n display: none;\n}\n.x6-widget-transform-active > .x6-widget-transform-active-handle {\n display: block;\n background-color: #808080;\n}\n";Graph.prototype.createTransformWidget=function(e){const t=this.getPlugin("transform");return t&&t.createWidget(e),this},Graph.prototype.clearTransformWidgets=function(){const e=this.getPlugin("transform");return e&&e.clearWidgets(),this};var __decorate$8=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Transform2;class Transform extends Basecoat{constructor(e={}){super(),this.name="transform",this.widgets=new Map,this.disabled=!1,this.options=e,ensure(this.name,content$3)}init(e){this.graph=e,this.disabled||this.startListening()}startListening(){this.graph.on("node:click",this.onNodeClick,this),this.graph.on("blank:mousedown",this.onBlankMouseDown,this)}stopListening(){this.graph.off("node:click",this.onNodeClick,this),this.graph.off("blank:mousedown",this.onBlankMouseDown,this)}enable(){this.disabled&&(this.disabled=!1,this.startListening())}disable(){this.disabled||(this.disabled=!0,this.stopListening())}isEnabled(){return!this.disabled}createWidget(e){this.clearWidgets();const t=this.createTransform(e);t&&(this.widgets.set(e,t),t.on("*",(e,t)=>{this.trigger(e,t),this.graph.trigger(e,t)}))}onNodeClick({node:e}){this.createWidget(e)}onBlankMouseDown(){this.clearWidgets()}createTransform(e){const t=this.getTransformOptions(e);return t.resizable||t.rotatable?new TransformImpl(t,e,this.graph):null}getTransformOptions(e){this.options.resizing||(this.options.resizing={enabled:!1}),this.options.rotating||(this.options.rotating={enabled:!1}),"boolean"==typeof this.options.resizing&&(this.options.resizing={enabled:this.options.resizing}),"boolean"==typeof this.options.rotating&&(this.options.rotating={enabled:this.options.rotating});const t=Transform.parseOptionGroup(this.graph,e,this.options.resizing),r=Transform.parseOptionGroup(this.graph,e,this.options.rotating);return{resizable:!!t.enabled,minWidth:t.minWidth||0,maxWidth:t.maxWidth||Number.MAX_SAFE_INTEGER,minHeight:t.minHeight||0,maxHeight:t.maxHeight||Number.MAX_SAFE_INTEGER,orthogonalResizing:"boolean"!=typeof t.orthogonal||t.orthogonal,restrictedResizing:!!t.restrict,autoScrollOnResizing:"boolean"!=typeof t.autoScroll||t.autoScroll,preserveAspectRatio:!!t.preserveAspectRatio,allowReverse:"boolean"!=typeof t.allowReverse||t.allowReverse,rotatable:!!r.enabled,rotateGrid:r.grid||15}}clearWidgets(){this.widgets.forEach((e,t)=>{this.graph.getCellById(t.id)&&e.dispose()}),this.widgets.clear()}dispose(){this.clearWidgets(),this.stopListening(),this.off(),clean(this.name)}}__decorate$8([Basecoat.dispose()],Transform.prototype,"dispose",null),Transform2=Transform||(Transform={}),Transform2.parseOptionGroup=function(e,t,r){const n={};return Object.keys(r||{}).forEach(i=>{const o=r[i];n[i]="function"==typeof o?o.call(e,t):o}),n};var mousetrap={exports:{}};!function(e){!function(t,r){if(t){for(var n,i={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},o={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},s={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},l=1;l<20;++l)i[111+l]="f"+l;for(l=0;l<=9;++l)i[l+96]=l.toString();m.prototype.bind=function(e,t,r){var n=this;return e=e instanceof Array?e:[e],n._bindMultiple.call(n,e,t,r),n},m.prototype.unbind=function(e,t){return this.bind.call(this,e,function(){},t)},m.prototype.trigger=function(e,t){var r=this;return r._directMap[e+":"+t]&&r._directMap[e+":"+t]({},e),r},m.prototype.reset=function(){var e=this;return e._callbacks={},e._directMap={},e},m.prototype.stopCallback=function(e,t){if((" "+t.className+" ").indexOf(" mousetrap ")>-1)return!1;if(g(t,this.target))return!1;if("composedPath"in e&&"function"==typeof e.composedPath){var r=e.composedPath()[0];r!==e.target&&(t=r)}return"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable},m.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},m.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);n=null},m.init=function(){var e=m(r);for(var t in e)"_"!==t.charAt(0)&&(m[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},m.init(),t.Mousetrap=m,e.exports&&(e.exports=m)}function c(e,t,r){e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent("on"+t,r)}function u(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return i[e.which]?i[e.which]:o[e.which]?o[e.which]:String.fromCharCode(e.which).toLowerCase()}function d(e,t){return e.sort().join(",")===t.sort().join(",")}function p(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function h(e,t,r){return r||(r=function(){if(!n)for(var e in n={},i)e>95&&e<112||i.hasOwnProperty(e)&&(n[i[e]]=e);return n}()[e]?"keydown":"keypress"),"keypress"==r&&t.length&&(r="keydown"),r}function f(e,t){var r,n,i,o=[];for(r=function(e){return"+"===e?["+"]:(e=e.replace(/\+{2}/g,"+plus")).split("+")}(e),i=0;i<r.length;++i)n=r[i],s[n]&&(n=s[n]),t&&"keypress"!=t&&a[n]&&(n=a[n],o.push("shift")),p(n)&&o.push(n);return{key:n,modifiers:o,action:t=h(n,o,t)}}function g(e,t){return null!==e&&e!==r&&(e===t||g(e.parentNode,t))}function m(e){var t=this;if(e=e||r,!(t instanceof m))return new m(e);t.target=e,t._callbacks={},t._directMap={};var n,i={},o=!1,a=!1,s=!1;function l(e){e=e||{};var t,r=!1;for(t in i)e[t]?r=!0:i[t]=0;r||(s=!1)}function h(e,r,n,o,a,s){var l,c,u=[],h=n.type;if(!t._callbacks[e])return[];for("keyup"==h&&p(e)&&(r=[e]),l=0;l<t._callbacks[e].length;++l)if(c=t._callbacks[e][l],(o||!c.seq||i[c.seq]==c.level)&&h==c.action&&("keypress"==h&&!n.metaKey&&!n.ctrlKey||d(r,c.modifiers))){var f=!o&&c.combo==a,g=o&&c.seq==o&&c.level==s;(f||g)&&t._callbacks[e].splice(l,1),u.push(c)}return u}function g(e,r,n,i){t.stopCallback(r,r.target||r.srcElement,n,i)||!1===e(r,n)&&(function(e){e.preventDefault?e.preventDefault():e.returnValue=!1}(r),function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}(r))}function v(e){"number"!=typeof e.which&&(e.which=e.keyCode);var r=u(e);r&&("keyup"!=e.type||o!==r?t.handleKey(r,function(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}(e),e):o=!1)}function y(e,t,r,a){function c(t){return function(){s=t,++i[e],clearTimeout(n),n=setTimeout(l,1e3)}}function d(t){g(r,t,e),"keyup"!==a&&(o=u(t)),setTimeout(l,10)}i[e]=0;for(var p=0;p<t.length;++p){var h=p+1===t.length?d:c(a||f(t[p+1]).action);b(t[p],h,a,e,p)}}function b(e,r,n,i,o){t._directMap[e+":"+n]=r;var a,s=(e=e.replace(/\s+/g," ")).split(" ");s.length>1?y(e,s,r,n):(a=f(e,n),t._callbacks[a.key]=t._callbacks[a.key]||[],h(a.key,a.modifiers,{type:a.action},i,e,o),t._callbacks[a.key][i?"unshift":"push"]({callback:r,modifiers:a.modifiers,action:a.action,seq:i,level:o,combo:e}))}t._handleKey=function(e,t,r){var n,i=h(e,t,r),o={},c=0,u=!1;for(n=0;n<i.length;++n)i[n].seq&&(c=Math.max(c,i[n].level));for(n=0;n<i.length;++n)if(i[n].seq){if(i[n].level!=c)continue;u=!0,o[i[n].seq]=1,g(i[n].callback,r,i[n].combo,i[n].seq)}else u||g(i[n].callback,r,i[n].combo);var d="keypress"==r.type&&a;r.type!=s||p(e)||d||l(o),a=u&&"keydown"==r.type},t._bindMultiple=function(e,t,r){for(var n=0;n<e.length;++n)b(e[n],t,r)},c(e,"keypress",v),c(e,"keydown",v),c(e,"keyup",v)}}("undefined"!=typeof window?window:null,"undefined"!=typeof window?document:null)}(mousetrap);var mousetrapExports=mousetrap.exports;const Mousetrap=getDefaultExportFromCjs(mousetrapExports);var __decorate$7=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},KeyboardImpl2;class KeyboardImpl extends Disposable{get graph(){return this.options.graph}constructor(e){super(),this.options=e;const t=this.graph.getPlugin("scroller");this.container=t?t.container:this.graph.container,e.global?this.target=document:(this.target=this.container,this.disabled||this.target.setAttribute("tabindex","-1"),this.graph.on("cell:mouseup",this.focus,this),this.graph.on("blank:mouseup",this.focus,this)),this.mousetrap=KeyboardImpl.createMousetrap(this)}get disabled(){return!0!==this.options.enabled}enable(){this.disabled&&(this.options.enabled=!0,this.target instanceof HTMLElement&&this.target.setAttribute("tabindex","-1"))}disable(){this.disabled||(this.options.enabled=!1,this.target instanceof HTMLElement&&this.target.removeAttribute("tabindex"))}on(e,t,r){this.mousetrap.bind(this.getKeys(e),t,r)}off(e,t){this.mousetrap.unbind(this.getKeys(e),t)}clear(){this.mousetrap.reset()}trigger(e,t){this.mousetrap.trigger(e,t)}focus(e){if(this.isInputEvent(e.e))return;this.target.focus({preventScroll:!0})}getKeys(e){return(Array.isArray(e)?e:[e]).map(e=>this.formatkey(e))}formatkey(e){const t=e.toLocaleLowerCase().replace(/\s/g,"").replace("delete","del").replace("cmd","command").replace("arrowup","up").replace("arrowright","right").replace("arrowdown","down").replace("arrowleft","left"),r=this.options.format;return r?call$1(r,this.graph,t):t}isGraphEvent(e){const t=e.target,r=e.currentTarget;return!!t&&(t===this.target||r===this.target||t===document.body||contains(this.container,t))}isInputEvent(e){var t;const r=e.target,n=null===(t=null==r?void 0:r.tagName)||void 0===t?void 0:t.toLowerCase();let i=["input","textarea"].includes(n);return"true"===attr(r,"contenteditable")&&(i=!0),i}isEnabledForEvent(e){const t=!this.disabled&&this.isGraphEvent(e),r=this.isInputEvent(e);if(t){if(r&&("Backspace"===e.key||"Delete"===e.key))return!1;if(this.options.guard)return call$1(this.options.guard,this.graph,e)}return t}dispose(){this.mousetrap.reset()}}__decorate$7([Disposable.dispose()],KeyboardImpl.prototype,"dispose",null),KeyboardImpl2=KeyboardImpl||(KeyboardImpl={}),KeyboardImpl2.createMousetrap=function(e){const t=new Mousetrap(e.target),r=t.stopCallback;return t.stopCallback=(n,i,o)=>!e.isEnabledForEvent(n)||!!r&&r.call(t,n,i,o),t},Graph.prototype.isKeyboardEnabled=function(){const e=this.getPlugin("keyboard");return!!e&&e.isEnabled()},Graph.prototype.enableKeyboard=function(){const e=this.getPlugin("keyboard");return e&&e.enable(),this},Graph.prototype.disableKeyboard=function(){const e=this.getPlugin("keyboard");return e&&e.disable(),this},Graph.prototype.toggleKeyboard=function(e){const t=this.getPlugin("keyboard");return t&&t.toggleEnabled(e),this},Graph.prototype.bindKey=function(e,t,r){const n=this.getPlugin("keyboard");return n&&n.bindKey(e,t,r),this},Graph.prototype.unbindKey=function(e,t){const r=this.getPlugin("keyboard");return r&&r.unbindKey(e,t),this},Graph.prototype.clearKeys=function(){const e=this.getPlugin("keyboard");return e&&e.clear(),this},Graph.prototype.triggerKey=function(e,t){const r=this.getPlugin("keyboard");return r&&r.trigger(e,t),this};var __decorate$6=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Storage;class Keyboard extends Disposable{constructor(e={}){super(),this.name="keyboard",this.options=Object.assign({enabled:!0},e)}init(e){this.keyboardImpl=new KeyboardImpl(Object.assign(Object.assign({},this.options),{graph:e}))}isEnabled(){return!this.keyboardImpl.disabled}enable(){this.keyboardImpl.enable()}disable(){this.keyboardImpl.disable()}toggleEnabled(e){return null!=e?e!==this.isEnabled()&&(e?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}bindKey(e,t,r){return this.keyboardImpl.on(e,t,r),this}trigger(e,t){return this.keyboardImpl.trigger(e,t),this}clear(){return this.keyboardImpl.clear(),this}unbindKey(e,t){return this.keyboardImpl.off(e,t),this}dispose(){this.keyboardImpl.dispose()}}__decorate$6([Disposable.dispose()],Keyboard.prototype,"dispose",null);class ClipboardImpl{constructor(){this.cells=[]}copy(e,t,r={}){this.options=Object.assign({},r);const n=(Model.isModel(t)?t:t.model).cloneSubGraph(e,r);this.cells=sortBy(Object.keys(n).map(e=>n[e]),e=>e.isEdge()?2:1),this.serialize(r)}cut(e,t,r={}){this.copy(e,t,r);(Graph.isGraph(t)?t.model:t).batchUpdate("cut",()=>{e.forEach(e=>e.remove())})}paste(e,t={}){const r=Object.assign(Object.assign({},this.options),t),{offset:n,edgeProps:i,nodeProps:o}=r;let a=20,s=20;n&&(a="number"==typeof n?n:n.dx,s="number"==typeof n?n:n.dy),this.deserialize(r);const l=this.cells;l.forEach(e=>{e.model=null,e.removeProp("zIndex"),(a||s)&&e.translate(a,s),o&&e.isNode()&&e.prop(o),i&&e.isEdge()&&e.prop(i)});const c=Graph.isGraph(e)?e.model:e;return c.batchUpdate("paste",()=>{c.addCells(this.cells)}),this.copy(l,e,t),l}serialize(e){!1!==e.useLocalStorage&&Storage.save(this.cells)}deserialize(e){if(e.useLocalStorage){const e=Storage.fetch();e&&(this.cells=e)}}isEmpty(e={}){return e.useLocalStorage&&this.deserialize(e),this.cells.length<=0}clean(){this.options={},this.cells=[],Storage.clean()}}!function(e){const t=`${Config.prefixCls}.clipboard.cells`;e.save=function(e){if(window.localStorage){const r=e.map(e=>e.toJSON());localStorage.setItem(t,JSON.stringify(r))}},e.fetch=function(){if(window.localStorage){const e=localStorage.getItem(t),r=e?JSON.parse(e):[];if(r)return Model.fromJSON(r)}},e.clean=function(){window.localStorage&&localStorage.removeItem(t)}}(Storage||(Storage={})),Graph.prototype.isClipboardEnabled=function(){const e=this.getPlugin("clipboard");return!!e&&e.isEnabled()},Graph.prototype.enableClipboard=function(){const e=this.getPlugin("clipboard");return e&&e.enable(),this},Graph.prototype.disableClipboard=function(){const e=this.getPlugin("clipboard");return e&&e.disable(),this},Graph.prototype.toggleClipboard=function(e){const t=this.getPlugin("clipboard");return t&&t.toggleEnabled(e),this},Graph.prototype.isClipboardEmpty=function(e){const t=this.getPlugin("clipboard");return!t||t.isEmpty(e)},Graph.prototype.getCellsInClipboard=function(){const e=this.getPlugin("clipboard");return e?e.getCellsInClipboard():[]},Graph.prototype.cleanClipboard=function(){const e=this.getPlugin("clipboard");return e&&e.clean(),this},Graph.prototype.copy=function(e,t){const r=this.getPlugin("clipboard");return r&&r.copy(e,t),this},Graph.prototype.cut=function(e,t){const r=this.getPlugin("clipboard");return r&&r.cut(e,t),this},Graph.prototype.paste=function(e,t){const r=this.getPlugin("clipboard");return r?r.paste(e,t):[]};var __decorate$5=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},__rest$1=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};class Clipboard extends Basecoat{get disabled(){return!0!==this.options.enabled}get cells(){return this.clipboardImpl.cells}constructor(e={}){super(),this.name="clipboard",this.options=Object.assign({enabled:!0},e)}init(e){this.graph=e,this.clipboardImpl=new ClipboardImpl,this.clipboardImpl.deserialize(this.options)}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(e){return null!=e?e!==this.isEnabled()&&(e?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}isEmpty(e={}){return this.clipboardImpl.isEmpty(e)}getCellsInClipboard(){return this.cells}clean(e){return this.disabled&&!e||(this.clipboardImpl.clean(),this.notify("clipboard:changed",{cells:[]})),this}copy(e,t={}){return this.disabled||(this.clipboardImpl.copy(e,this.graph,Object.assign(Object.assign({},this.commonOptions),t)),this.notify("clipboard:changed",{cells:e})),this}cut(e,t={}){return this.disabled||(this.clipboardImpl.cut(e,this.graph,Object.assign(Object.assign({},this.commonOptions),t)),this.notify("clipboard:changed",{cells:e})),this}paste(e={},t=this.graph){return this.disabled?[]:this.clipboardImpl.paste(t,Object.assign(Object.assign({},this.commonOptions),e))}get commonOptions(){const e=this.options,{enabled:t}=e;return __rest$1(e,["enabled"])}notify(e,t){this.trigger(e,t),this.graph.trigger(e,t)}dispose(){this.clean(!0),this.off()}}__decorate$5([Basecoat.dispose()],Clipboard.prototype,"dispose",null),Graph.prototype.isHistoryEnabled=function(){const e=this.getPlugin("history");return!!e&&e.isEnabled()},Graph.prototype.enableHistory=function(){const e=this.getPlugin("history");return e&&e.enable(),this},Graph.prototype.disableHistory=function(){const e=this.getPlugin("history");return e&&e.disable(),this},Graph.prototype.toggleHistory=function(e){const t=this.getPlugin("history");return t&&t.toggleEnabled(e),this},Graph.prototype.undo=function(e){const t=this.getPlugin("history");return t&&t.undo(e),this},Graph.prototype.redo=function(e){const t=this.getPlugin("history");return t&&t.redo(e),this},Graph.prototype.undoAndCancel=function(e){const t=this.getPlugin("history");return t&&t.cancel(e),this},Graph.prototype.canUndo=function(){const e=this.getPlugin("history");return!!e&&e.canUndo()},Graph.prototype.canRedo=function(){const e=this.getPlugin("history");return!!e&&e.canRedo()},Graph.prototype.cleanHistory=function(e){const t=this.getPlugin("history");return t&&t.clean(e),this},Graph.prototype.getHistoryStackSize=function(){return this.getPlugin("history").getSize()},Graph.prototype.getUndoStackSize=function(){return this.getPlugin("history").getUndoSize()},Graph.prototype.getRedoStackSize=function(){return this.getPlugin("history").getRedoSize()},Graph.prototype.getUndoRemainSize=function(){return this.getPlugin("history").getUndoRemainSize()};var __decorate$4=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Util;class History extends Basecoat{constructor(e={}){super(),this.name="history",this.batchCommands=null,this.batchLevel=0,this.lastBatchIndex=-1,this.freezed=!1,this.stackSize=0,this.handlers=[];const{stackSize:t=0}=e;this.stackSize=t,this.options=Util.getOptions(e),this.validator=new History.Validator({history:this,cancelInvalid:this.options.cancelInvalid})}init(e){this.graph=e,this.model=this.graph.model,this.clean(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(e){return null!=e?e!==this.isEnabled()&&(e?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}undo(e={}){if(!this.disabled){const t=this.undoStack.pop();t&&(this.revertCommand(t,e),this.redoStack.push(t),this.notify("undo",t,e))}return this}redo(e={}){if(!this.disabled){const t=this.redoStack.pop();t&&(this.applyCommand(t,e),this.undoStackPush(t),this.notify("redo",t,e))}return this}cancel(e={}){if(!this.disabled){const t=this.undoStack.pop();t&&(this.revertCommand(t,e),this.redoStack=[],this.notify("cancel",t,e))}return this}getSize(){return this.stackSize}getUndoRemainSize(){const e=this.undoStack.length;return this.stackSize-e}getUndoSize(){return this.undoStack.length}getRedoSize(){return this.redoStack.length}canUndo(){return!this.disabled&&this.undoStack.length>0}canRedo(){return!this.disabled&&this.redoStack.length>0}clean(e={}){return this.undoStack=[],this.redoStack=[],this.notify("clean",null,e),this}get disabled(){return!0!==this.options.enabled}validate(e,...t){return this.validator.validate(e,...t),this}startListening(){this.model.on("batch:start",this.initBatchCommand,this),this.model.on("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&this.options.eventNames.forEach((e,t)=>{this.handlers[t]=this.addCommand.bind(this,e),this.model.on(e,this.handlers[t])}),this.validator.on("invalid",e=>this.trigger("invalid",e))}stopListening(){this.model.off("batch:start",this.initBatchCommand,this),this.model.off("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&(this.options.eventNames.forEach((e,t)=>{this.model.off(e,this.handlers[t])}),this.handlers.length=0),this.validator.off("invalid")}createCommand(e){return{batch:!!e&&e.batch,data:{}}}revertCommand(e,t){this.freezed=!0;const r=Array.isArray(e)?Util.sortBatchCommands(e):[e];for(let n=r.length-1;n>=0;n-=1){const e=r[n],i=Object.assign(Object.assign({},t),pick(e.options,this.options.revertOptionsList||[]));this.executeCommand(e,!0,i)}this.freezed=!1}applyCommand(e,t){this.freezed=!0;const r=Array.isArray(e)?Util.sortBatchCommands(e):[e];for(let n=0;n<r.length;n+=1){const e=r[n],i=Object.assign(Object.assign({},t),pick(e.options,this.options.applyOptionsList||[]));this.executeCommand(e,!1,i)}this.freezed=!1}executeCommand(e,t,r){const n=this.model,i=n.getCell(e.data.id),o=e.event;if(Util.isAddEvent(o)&&t||Util.isRemoveEvent(o)&&!t)i&&i.remove(r);else if(Util.isAddEvent(o)&&!t||Util.isRemoveEvent(o)&&t){const t=e.data;t.node?n.addNode(t.props,r):t.edge&&n.addEdge(t.props,r)}else if(Util.isChangeEvent(o)){const n=e.data,o=n.key;if(o&&i){const e=t?n.prev[o]:n.next[o];if("attrs"===n.key){this.ensureUndefinedAttrs(e,t?n.next[o]:n.prev[o])&&(r.dirty=!0)}i.prop(o,e,r)}}else{const n=this.options.executeCommand;n&&call$1(n,this,e,t,r)}}addCommand(e,t){if(this.freezed||this.disabled)return;const r=t,n=r.options||{};if(n.dryrun)return;if(Util.isAddEvent(e)&&this.options.ignoreAdd||Util.isRemoveEvent(e)&&this.options.ignoreRemove||Util.isChangeEvent(e)&&this.options.ignoreChange)return;const i=this.options.beforeAddCommand;if(null!=i&&!1===call$1(i,this,e,t))return;"cell:change:*"===e&&(e=`cell:change:${r.key}`);const o=r.cell,a=Model.isModel(o);let s;if(this.batchCommands){s=this.batchCommands[Math.max(this.lastBatchIndex,0)];const t=a&&!s.modelChange||s.data.id!==o.id,r=s.event!==e;if(this.lastBatchIndex>=0&&(t||r)){const t=this.batchCommands.findIndex(t=>(a&&t.modelChange||t.data.id===o.id)&&t.event===e);t<0||Util.isAddEvent(e)||Util.isRemoveEvent(e)?s=this.createCommand({batch:!0}):(s=this.batchCommands[t],this.batchCommands.splice(t,1)),this.batchCommands.push(s),this.lastBatchIndex=this.batchCommands.length-1}}else s=this.createCommand({batch:!1});if(Util.isAddEvent(e)||Util.isRemoveEvent(e)){const t=s.data;return s.event=e,s.options=n,t.id=o.id,t.props=cloneDeep(o.toJSON()),o.isEdge()?t.edge=!0:o.isNode()&&(t.node=!0),this.push(s,n)}if(Util.isChangeEvent(e)){const r=t.key,i=s.data;return s.batch&&s.event||(s.event=e,s.options=n,i.key=r,null==i.prev&&(i.prev={}),i.prev[r]=cloneDeep(o.previous(r)),a?s.modelChange=!0:i.id=o.id),null==i.next&&(i.next={}),i.next[r]=cloneDeep(o.prop(r)),this.push(s,n)}const l=this.options.afterAddCommand;l&&call$1(l,this,e,t,s),this.push(s,n)}initBatchCommand(e){this.freezed||(this.batchCommands?this.batchLevel+=1:(this.batchCommands=[this.createCommand({batch:!0})],this.batchLevel=0,this.lastBatchIndex=-1))}storeBatchCommand(e){if(!this.freezed)if(this.batchCommands&&this.batchLevel<=0){const t=this.filterBatchCommand(this.batchCommands);t.length>0&&(this.redoStack=[],this.undoStackPush(t),this.consolidateCommands(),this.notify("add",t,e)),this.batchCommands=null,this.lastBatchIndex=-1,this.batchLevel=0}else this.batchCommands&&this.batchLevel>0&&(this.batchLevel-=1)}filterBatchCommand(e){let t=e.slice();const r=[];for(;t.length>0;){const e=t.shift(),n=e.event,i=e.data.id;if(null!=n&&(null!=i||e.modelChange)){if(Util.isAddEvent(n)){const e=t.findIndex(e=>Util.isRemoveEvent(e.event)&&e.data.id===i);if(e>=0){t=t.filter((t,r)=>e<r||t.data.id!==i);continue}}else if(Util.isRemoveEvent(n)){const e=t.findIndex(e=>Util.isAddEvent(e.event)&&e.data.id===i);if(e>=0){t.splice(e,1);continue}}else if(Util.isChangeEvent(n)){const t=e.data;if(isEqual(t.prev,t.next))continue}r.push(e)}}return r}notify(e,t,r){const n=null==t?null:Array.isArray(t)?t:[t];this.emit(e,{cmds:n,options:r}),this.graph.trigger(`history:${e}`,{cmds:n,options:r}),this.emit("change",{cmds:n,options:r}),this.graph.trigger("history:change",{cmds:n,options:r})}push(e,t){this.redoStack=[],e.batch?(this.lastBatchIndex=Math.max(this.lastBatchIndex,0),this.emit("batch",{cmd:e,options:t})):(this.undoStackPush(e),this.consolidateCommands(),this.notify("add",e,t))}consolidateCommands(){var e;const t=this.undoStack[this.undoStack.length-1],r=this.undoStack[this.undoStack.length-2];if(!Array.isArray(t))return;const n=new Set(t.map(e=>e.event));if(2!==n.size||!n.has("cell:change:parent")||!n.has("cell:change:children"))return;if(!t.every(e=>{var t;return e.batch&&(null===(t=e.options)||void 0===t?void 0:t.ui)}))return;if(!Array.isArray(r)||1!==r.length)return;const i=r[0];"cell:change:position"===i.event&&(null===(e=i.options)||void 0===e?void 0:e.ui)&&(r.push(...t),this.undoStack.pop())}undoStackPush(e){0!==this.stackSize?(this.undoStack.length>=this.stackSize&&this.undoStack.shift(),this.undoStack.push(e)):this.undoStack.push(e)}ensureUndefinedAttrs(e,t){let r=!1;return null!==e&&null!==t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).forEach(n=>{void 0===e[n]&&void 0!==t[n]?(e[n]=void 0,r=!0):"object"==typeof e[n]&&"object"==typeof t[n]&&(r=this.ensureUndefinedAttrs(e[n],t[n]))}),r}dispose(){this.validator.dispose(),this.clean(),this.stopListening(),this.off()}}__decorate$4([Basecoat.dispose()],History.prototype,"dispose",null),function(e){class t extends Basecoat{constructor(e){super(),this.map={},this.command=e.history,this.cancelInvalid=!1!==e.cancelInvalid,this.command.on("add",this.onCommandAdded,this)}onCommandAdded({cmds:e}){return Array.isArray(e)?e.every(e=>this.isValidCommand(e)):this.isValidCommand(e)}isValidCommand(e){if(e.options&&!1===e.options.validation)return!0;const t=e.event&&this.map[e.event]||[];let r=null;return t.forEach(t=>{let n=0;const i=o=>{const a=t[n];n+=1;try{if(!a)return void(r=o);a(o,e,i)}catch(s){i(s)}};i(r)}),!r||(this.cancelInvalid&&this.command.cancel(),this.emit("invalid",{err:r}),!1)}validate(e,...t){const r=Array.isArray(e)?e:e.split(/\s+/);return t.forEach(e=>{if("function"!=typeof e)throw new Error(`${r.join(" ")} requires callback functions.`)}),r.forEach(e=>{null==this.map[e]&&(this.map[e]=[]),this.map[e].push(t)}),this}dispose(){this.command.off("add",this.onCommandAdded,this)}}__decorate$4([Basecoat.dispose()],t.prototype,"dispose",null),e.Validator=t}(History||(History={})),function(e){e.isAddEvent=function(e){return"cell:added"===e},e.isRemoveEvent=function(e){return"cell:removed"===e},e.isChangeEvent=function(e){return null!=e&&e.startsWith("cell:change:")},e.getOptions=function(t){const r=["cell:added","cell:removed","cell:change:*"],n=["batch:start","batch:stop"],i=t.eventNames?t.eventNames.filter(t=>!(e.isChangeEvent(t)||r.includes(t)||n.includes(t))):r;return Object.assign(Object.assign({enabled:!0},t),{eventNames:i,applyOptionsList:t.applyOptionsList||["propertyPath"],revertOptionsList:t.revertOptionsList||["propertyPath"]})},e.sortBatchCommands=function(t){const r=[];for(let n=0,i=t.length;n<i;n+=1){const i=t[n];let o=null;if(e.isAddEvent(i.event)){const e=i.data.id;for(let r=0;r<n;r+=1)if(t[r].data.id===e){o=r;break}}null!==o?r.splice(o,0,i):r.push(i)}return r}}(Util||(Util={}));var __decorate$3=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Private;class SelectionImpl extends View{get graph(){return this.options.graph}get boxClassName(){return this.prefixClassName(Private.classNames.box)}get $boxes(){return children(this.container,this.boxClassName)}get handleOptions(){return this.options}constructor(e){super(),this.options=e,this.options.model&&(this.options.collection=this.options.model.collection),this.options.collection?this.collection=this.options.collection:(this.collection=new Collection([],{comparator:Private.depthComparator}),this.options.collection=this.collection),this.boxCount=0,this.createContainer(),this.startListening()}startListening(){const e=this.graph,t=this.collection;this.delegateEvents({[`mousedown .${this.boxClassName}`]:"onSelectionBoxMouseDown",[`touchstart .${this.boxClassName}`]:"onSelectionBoxMouseDown"},!0),e.on("scale",this.onGraphTransformed,this),e.on("translate",this.onGraphTransformed,this),e.model.on("updated",this.onModelUpdated,this),t.on("added",this.onCellAdded,this),t.on("removed",this.onCellRemoved,this),t.on("reseted",this.onReseted,this),t.on("updated",this.onCollectionUpdated,this),t.on("node:change:position",this.onNodePositionChanged,this),t.on("cell:changed",this.onCellChanged,this)}stopListening(){const e=this.graph,t=this.collection;this.undelegateEvents(),e.off("scale",this.onGraphTransformed,this),e.off("translate",this.onGraphTransformed,this),e.model.off("updated",this.onModelUpdated,this),t.off("added",this.onCellAdded,this),t.off("removed",this.onCellRemoved,this),t.off("reseted",this.onReseted,this),t.off("updated",this.onCollectionUpdated,this),t.off("node:change:position",this.onNodePositionChanged,this),t.off("cell:changed",this.onCellChanged,this)}onRemove(){this.stopListening()}onGraphTransformed(){this.updateSelectionBoxes()}onCellChanged(){this.updateSelectionBoxes()}onNodePositionChanged({node:e,options:t}){const{showNodeSelectionBox:r,pointerEvents:n}=this.options,{ui:i,selection:o,translateBy:a,snapped:s}=t,l=(!0!==r||n&&"none"===this.getPointerEventsValue(n))&&!this.translating&&!o,c=i&&a&&e.id===a;if(l&&(c||s)){this.translating=!0;const r=e.position(),n=e.previous("position"),i=r.x-n.x,o=r.y-n.y;0===i&&0===o||this.translateSelectedNodes(i,o,e,t),this.translating=!1}}onModelUpdated({removed:e}){e&&e.length&&this.unselect(e)}isEmpty(){return this.length<=0}isSelected(e){return this.collection.has(e)}get length(){return this.collection.length}get cells(){return this.collection.toArray()}select(e,t={}){t.dryrun=!0;const r=this.filter(Array.isArray(e)?e:[e]);return this.collection.add(r,t),this}unselect(e,t={}){return t.dryrun=!0,this.collection.remove(Array.isArray(e)?e:[e],t),this}reset(e,t={}){if(e){if(t.batch){const r=this.filter(Array.isArray(e)?e:[e]);return this.collection.reset(r,Object.assign(Object.assign({},t),{ui:!0})),this}const r=this.cells,n=this.filter(Array.isArray(e)?e:[e]),i={},o={};r.forEach(e=>i[e.id]=e),n.forEach(e=>o[e.id]=e);const a=[],s=[];return n.forEach(e=>{i[e.id]||a.push(e)}),r.forEach(e=>{o[e.id]||s.push(e)}),s.length&&this.unselect(s,Object.assign(Object.assign({},t),{ui:!0})),a.length&&this.select(a,Object.assign(Object.assign({},t),{ui:!0})),0===s.length&&0===a.length&&this.updateContainer(),this}return this.clean(t)}clean(e={}){return this.length&&(!1===e.batch?this.unselect(this.cells,e):this.collection.reset([],Object.assign(Object.assign({},e),{ui:!0}))),this}setFilter(e){this.options.filter=e}setContent(e){this.options.content=e}startSelecting(e){let t,r;e=this.normalizeEvent(e),this.clean();const n=this.graph.container;if(null!=e.offsetX&&null!=e.offsetY&&n.contains(e.target))t=e.offsetX,r=e.offsetY;else{const i=offset$1(n),o=n.scrollLeft,a=n.scrollTop;t=e.clientX-i.left+window.pageXOffset+o,r=e.clientY-i.top+window.pageYOffset+a}css$3(this.container,{top:r,left:t,width:1,height:1}),this.setEventData(e,{action:"selecting",clientX:e.clientX,clientY:e.clientY,offsetX:t,offsetY:r,scrollerX:0,scrollerY:0,moving:!1}),this.delegateDocumentEvents(Private.documentEvents,e.data)}filter(e){const t=this.options.filter;return e.filter(e=>Array.isArray(t)?t.some(t=>"string"==typeof t?e.shape===t:e.id===t.id):"function"!=typeof t||call$1(t,this.graph,e))}stopSelecting(e){const t=this.graph,r=this.getEventData(e);switch(r.action){case"selecting":{let e=width$1(this.container),r=height$1(this.container);const n=offset$1(this.container),i=t.pageToLocal(n.left,n.top),o=t.transform.getScale();e/=o.sx,r/=o.sy;const a=new Rectangle(i.x,i.y,e,r),s=this.getCellViewsInArea(a).map(e=>e.cell);this.reset(s,{batch:!0}),this.hideRubberband();break}case"translating":{const n=t.snapToGrid(e.clientX,e.clientY);if(!this.options.following){const e=r;this.updateSelectedNodesPosition({dx:e.clientX-e.originX,dy:e.clientY-e.originY})}this.graph.model.stopBatch("move-selection"),this.notifyBoxEvent("box:mouseup",e,n.x,n.y);break}default:this.clean()}}onMouseUp(e){this.getEventData(e).action&&(this.stopSelecting(e),this.undelegateDocumentEvents())}onSelectionBoxMouseDown(e){this.options.following||e.stopPropagation();const t=this.normalizeEvent(e);this.options.movable&&this.startTranslating(t);const r=this.getCellViewFromElem(t.target);this.setEventData(t,{activeView:r});const n=this.graph.snapToGrid(t.clientX,t.clientY);this.notifyBoxEvent("box:mousedown",t,n.x,n.y),this.delegateDocumentEvents(Private.documentEvents,t.data)}startTranslating(e){this.graph.model.startBatch("move-selection");const t=this.graph.snapToGrid(e.clientX,e.clientY);this.setEventData(e,{action:"translating",clientX:t.x,clientY:t.y,originX:t.x,originY:t.y})}getRestrictArea(){const e=this.graph.options.translating.restrict,t="function"==typeof e?call$1(e,this.graph,null):e;return"number"==typeof t?this.graph.transform.getGraphArea().inflate(t):!0===t?this.graph.transform.getGraphArea():t||null}getSelectionOffset(e,t){let r=e.x-t.clientX,n=e.y-t.clientY;const i=this.getRestrictArea();if(i){const o=this.collection.toArray(),a=Cell.getCellsBBox(o,{deep:!0})||Rectangle.create(),s=i.x-a.x,l=i.y-a.y,c=i.x+i.width-(a.x+a.width),u=i.y+i.height-(a.y+a.height);if(r<s&&(r=s),n<l&&(n=l),c<r&&(r=c),u<n&&(n=u),!this.options.following){const i=e.x-t.originX,o=e.y-t.originY;r=i<=s||i>=c?0:r,n=o<=l||o>=u?0:n}}return{dx:r,dy:n}}updateElementPosition(e,t,r){const n=css$3(e,"left"),i=css$3(e,"top"),o=n?parseFloat(n):0,a=i?parseFloat(i):0;css$3(e,"left",o+t),css$3(e,"top",a+r)}updateSelectedNodesPosition(e){const{dx:t,dy:r}=e;if(t||r)if(this.translateSelectedNodes(t,r),this.boxesUpdated)this.collection.length>1&&this.updateSelectionBoxes();else{const e=this.graph.transform.getScale();for(let n=0,i=this.$boxes,o=i.length;n<o;n+=1)this.updateElementPosition(i[n],t*e.sx,r*e.sy);this.updateElementPosition(this.selectionContainer,t*e.sx,r*e.sy)}}autoScrollGraph(e,t){const r=this.graph.getPlugin("scroller");return r?r.autoScroll(e,t):{scrollerX:0,scrollerY:0}}adjustSelection(e){const t=this.normalizeEvent(e),r=this.getEventData(t);switch(r.action){case"selecting":{const e=r;!0!==e.moving&&(appendTo(this.container,this.graph.container),this.showRubberband(),e.moving=!0);const{scrollerX:n,scrollerY:i}=this.autoScrollGraph(t.clientX,t.clientY);e.scrollerX+=n,e.scrollerY+=i;const o=t.clientX-e.clientX+e.scrollerX,a=t.clientY-e.clientY+e.scrollerY,s=parseInt(css$3(this.container,"left")||"0",10),l=parseInt(css$3(this.container,"top")||"0",10);css$3(this.container,{left:o<0?e.offsetX+o:s,top:a<0?e.offsetY+a:l,width:Math.abs(o),height:Math.abs(a)});break}case"translating":{const n=this.graph.snapToGrid(t.clientX,t.clientY),i=r,o=this.getSelectionOffset(n,i);this.options.following?this.updateSelectedNodesPosition(o):this.updateContainerPosition(o),o.dx&&(i.clientX=n.x),o.dy&&(i.clientY=n.y),this.notifyBoxEvent("box:mousemove",e,n.x,n.y);break}}this.boxesUpdated=!1}translateSelectedNodes(e,t,r,n){const i={},o=[];if(r&&(i[r.id]=!0),this.collection.toArray().forEach(e=>{e.getDescendants({deep:!0}).forEach(e=>{i[e.id]=!0})}),n&&n.translateBy){const e=this.graph.getCellById(n.translateBy);e&&(i[e.id]=!0,e.getDescendants({deep:!0}).forEach(e=>{i[e.id]=!0}),o.push(e))}this.collection.toArray().forEach(r=>{if(!i[r.id]){const a=Object.assign(Object.assign({},n),{selection:this.cid,exclude:o});r.translate(e,t,a),this.graph.model.getConnectedEdges(r).forEach(r=>{i[r.id]||(r.translate(e,t,a),i[r.id]=!0)})}})}getCellViewsInArea(e){const t=this.graph,r={strict:this.options.strict};let n=[];return this.options.rubberNode&&(n=n.concat(t.model.getNodesInArea(e,r).map(e=>t.renderer.findViewByCell(e)).filter(e=>null!=e))),this.options.rubberEdge&&(n=n.concat(t.model.getEdgesInArea(e,r).map(e=>t.renderer.findViewByCell(e)).filter(e=>null!=e))),n}notifyBoxEvent(e,t,r,n){const i=this.getEventData(t).activeView;this.trigger(e,{e:t,view:i,x:r,y:n,cell:i.cell})}getSelectedClassName(e){return this.prefixClassName((e.isNode()?"node":"edge")+"-selected")}addCellSelectedClassName(e){const t=this.graph.renderer.findViewByCell(e);t&&t.addClass(this.getSelectedClassName(e))}removeCellUnSelectedClassName(e){const t=this.graph.renderer.findViewByCell(e);t&&t.removeClass(this.getSelectedClassName(e))}destroySelectionBox(e){this.removeCellUnSelectedClassName(e),this.canShowSelectionBox(e)&&(remove(this.container.querySelector(`[data-cell-id="${e.id}"]`)),0===this.$boxes.length&&this.hide(),this.boxCount=Math.max(0,this.boxCount-1))}destroyAllSelectionBoxes(e){e.forEach(e=>this.removeCellUnSelectedClassName(e)),this.hide(),remove(this.$boxes),this.boxCount=0}hide(){removeClass(this.container,this.prefixClassName(Private.classNames.rubberband)),removeClass(this.container,this.prefixClassName(Private.classNames.selected))}showRubberband(){addClass(this.container,this.prefixClassName(Private.classNames.rubberband))}hideRubberband(){removeClass(this.container,this.prefixClassName(Private.classNames.rubberband))}showSelected(){removeAttribute(this.container,"style"),addClass(this.container,this.prefixClassName(Private.classNames.selected))}createContainer(){this.container=document.createElement("div"),addClass(this.container,this.prefixClassName(Private.classNames.root)),this.options.className&&addClass(this.container,this.options.className),this.selectionContainer=document.createElement("div"),addClass(this.selectionContainer,this.prefixClassName(Private.classNames.inner)),this.selectionContent=document.createElement("div"),addClass(this.selectionContent,this.prefixClassName(Private.classNames.content)),append(this.selectionContainer,this.selectionContent),attr(this.selectionContainer,"data-selection-length",this.collection.length),prepend(this.container,this.selectionContainer)}updateContainerPosition(e){(e.dx||e.dy)&&this.updateElementPosition(this.selectionContainer,e.dx,e.dy)}updateContainer(){const e={x:1/0,y:1/0},t={x:0,y:0};this.collection.toArray().filter(e=>this.canShowSelectionBox(e)).forEach(r=>{const n=this.graph.renderer.findViewByCell(r);if(n){const r=n.getBBox({useCellGeometry:!0});e.x=Math.min(e.x,r.x),e.y=Math.min(e.y,r.y),t.x=Math.max(t.x,r.x+r.width),t.y=Math.max(t.y,r.y+r.height)}}),css$3(this.selectionContainer,{position:"absolute",pointerEvents:"none",left:e.x,top:e.y,width:t.x-e.x,height:t.y-e.y}),attr(this.selectionContainer,"data-selection-length",this.collection.length);const r=this.options.content;if(r)if("function"==typeof r){const e=call$1(r,this.graph,this,this.selectionContent);e&&(this.selectionContent.innerHTML=e)}else this.selectionContent.innerHTML=r;this.collection.length>0&&!this.container.parentNode?appendTo(this.container,this.graph.container):this.collection.length<=0&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}canShowSelectionBox(e){return e.isNode()&&!0===this.options.showNodeSelectionBox||e.isEdge()&&!0===this.options.showEdgeSelectionBox}getPointerEventsValue(e){return"string"==typeof e?e:e(this.cells)}createSelectionBox(e){if(this.addCellSelectedClassName(e),this.canShowSelectionBox(e)){const t=this.graph.renderer.findViewByCell(e);if(t){const r=t.getBBox({useCellGeometry:!0}),n=this.boxClassName,i=document.createElement("div"),o=this.options.pointerEvents;addClass(i,n),addClass(i,`${n}-${e.isNode()?"node":"edge"}`),attr(i,"data-cell-id",e.id),css$3(i,{position:"absolute",left:r.x,top:r.y,width:r.width,height:r.height,pointerEvents:o?this.getPointerEventsValue(o):"auto"}),appendTo(i,this.container),this.showSelected(),this.boxCount+=1}}}updateSelectionBoxes(){this.collection.length>0&&(this.boxesUpdated=!0,this.confirmUpdate())}confirmUpdate(){if(this.boxCount){this.hide();for(let e=0,t=this.$boxes,r=t.length;e<r;e+=1){const r=t[e],n=attr(r,"data-cell-id");remove(r),this.boxCount-=1;const i=this.collection.get(n);i&&this.createSelectionBox(i)}this.updateContainer()}return 0}getCellViewFromElem(e){const t=e.getAttribute("data-cell-id");if(t){const e=this.collection.get(t);if(e)return this.graph.renderer.findViewByCell(e)}return null}onCellRemoved({cell:e}){this.destroySelectionBox(e),this.updateContainer()}onReseted({previous:e,current:t}){this.destroyAllSelectionBoxes(e),t.forEach(e=>{this.listenCellRemoveEvent(e),this.createSelectionBox(e)}),this.updateContainer()}onCellAdded({cell:e}){this.listenCellRemoveEvent(e),this.createSelectionBox(e),this.updateContainer()}listenCellRemoveEvent(e){e.off("removed",this.onCellRemoved,this),e.on("removed",this.onCellRemoved,this)}onCollectionUpdated({added:e,removed:t,options:r}){e.forEach(e=>{this.trigger("cell:selected",{cell:e,options:r}),e.isNode()?this.trigger("node:selected",{cell:e,options:r,node:e}):e.isEdge()&&this.trigger("edge:selected",{cell:e,options:r,edge:e})}),t.forEach(e=>{this.trigger("cell:unselected",{cell:e,options:r}),e.isNode()?this.trigger("node:unselected",{cell:e,options:r,node:e}):e.isEdge()&&this.trigger("edge:unselected",{cell:e,options:r,edge:e})});const n={added:e,removed:t,options:r,selected:this.cells.filter(e=>!!this.graph.getCellById(e.id))};this.trigger("selection:changed",n)}dispose(){this.clean(),this.remove(),this.off()}}__decorate$3([View.dispose()],SelectionImpl.prototype,"dispose",null),function(e){const t="widget-selection";e.classNames={root:t,inner:`${t}-inner`,box:`${t}-box`,content:`${t}-content`,rubberband:`${t}-rubberband`,selected:`${t}-selected`},e.documentEvents={mousemove:"adjustSelection",touchmove:"adjustSelection",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},e.depthComparator=function(e){return e.getAncestors().length}}(Private||(Private={}));const content$2=".x6-widget-selection {\n position: absolute;\n top: 0;\n left: 0;\n display: none;\n width: 0;\n height: 0;\n touch-action: none;\n}\n.x6-widget-selection-rubberband {\n display: block;\n overflow: visible;\n opacity: 0.3;\n}\n.x6-widget-selection-selected {\n display: block;\n}\n.x6-widget-selection-box {\n cursor: move;\n}\n.x6-widget-selection-inner[data-selection-length='0'],\n.x6-widget-selection-inner[data-selection-length='1'] {\n display: none;\n}\n.x6-widget-selection-content {\n position: absolute;\n top: 100%;\n right: -20px;\n left: -20px;\n margin-top: 30px;\n padding: 6px;\n line-height: 14px;\n text-align: center;\n border-radius: 6px;\n}\n.x6-widget-selection-content:empty {\n display: none;\n}\n.x6-widget-selection-rubberband {\n background-color: #3498db;\n border: 2px solid #2980b9;\n}\n.x6-widget-selection-box {\n box-sizing: content-box !important;\n margin-top: -4px;\n margin-left: -4px;\n padding-right: 4px;\n padding-bottom: 4px;\n border: 2px dashed #feb663;\n box-shadow: 2px 2px 5px #d3d3d3;\n}\n.x6-widget-selection-inner {\n box-sizing: content-box !important;\n margin-top: -8px;\n margin-left: -8px;\n padding-right: 12px;\n padding-bottom: 12px;\n border: 2px solid #feb663;\n box-shadow: 2px 2px 5px #d3d3d3;\n}\n.x6-widget-selection-content {\n color: #fff;\n font-size: 10px;\n background-color: #6a6b8a;\n}\n";Graph.prototype.isSelectionEnabled=function(){const e=this.getPlugin("selection");return!!e&&e.isEnabled()},Graph.prototype.enableSelection=function(){const e=this.getPlugin("selection");return e&&e.enable(),this},Graph.prototype.disableSelection=function(){const e=this.getPlugin("selection");return e&&e.disable(),this},Graph.prototype.toggleSelection=function(e){const t=this.getPlugin("selection");return t&&t.toggleEnabled(e),this},Graph.prototype.isMultipleSelection=function(){const e=this.getPlugin("selection");return!!e&&e.isMultipleSelection()},Graph.prototype.enableMultipleSelection=function(){const e=this.getPlugin("selection");return e&&e.enableMultipleSelection(),this},Graph.prototype.disableMultipleSelection=function(){const e=this.getPlugin("selection");return e&&e.disableMultipleSelection(),this},Graph.prototype.toggleMultipleSelection=function(e){const t=this.getPlugin("selection");return t&&t.toggleMultipleSelection(e),this},Graph.prototype.isSelectionMovable=function(){const e=this.getPlugin("selection");return!!e&&e.isSelectionMovable()},Graph.prototype.enableSelectionMovable=function(){const e=this.getPlugin("selection");return e&&e.enableSelectionMovable(),this},Graph.prototype.disableSelectionMovable=function(){const e=this.getPlugin("selection");return e&&e.disableSelectionMovable(),this},Graph.prototype.toggleSelectionMovable=function(e){const t=this.getPlugin("selection");return t&&t.toggleSelectionMovable(e),this},Graph.prototype.isRubberbandEnabled=function(){const e=this.getPlugin("selection");return!!e&&e.isRubberbandEnabled()},Graph.prototype.enableRubberband=function(){const e=this.getPlugin("selection");return e&&e.enableRubberband(),this},Graph.prototype.disableRubberband=function(){const e=this.getPlugin("selection");return e&&e.disableRubberband(),this},Graph.prototype.toggleRubberband=function(e){const t=this.getPlugin("selection");return t&&t.toggleRubberband(e),this},Graph.prototype.isStrictRubberband=function(){const e=this.getPlugin("selection");return!!e&&e.isStrictRubberband()},Graph.prototype.enableStrictRubberband=function(){const e=this.getPlugin("selection");return e&&e.enableStrictRubberband(),this},Graph.prototype.disableStrictRubberband=function(){const e=this.getPlugin("selection");return e&&e.disableStrictRubberband(),this},Graph.prototype.toggleStrictRubberband=function(e){const t=this.getPlugin("selection");return t&&t.toggleStrictRubberband(e),this},Graph.prototype.setRubberbandModifiers=function(e){const t=this.getPlugin("selection");return t&&t.setRubberbandModifiers(e),this},Graph.prototype.setSelectionFilter=function(e){const t=this.getPlugin("selection");return t&&t.setSelectionFilter(e),this},Graph.prototype.setSelectionDisplayContent=function(e){const t=this.getPlugin("selection");return t&&t.setSelectionDisplayContent(e),this},Graph.prototype.isSelectionEmpty=function(){const e=this.getPlugin("selection");return!e||e.isEmpty()},Graph.prototype.cleanSelection=function(e){const t=this.getPlugin("selection");return t&&t.clean(e),this},Graph.prototype.resetSelection=function(e,t){const r=this.getPlugin("selection");return r&&r.reset(e,t),this},Graph.prototype.getSelectedCells=function(){const e=this.getPlugin("selection");return e?e.getSelectedCells():[]},Graph.prototype.getSelectedCellCount=function(){const e=this.getPlugin("selection");return e?e.getSelectedCellCount():0},Graph.prototype.isSelected=function(e){const t=this.getPlugin("selection");return!!t&&t.isSelected(e)},Graph.prototype.select=function(e,t){const r=this.getPlugin("selection");return r&&r.select(e,t),this},Graph.prototype.unselect=function(e,t){const r=this.getPlugin("selection");return r&&r.unselect(e,t),this};var __decorate$2=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Selection2;class Selection extends Basecoat{get rubberbandDisabled(){return!0!==this.options.enabled||!0!==this.options.rubberband}get disabled(){return!0!==this.options.enabled}get length(){return this.selectionImpl.length}get cells(){return this.selectionImpl.cells}constructor(e={}){super(),this.name="selection",this.movedMap=new WeakMap,this.unselectMap=new WeakMap,this.options=Object.assign(Object.assign({enabled:!0},Selection.defaultOptions),e),ensure(this.name,content$2)}init(e){this.graph=e,this.selectionImpl=new SelectionImpl(Object.assign(Object.assign({},this.options),{graph:e})),this.setup(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(e){return null!=e?e!==this.isEnabled()&&(e?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}isMultipleSelection(){return this.isMultiple()}enableMultipleSelection(){return this.enableMultiple(),this}disableMultipleSelection(){return this.disableMultiple(),this}toggleMultipleSelection(e){return null!=e?e!==this.isMultipleSelection()&&(e?this.enableMultipleSelection():this.disableMultipleSelection()):this.isMultipleSelection()?this.disableMultipleSelection():this.enableMultipleSelection(),this}isSelectionMovable(){return!1!==this.options.movable}enableSelectionMovable(){return this.selectionImpl.options.movable=!0,this}disableSelectionMovable(){return this.selectionImpl.options.movable=!1,this}toggleSelectionMovable(e){return null!=e?e!==this.isSelectionMovable()&&(e?this.enableSelectionMovable():this.disableSelectionMovable()):this.isSelectionMovable()?this.disableSelectionMovable():this.enableSelectionMovable(),this}isRubberbandEnabled(){return!this.rubberbandDisabled}enableRubberband(){return this.rubberbandDisabled&&(this.options.rubberband=!0),this}disableRubberband(){return this.rubberbandDisabled||(this.options.rubberband=!1),this}toggleRubberband(e){return null!=e?e!==this.isRubberbandEnabled()&&(e?this.enableRubberband():this.disableRubberband()):this.isRubberbandEnabled()?this.disableRubberband():this.enableRubberband(),this}isStrictRubberband(){return!0===this.selectionImpl.options.strict}enableStrictRubberband(){return this.selectionImpl.options.strict=!0,this}disableStrictRubberband(){return this.selectionImpl.options.strict=!1,this}toggleStrictRubberband(e){return null!=e?e!==this.isStrictRubberband()&&(e?this.enableStrictRubberband():this.disableStrictRubberband()):this.isStrictRubberband()?this.disableStrictRubberband():this.enableStrictRubberband(),this}setRubberbandModifiers(e){this.setModifiers(e)}setSelectionFilter(e){return this.setFilter(e),this}setSelectionDisplayContent(e){return this.setContent(e),this}isEmpty(){return this.length<=0}clean(e={}){return this.selectionImpl.clean(e),this}reset(e,t={}){return this.selectionImpl.reset(e?this.getCells(e):[],t),this}getSelectedCells(){return this.cells}getSelectedCellCount(){return this.length}isSelected(e){return this.selectionImpl.isSelected(e)}select(e,t={}){const r=this.getCells(e);return r.length&&(this.isMultiple()?this.selectionImpl.select(r,t):this.reset(r.slice(0,1),t)),this}unselect(e,t={}){return this.selectionImpl.unselect(this.getCells(e),t),this}setup(){this.selectionImpl.on("*",(e,t)=>{this.trigger(e,t),this.graph.trigger(e,t)})}startListening(){this.graph.on("blank:mousedown",this.onBlankMouseDown,this),this.graph.on("blank:click",this.onBlankClick,this),this.graph.on("cell:mousemove",this.onCellMouseMove,this),this.graph.on("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.on("box:mousedown",this.onBoxMouseDown,this)}stopListening(){this.graph.off("blank:mousedown",this.onBlankMouseDown,this),this.graph.off("blank:click",this.onBlankClick,this),this.graph.off("cell:mousemove",this.onCellMouseMove,this),this.graph.off("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.off("box:mousedown",this.onBoxMouseDown,this)}onBlankMouseDown({e:e}){if(!this.allowBlankMouseDown(e))return;const t=this.graph.panning.allowPanning(e,!0),r=this.graph.getPlugin("scroller"),n=r&&r.allowPanning(e,!0);(this.allowRubberband(e,!0)||this.allowRubberband(e)&&!n&&!t)&&this.startRubberband(e)}allowBlankMouseDown(e){const t=this.options.eventTypes;return(null==t?void 0:t.includes("leftMouseDown"))&&0===e.button||(null==t?void 0:t.includes("mouseWheelDown"))&&1===e.button}onBlankClick(){this.clean()}allowRubberband(e,t){return!this.rubberbandDisabled&&ModifierKey.isMatch(e,this.options.modifiers,t)}allowMultipleSelection(e){return this.isMultiple()&&ModifierKey.isMatch(e,this.options.multipleSelectionModifiers)}onCellMouseMove({cell:e}){this.movedMap.set(e,!0)}onCellMouseUp({e:e,cell:t}){const r=this.options;let n=this.disabled;!n&&this.movedMap.has(t)&&(n=!1===r.selectCellOnMoved,n||(n=!1===r.selectNodeOnMoved&&t.isNode()),n||(n=!1===r.selectEdgeOnMoved&&t.isEdge())),n||(this.allowMultipleSelection(e)?this.unselectMap.has(t)?this.unselectMap.delete(t):this.isSelected(t)?this.unselect(t):this.select(t):this.reset(t)),this.movedMap.delete(t)}onBoxMouseDown({e:e,cell:t}){this.disabled||this.allowMultipleSelection(e)&&(this.unselect(t),this.unselectMap.set(t,!0))}getCells(e){return(Array.isArray(e)?e:[e]).map(e=>"string"==typeof e?this.graph.getCellById(e):e).filter(e=>null!=e)}startRubberband(e){return this.rubberbandDisabled||this.selectionImpl.startSelecting(e),this}isMultiple(){return!1!==this.options.multiple}enableMultiple(){return this.options.multiple=!0,this}disableMultiple(){return this.options.multiple=!1,this}setModifiers(e){return this.options.modifiers=e,this}setContent(e){return this.selectionImpl.setContent(e),this}setFilter(e){return this.selectionImpl.setFilter(e),this}dispose(){this.stopListening(),this.off(),this.selectionImpl.dispose(),clean(this.name)}}__decorate$2([Basecoat.dispose()],Selection.prototype,"dispose",null),Selection2=Selection||(Selection={}),Selection2.defaultOptions={rubberband:!1,rubberNode:!0,rubberEdge:!1,pointerEvents:"auto",multiple:!0,multipleSelectionModifiers:["ctrl","meta"],movable:!0,strict:!1,selectCellOnMoved:!1,selectNodeOnMoved:!1,selectEdgeOnMoved:!1,following:!0,content:null,eventTypes:["leftMouseDown","mouseWheelDown"]};var __decorate$1=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},__rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};class SnaplineImpl extends View{get model(){return this.graph.model}get containerClassName(){return this.prefixClassName("widget-snapline")}get verticalClassName(){return`${this.containerClassName}-vertical`}get horizontalClassName(){return`${this.containerClassName}-horizontal`}constructor(e){super();const{graph:t}=e,r=__rest(e,["graph"]);this.graph=t,this.options=Object.assign({},r),this.offset={x:0,y:0},this.render(),this.disabled||this.startListening()}get disabled(){return!0!==this.options.enabled}enable(){this.disabled&&(this.options.enabled=!0,this.startListening())}disable(){this.disabled||(this.options.enabled=!1,this.stopListening())}setFilter(e){this.options.filter=e}render(){const e=this.containerWrapper=new Vector("svg"),t=this.horizontal=new Vector("line"),r=this.vertical=new Vector("line");e.addClass(this.containerClassName),t.addClass(this.horizontalClassName),r.addClass(this.verticalClassName),e.setAttribute("width","100%"),e.setAttribute("height","100%"),t.setAttribute("display","none"),r.setAttribute("display","none"),e.append([t,r]),this.options.className&&e.addClass(this.options.className),this.container=this.containerWrapper.node}startListening(){this.stopListening(),this.graph.on("node:mousedown",this.captureCursorOffset,this),this.graph.on("node:mousemove",this.snapOnMoving,this),this.model.on("batch:stop",this.onBatchStop,this),this.delegateDocumentEvents({mouseup:"hide",touchend:"hide"})}stopListening(){this.graph.off("node:mousedown",this.captureCursorOffset,this),this.graph.off("node:mousemove",this.snapOnMoving,this),this.model.off("batch:stop",this.onBatchStop,this),this.undelegateDocumentEvents()}onBatchStop({name:e,data:t}){"resize"===e&&this.snapOnResizing(t.cell,t)}captureCursorOffset({view:e,x:t,y:r}){const n=e.getDelegatedView();if(n&&this.isNodeMovable(n)){const n=e.cell.getPosition();this.offset={x:t-n.x,y:r-n.y}}}isNodeMovable(e){return e&&e.cell.isNode()&&e.can("nodeMovable")}getRestrictArea(e){const t=this.graph.options.translating.restrict,r="function"==typeof t?call$1(t,this.graph,e):t;return"number"==typeof r?this.graph.transform.getGraphArea().inflate(r):!0===r?this.graph.transform.getGraphArea():r||null}snapOnResizing(e,t){if(this.options.resizing&&!t.snapped&&t.ui&&t.direction&&t.trueDirection){const r=this.graph.renderer.findViewByCell(e);if(r&&r.cell.isNode()){const n=e.getBBox(),i=n.bbox(e.getAngle()),o=i.getTopLeft(),a=i.getBottomRight(),s=Angle.normalize(e.getAngle()),l=this.options.tolerance||0;let c,u,d,p,h,f;const g={vertical:0,horizontal:0},m=t.direction,v=t.trueDirection,y=t.relativeDirection;-1!==v.indexOf("right")?g.vertical=a.x:g.vertical=o.x,-1!==v.indexOf("bottom")?g.horizontal=a.y:g.horizontal=o.y,this.model.getNodes().some(t=>{if(this.isIgnored(e,t))return!1;const r=t.getBBox().bbox(t.getAngle()),n=r.getTopLeft(),o=r.getBottomRight(),s={vertical:[n.x,o.x],horizontal:[n.y,o.y]},m={};return Object.keys(s).forEach(e=>{const t=e,r=s[t].map(e=>({position:e,distance:Math.abs(e-g[t])})).filter(e=>e.distance<=l);m[t]=sortBy(r,e=>e.distance)}),null==c&&m.vertical.length>0&&(c=m.vertical[0].position,u=Math.min(i.y,r.y),d=Math.max(a.y,o.y)-u),null==p&&m.horizontal.length>0&&(p=m.horizontal[0].position,h=Math.min(i.x,r.x),f=Math.max(a.x,o.x)-h),null!=c&&null!=p}),this.hide();let b=0,q=0;null==p&&null==c||(null!=c&&(b=-1!==v.indexOf("right")?c-a.x:o.x-c),null!=p&&(q=-1!==v.indexOf("bottom")?p-a.y:o.y-p));let V=0,S=0;if(s%90==0)90===s||270===s?(V=q,S=b):(V=b,S=q);else{const e=s>=0&&s<90?1:s>=90&&s<180?4:s>=180&&s<270?3:2;null!=p&&null!=c&&(b<q?(q=0,p=void 0):(b=0,c=void 0));const t=Angle.toRad(s%90);b&&(V=3===e?b/Math.cos(t):b/Math.sin(t)),q&&(S=3===e?q/Math.cos(t):q/Math.sin(t));const r=1===e||3===e;switch(y){case"top":case"bottom":S=q?q/(r?Math.cos(t):Math.sin(t)):b/(r?Math.sin(t):Math.cos(t));break;case"left":case"right":V=b?b/(r?Math.cos(t):Math.sin(t)):q/(r?Math.sin(t):Math.cos(t))}}switch(y){case"top":case"bottom":V=0;break;case"left":case"right":S=0}const E=this.graph.getGridSize();let x=Math.max(n.width+V,E),C=Math.max(n.height+S,E);t.minWidth&&t.minWidth>E&&(x=Math.max(x,t.minWidth)),t.minHeight&&t.minHeight>E&&(C=Math.max(C,t.minHeight)),t.maxWidth&&(x=Math.min(x,t.maxWidth)),t.maxHeight&&(C=Math.min(C,t.maxHeight)),t.preserveAspectRatio&&(S<V?C=x*(n.height/n.width):x=C*(n.width/n.height)),x===n.width&&C===n.height||(e.resize(x,C,{direction:m,relativeDirection:y,trueDirection:v,snapped:!0,snaplines:this.cid,restrict:this.getRestrictArea(r)}),d&&(d+=C-n.height),f&&(f+=x-n.width));const w=e.getBBox().bbox(s);c&&Math.abs(w.x-c)>1&&Math.abs(w.width+w.x-c)>1&&(c=void 0),p&&Math.abs(w.y-p)>1&&Math.abs(w.height+w.y-p)>1&&(p=void 0),this.update({verticalLeft:c,verticalTop:u,verticalHeight:d,horizontalTop:p,horizontalLeft:h,horizontalWidth:f})}}}snapOnMoving({view:e,e:t,x:r,y:n}){const i=e.getEventData(t).delegatedView||e;if(!this.isNodeMovable(i))return;const o=i.cell,a=o.getSize(),s=o.getPosition(),l=new Rectangle(r-this.offset.x,n-this.offset.y,a.width,a.height),c=o.getAngle(),u=l.getCenter(),d=l.bbox(c),p=d.getTopLeft(),h=d.getBottomRight(),f=this.options.tolerance||0;let g,m,v,y,b,q,V=0,S=0;if(this.model.getNodes().some(e=>{if(this.isIgnored(o,e))return!1;const t=e.getBBox().bbox(e.getAngle()),r=t.getCenter(),n=t.getTopLeft(),i=t.getBottomRight();return null==g&&(Math.abs(r.x-u.x)<f?(g=r.x,V=.5):Math.abs(n.x-p.x)<f?(g=n.x,V=0):Math.abs(n.x-h.x)<f?(g=n.x,V=1):Math.abs(i.x-h.x)<f?(g=i.x,V=1):Math.abs(i.x-p.x)<f&&(g=i.x),null!=g&&(m=Math.min(d.y,t.y),v=Math.max(h.y,i.y)-m)),null==y&&(Math.abs(r.y-u.y)<f?(y=r.y,S=.5):Math.abs(n.y-p.y)<f?y=n.y:Math.abs(n.y-h.y)<f?(y=n.y,S=1):Math.abs(i.y-h.y)<f?(y=i.y,S=1):Math.abs(i.y-p.y)<f&&(y=i.y),null!=y&&(b=Math.min(d.x,t.x),q=Math.max(h.x,i.x)-b)),null!=g&&null!=y}),this.hide(),null!=y||null!=g){null!=y&&(d.y=y-S*d.height),null!=g&&(d.x=g-V*d.width);const e=d.getCenter(),t=e.x-l.width/2,r=e.y-l.height/2,n=t-s.x,a=r-s.y;0===n&&0===a||(o.translate(n,a,{snapped:!0,restrict:this.getRestrictArea(i)}),q&&(q+=n),v&&(v+=a)),this.update({verticalLeft:g,verticalTop:m,verticalHeight:v,horizontalTop:y,horizontalLeft:b,horizontalWidth:q})}}isIgnored(e,t){return t.id===e.id||t.isDescendantOf(e)||!this.filter(t)}filter(e){const t=this.options.filter;return Array.isArray(t)?t.some(t=>"string"==typeof t?e.shape===t:e.id===t.id):"function"!=typeof t||call$1(t,this.graph,e)}update(e){if(e.horizontalTop){const t=this.graph.localToGraph(new Point(e.horizontalLeft,e.horizontalTop)),r=this.graph.localToGraph(new Point(e.horizontalLeft+e.horizontalWidth,e.horizontalTop));this.horizontal.setAttributes({x1:this.options.sharp?`${t.x}`:"0",y1:`${t.y}`,x2:this.options.sharp?`${r.x}`:"100%",y2:`${r.y}`,display:"inherit"})}else this.horizontal.setAttribute("display","none");if(e.verticalLeft){const t=this.graph.localToGraph(new Point(e.verticalLeft,e.verticalTop)),r=this.graph.localToGraph(new Point(e.verticalLeft,e.verticalTop+e.verticalHeight));this.vertical.setAttributes({x1:`${t.x}`,y1:this.options.sharp?`${t.y}`:"0",x2:`${r.x}`,y2:this.options.sharp?`${r.y}`:"100%",display:"inherit"})}else this.vertical.setAttribute("display","none");this.show()}resetTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}show(){return this.resetTimer(),null==this.container.parentNode&&this.graph.container.appendChild(this.container),this}hide(){this.resetTimer(),this.vertical.setAttribute("display","none"),this.horizontal.setAttribute("display","none");const e=this.options.clean,t="number"==typeof e?e:!1!==e?3e3:0;return t>0&&(this.timer=window.setTimeout(()=>{null!==this.container.parentNode&&this.unmount()},t)),this}onRemove(){this.stopListening(),this.hide()}dispose(){this.remove()}}__decorate$1([View.dispose()],SnaplineImpl.prototype,"dispose",null);const content$1=".x6-widget-snapline {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n}\n.x6-widget-snapline-vertical,\n.x6-widget-snapline-horizontal {\n stroke: #2ecc71;\n stroke-width: 1px;\n}\n";Graph.prototype.isSnaplineEnabled=function(){const e=this.getPlugin("snapline");return!!e&&e.isEnabled()},Graph.prototype.enableSnapline=function(){const e=this.getPlugin("snapline");return e&&e.enable(),this},Graph.prototype.disableSnapline=function(){const e=this.getPlugin("snapline");return e&&e.disable(),this},Graph.prototype.toggleSnapline=function(){const e=this.getPlugin("snapline");return e&&e.toggleEnabled(),this},Graph.prototype.hideSnapline=function(){const e=this.getPlugin("snapline");return e&&e.hide(),this},Graph.prototype.setSnaplineFilter=function(e){const t=this.getPlugin("snapline");return t&&t.setFilter(e),this},Graph.prototype.isSnaplineOnResizingEnabled=function(){const e=this.getPlugin("snapline");return!!e&&e.isOnResizingEnabled()},Graph.prototype.enableSnaplineOnResizing=function(){const e=this.getPlugin("snapline");return e&&e.enableOnResizing(),this},Graph.prototype.disableSnaplineOnResizing=function(){const e=this.getPlugin("snapline");return e&&e.disableOnResizing(),this},Graph.prototype.toggleSnaplineOnResizing=function(e){const t=this.getPlugin("snapline");return t&&t.toggleOnResizing(e),this},Graph.prototype.isSharpSnapline=function(){const e=this.getPlugin("snapline");return!!e&&e.isSharp()},Graph.prototype.enableSharpSnapline=function(){const e=this.getPlugin("snapline");return e&&e.enableSharp(),this},Graph.prototype.disableSharpSnapline=function(){const e=this.getPlugin("snapline");return e&&e.disableSharp(),this},Graph.prototype.toggleSharpSnapline=function(e){const t=this.getPlugin("snapline");return t&&t.toggleSharp(e),this},Graph.prototype.getSnaplineTolerance=function(){const e=this.getPlugin("snapline");if(e)return e.getTolerance()},Graph.prototype.setSnaplineTolerance=function(e){const t=this.getPlugin("snapline");return t&&t.setTolerance(e),this};var __decorate=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class Snapline extends Disposable{constructor(e={}){super(),this.name="snapline",this.options=Object.assign({enabled:!0,tolerance:10},e),ensure(this.name,content$1)}init(e){this.snaplineImpl=new SnaplineImpl(Object.assign(Object.assign({},this.options),{graph:e}))}isEnabled(){return!this.snaplineImpl.disabled}enable(){this.snaplineImpl.enable()}disable(){this.snaplineImpl.disable()}toggleEnabled(e){if(null==e)return this.isEnabled()?this.disable():this.enable(),this;e!==this.isEnabled()&&(e?this.enable():this.disable())}hide(){return this.snaplineImpl.hide(),this}setFilter(e){return this.snaplineImpl.setFilter(e),this}isOnResizingEnabled(){return!0===this.snaplineImpl.options.resizing}enableOnResizing(){return this.snaplineImpl.options.resizing=!0,this}disableOnResizing(){return this.snaplineImpl.options.resizing=!1,this}toggleOnResizing(e){return null!=e?e!==this.isOnResizingEnabled()&&(e?this.enableOnResizing():this.disableOnResizing()):this.isOnResizingEnabled()?this.disableOnResizing():this.enableOnResizing(),this}isSharp(){return!0===this.snaplineImpl.options.sharp}enableSharp(){return this.snaplineImpl.options.sharp=!0,this}disableSharp(){return this.snaplineImpl.options.sharp=!1,this}toggleSharp(e){return null!=e?e!==this.isSharp()&&(e?this.enableSharp():this.disableSharp()):this.isSharp()?this.disableSharp():this.enableSharp(),this}getTolerance(){return this.snaplineImpl.options.tolerance}setTolerance(e){return this.snaplineImpl.options.tolerance=e,this}captureCursorOffset(e){this.snaplineImpl.captureCursorOffset(e)}snapOnMoving(e){this.snaplineImpl.snapOnMoving(e)}dispose(){this.snaplineImpl.dispose(),clean(this.name)}}__decorate([Disposable.dispose()],Snapline.prototype,"dispose",null);let nanoid=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_","");const CellPanel=e=>{var t,r,n,i,o,a,s,l,c,u,d;const{cell:p,graph:h}=e,[f,g]=React.useState(p.prop());React.useEffect(()=>{},[f]),React.useEffect(()=>{g(p.prop());const e=e=>{const t={...e.cell.prop()};g(t)};return p.on("changed",e),()=>{p.off("changed",e)}},[p]);const m=(e,t)=>{p.prop(e,t)};let v=0,y=0;"edge"===f.shape&&([v,y]=calculateDistanceAndAngle([f.source.x,f.source.y],[f.target.x,f.target.y]));let b="";b="edge"===f.shape?(null==(i=null==(n=null==(r=null==(t=f.labels)?void 0:t[0])?void 0:r.attrs)?void 0:n.label)?void 0:i.text)||"":(null==(a=null==(o=f.attrs)?void 0:o.text)?void 0:a.text)||"";let q=0;return q="edge"===f.shape?(null==(u=null==(c=null==(l=null==(s=f.labels)?void 0:s[0])?void 0:l.attrs)?void 0:c.text)?void 0:u.fontSize)||14:null==(d=f.attrs)?void 0:d.text.fontSize,jsxRuntimeExports.jsxs("div",{className:"cell-panel",children:[jsxRuntimeExports.jsx(PanelOne,{title:"大小"}),"rect"===f.shape||"text"===f.shape?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(Space,{size:20,children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PanelTwo,{title:"宽"}),jsxRuntimeExports.jsx(TypedInputNumber,{style:{marginBottom:"24px"},min:0,max:360,value:f.size.width,onChange:e=>{m("size/width",e)}})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PanelTwo,{title:"高"}),jsxRuntimeExports.jsx(TypedInputNumber,{style:{marginBottom:"24px"},min:0,max:360,value:f.size.height,onChange:e=>{m("size/height",e)}})]})]})}):"circle"===f.shape?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(PanelTwo,{title:"半径"}),jsxRuntimeExports.jsx(TypedInputNumber,{style:{marginBottom:"24px"},value:f.size.width,min:0,onChange:e=>{m("size",{width:e,height:e})}})]}):"edge"===f.shape?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(PanelTwo,{title:"长"}),jsxRuntimeExports.jsx(TypedInputNumber,{style:{marginBottom:"24px"},value:v,min:0,onChange:e=>{const[t,r]=calculateEndPoint([f.source.x,f.source.y],y,e);m("target",{x:t,y:r})}})]}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}),jsxRuntimeExports.jsx(PanelOne,{title:"旋转"}),jsxRuntimeExports.jsx(PanelTwo,{title:"角度"}),jsxRuntimeExports.jsx(TypedInputNumber,{style:{marginBottom:"24px"},min:0,max:360,value:"edge"===f.shape?y:f.angle,onChange:e=>{if("edge"===f.shape){const[t,r]=calculateEndPoint([f.source.x,f.source.y],e,v);return void m("target",{x:t,y:r})}m("angle",e)}}),jsxRuntimeExports.jsx(PanelOne,{title:"文本"}),jsxRuntimeExports.jsx(PanelTwo,{title:"内容"}),jsxRuntimeExports.jsx(Input.TextArea,{style:{resize:"none",height:"100px",marginBottom:"16px",background:"#f7f8fa"},value:b,onChange:e=>{const t=e.target.value;"edge"!==f.shape?m("attrs/text/text",t):f.labels?p.setLabelAt(0,t):p.appendLabel({attrs:{text:{text:t}}})}}),jsxRuntimeExports.jsx(PanelTwo,{title:"字号"}),jsxRuntimeExports.jsx(TypedInputNumber,{style:{marginBottom:"16px"},value:q,min:0,onChange:e=>{"edge"!==f.shape||null==e?m("attrs/text/fontSize",e):f.labels?p.setLabelAt(0,{attrs:{label:{text:b},text:{fontSize:e}}}):p.appendLabel({attrs:{label:{text:b},text:{fontSize:e}}})}})]})},PanelOne=e=>{const{title:t}=e;return jsxRuntimeExports.jsx("div",{className:"cell-panel-one",children:t})},PanelTwo=e=>{const{title:t}=e;return jsxRuntimeExports.jsx("div",{className:"cell-panel-two",children:t})};function calculateDistanceAndAngle(e,t){const[r,n]=e,[i,o]=t,a=Math.sqrt(Math.pow(i-r,2)+Math.pow(o-n,2));let s=Math.atan2(o-n,i-r)*(180/Math.PI);s<0&&(s+=360);return[Math.floor(a),Math.floor(s)]}function calculateEndPoint(e,t,r){const[n,i]=e,o=t*(Math.PI/180),a=n+r*Math.cos(o),s=i+r*Math.sin(o);return[Math.round(a),Math.round(s)]}const{Text:Text}=Typography,KeyBordModal=e=>{const{children:t}=e;return jsxRuntimeExports.jsx(Popover,{arrow:!1,trigger:"click",rootClassName:"drawx6-keybordermodal-pop",content:jsxRuntimeExports.jsx("div",{className:"drawx6-keybordermodal-pop-content",children:jsxRuntimeExports.jsx(List,{bordered:!1,dataSource:[{key:["Ctrl","C"],desc:"拷贝"},{key:["Ctrl","V"],desc:"粘贴"},{key:["Ctrl","X"],desc:"剪切"},{key:["Ctrl","Z"],desc:"撤销"},{key:["Ctrl","Shift","Z"],desc:"重做"},{key:["BackSpace"],desc:"删除"},{key:["Ctrl","鼠标拖动"],desc:"平移"},{key:["Ctrl","鼠标滚轮"],desc:"缩放"}],renderItem:(e,t)=>jsxRuntimeExports.jsx(List.Item,{children:jsxRuntimeExports.jsxs(Space,{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[jsxRuntimeExports.jsx(Space,{size:6,children:e.key.map((e,t,r)=>jsxRuntimeExports.jsxs(React.Fragment,{children:[jsxRuntimeExports.jsx(Tag,{style:{marginRight:0},children:e}),t<r.length-1&&"+"]},t))}),jsxRuntimeExports.jsx(Text,{strong:!0,children:e.desc})]})},t)})}),children:t})},content=".x6-widget-edgednd {\n position: absolute;\n top: -10000px;\n left: -10000px;\n z-index: 999999;\n display: none;\n cursor: move;\n opacity: 0.7;\n pointer-events: 'cursor';\n }\n .x6-widget-edgednd.dragging {\n display: inline-block;\n }\n .x6-widget-edgednd.dragging * {\n pointer-events: none !important;\n }\n .x6-widget-edgednd .x6-graph {\n background: transparent;\n box-shadow: none;\n }\n ",_EdgeDnd=class e extends View{constructor(e){super(),__publicField(this,"name","edgednd"),__publicField(this,"options"),__publicField(this,"draggingGraph"),__publicField(this,"sourceEdge"),__publicField(this,"draggingEdge"),__publicField(this,"length",0),__publicField(this,"draggingBBox"),__publicField(this,"geometryBBox"),__publicField(this,"draggingView"),__publicField(this,"delta"),__publicField(this,"padding"),__publicField(this,"snapOffset"),__publicField(this,"originOffset"),this.options={...e,getDragEdge:e=>e.clone(),getDropEdge:e=>e.clone()},this.init()}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}init(){ensure(this.name,content),this.container=document.createElement("div"),addClass(this.container,this.prefixClassName("widget-edgednd")),this.draggingGraph=new Graph({...this.options.delegateGraphOptions,container:document.createElement("div"),width:1,height:1,async:!1}),append(this.container,this.draggingGraph.container)}start(t,r,n){const i=n;i.preventDefault(),this.length=r,this.targetModel.startBatch("edgednd"),addClass(this.container,"dragging"),appendTo(this.container,this.options.draggingContainer||document.body),this.sourceEdge=t,this.prepareDragging(t,i.clientX,i.clientY),this.updateNodePosition(i.clientX,i.clientY),this.delegateDocumentEvents(e.documentEvents,i.data)}prepareDragging(e,t,r){const n=this.draggingGraph,i=n.model,o=this.options.getDragEdge(e);o.setSource({x:0,y:0}),o.setTarget({x:0+this.length,y:0});n.scale(1,1),this.clearDragging(),i.resetCells([o]);const a=n.findViewByCell(o);a.undelegateEvents(),a.cell.off("changed"),n.fitToContent({padding:5,allowNewOrigin:"any",useCellGeometry:!1});const s=a.getBBox();this.geometryBBox=a.getBBox({useCellGeometry:!0}),this.delta=this.geometryBBox.getTopLeft().diff(s.getTopLeft()),this.draggingEdge=o,this.draggingView=a,this.draggingBBox=o.getBBox(),this.padding=5,this.originOffset=this.updateGraphPosition(t,r)}clearDragging(){this.draggingEdge&&(this.sourceEdge=null,this.draggingEdge.remove(),this.draggingEdge=null,this.draggingView=null,this.delta=null,this.padding=null,this.snapOffset=null,this.originOffset=null,this.undelegateDocumentEvents())}updateGraphPosition(e,t){const r=document.body.scrollTop||document.documentElement.scrollTop,n=document.body.scrollLeft||document.documentElement.scrollLeft,i=this.delta,o=this.geometryBBox,a=this.padding||5,s={left:e-i.x-o.width/2-a+n,top:t-i.y-o.height/2-a+r};return this.draggingGraph&&css$3(this.container,{left:`${s.left}px`,top:`${s.top}px`}),s}updateNodePosition(e,t){const r=this.targetGraph.clientToLocal(e,t),n=this.draggingBBox;return r.x-=n.width/2,r.y-=n.height/2,this.draggingEdge.setSource({x:r.x,y:r.y}),this.draggingEdge.setTarget({x:r.x+this.length,y:r.y}),r}onDragging(e){if(this.draggingView){e.preventDefault();const t=this.normalizeEvent(e),r=t.clientX,n=t.clientY;this.updateGraphPosition(r,n),this.updateNodePosition(r,n)}}onDragEnd(e){const t=this.draggingEdge;if(t){const r=this.normalizeEvent(e);this.draggingView;const n=this.draggingBBox,i=this.snapOffset;let o=n.x,a=n.y;i&&(o+=i.x,a+=i.y),t.setSource({x:o,y:a}),t.setTarget({x:o+this.length,y:a});(e=>{e?this.onDropped(e):this.onDropInvalid(),this.targetModel.stopBatch("edgednd")})(this.drop(t,{x:r.clientX,y:r.clientY}))}}drop(e,t){if(this.isInsideValidArea(t)){const r=this.targetGraph,n=r.model,i=r.clientToLocal(t),o=this.options.getDropEdge(e),a=o.getBBox();i.x+=a.x-a.width/2,i.y+=a.y-a.height/2;const s=this.snapOffset?1:r.getGridSize(),l=GeometryUtil.snapToGrid(i.x,s),c=GeometryUtil.snapToGrid(i.y,s);return o.setSource({x:l,y:c}),o.setTarget({x:l+this.length,y:c}),o.removeZIndex(),n.addCell(o,{stencil:this.cid}),o}return null}isInsideValidArea(e){let t;const r=this.targetGraph;return t=this.getDropArea(r.container),t&&t.containsPoint(e)}getDropArea(e){const t=offset$1(e),r=document.body.scrollTop||document.documentElement.scrollTop,n=document.body.scrollLeft||document.documentElement.scrollLeft;return Rectangle.create({x:t.left+parseInt(css$3(e,"border-left-width"),10)-n,y:t.top+parseInt(css$3(e,"border-top-width"),10)-r,width:e.clientWidth,height:e.clientHeight})}onDropInvalid(){const e=this.draggingEdge;e&&this.onDropped(e)}onDropped(e){this.clearDragging(),removeClass(this.container,"dragging"),remove(this.container)}onRemove(){this.draggingGraph&&(this.draggingGraph.view.remove(),this.draggingGraph.dispose())}dispose(){this.remove(),clean(this.name)}};__publicField(_EdgeDnd,"documentEvents",{mousemove:"onDragging",touchmove:"onDragging",mouseup:"onDragEnd",touchend:"onDragEnd",touchcancel:"onDragEnd"});let EdgeDnd=_EdgeDnd;const activeColor="#1677ff",normalColor="#999999",ports={groups:{top:{position:"top",attrs:{circle:{magnet:!0,stroke:normalColor,r:5,style:{visibility:"hidden"}}}},right:{position:"right",attrs:{circle:{magnet:!0,stroke:normalColor,r:5,style:{visibility:"hidden"}}}},bottom:{position:"bottom",attrs:{circle:{magnet:!0,stroke:normalColor,r:5,style:{visibility:"hidden"}}}},left:{position:"left",attrs:{circle:{magnet:!0,stroke:normalColor,r:5,style:{visibility:"hidden"}}}}},items:[{group:"top"},{group:"right"},{group:"bottom"},{group:"left"}]},Editor=React.forwardRef((e,t)=>{const{value:r,onSave:n,onExit:i,savePngType:o="url",editabled:a=!0,showSaveBtn:s=!0}=e,{topProps:l}=useQuestionContext(),{uploadImg:c}=l,u=React.useRef(null),d=React.useRef(null),p=React.useRef(null),h=React.useRef(null),[f,g]=React.useState(!1),[m,v]=React.useState(null),[y,b]=React.useState(!1);React.useEffect(()=>(u.current&&q(u.current),()=>{var e;null==(e=d.current)||e.dispose()}),[]),React.useEffect(()=>{var e;(null==r?void 0:r.cells)&&(null==(e=d.current)||e.fromJSON(r.cells))},[r]);const q=e=>{d.current=new Graph({container:e,autoResize:!0,background:{color:"#ffffff"},grid:{visible:!0,size:10,type:"dot",args:{color:"#a0a0a0",thickness:1}},panning:{enabled:!0,modifiers:["ctrl","meta"]},mousewheel:{enabled:!0,zoomAtMousePosition:!0,modifiers:["ctrl","meta"],minScale:.5,maxScale:3},interacting:a,connecting:{createEdge:()=>new Edge({attrs:{line:{stroke:"#333333",strokeWidth:2,targetMarker:{name:"block",width:12,height:8}}},tools:["edge-editor"]})},highlighting:{magnetAdsorbed:{name:"stroke",args:{attrs:{"stroke-width":1,stroke:activeColor}}}}}),S(d.current),V(d.current),E(d.current),x(d.current)},V=e=>{e.use(new Export),e.use(new Transform({resizing:{enabled:!0,preserveAspectRatio:e=>"circle"===e.shape},rotating:!0})),e.use(new Selection({rubberband:!0,showNodeSelectionBox:!0})),e.use(new Snapline({className:"x6-snapline-color"})),e.use(new Keyboard),e.use(new Clipboard),e.use(new History)},S=e=>{p.current=new Dnd({target:e}),h.current=new EdgeDnd({target:e})},E=e=>{const t=(e,t)=>{for(let r=0,n=e.length;r<n;r+=1)e[r].style.visibility=t?"visible":"hidden"};e.on("node:mouseenter",({e:e,node:r,view:n})=>{const i=u.current.querySelectorAll(".x6-port-body");t(i,!0)}),e.on("node:mouseleave",({e:e,node:r,view:n})=>{const i=u.current.querySelectorAll(".x6-port-body");t(i,!1)}),e.on("cell:click",({e:e,x:t,y:r,cell:n,view:i})=>{"edge"!==n.shape&&(g(!0),v(n))}),e.on("blank:click",({e:e,x:t,y:r})=>{g(!1),v(null)})},x=e=>{e.bindKey(["meta+c","ctrl+c"],()=>{const t=e.getSelectedCells();return t.length&&e.copy(t,{deep:!0}),!1}),e.bindKey(["meta+x","ctrl+x"],()=>{const t=e.getSelectedCells();return t.length&&e.cut(t,{deep:!0}),!1}),e.bindKey(["meta+v","ctrl+v"],()=>{if(!e.isClipboardEmpty()){const t=e.paste({offset:32});e.cleanSelection(),e.select(t)}return!1}),e.bindKey(["meta+z","ctrl+z"],()=>(e.canUndo()&&e.undo(),!1)),e.bindKey(["meta+shift+z","ctrl+shift+z"],()=>(e.canRedo()&&e.redo(),!1)),e.bindKey("backspace",()=>{const t=e.getSelectedCells();t.length&&e.removeCells(t)})},C=e=>{let t=null;switch(e.currentTarget.getAttribute("data-type")){case"rect":t=d.current.createNode({width:80,height:40,shape:"rect",label:"矩形",attrs:{body:{stroke:normalColor,strokeWidth:1,fill:"#fff"}},ports:{...ports},tools:["node-editor"]});break;case"circle":t=d.current.createNode({width:60,height:60,shape:"circle",label:"圆形",attrs:{body:{stroke:normalColor,strokeWidth:1,fill:"#fff"}},ports:{...ports},tools:["node-editor"]});break;case"text":t=d.current.createNode({width:80,height:40,shape:"text",tools:["node-editor"]});break;case"hori-line":t=d.current.createEdge({attrs:{line:{stroke:"#333333",strokeWidth:2,targetMarker:null,sourceMarker:null}},tools:[{name:"edge-editor",args:{labelAddable:!0}},{name:"source-arrowhead",args:{attrs:{fill:"transparent",stroke:"transparent"}}},{name:"target-arrowhead",args:{attrs:{fill:"transparent",stroke:"transparent"}}}]});break;case"arrow":t=d.current.createEdge({attrs:{line:{stroke:"#333333",strokeWidth:2,targetMarker:{name:"block",width:12,height:8}}},tools:["edge-editor",{name:"source-arrowhead",args:{attrs:{fill:"transparent",stroke:"transparent"}}},{name:"target-arrowhead",args:{attrs:{fill:"transparent",stroke:"transparent"}}}]})}t&&(t.isNode()?p.current.start(t,e.nativeEvent):h.current.start(t,100,e.nativeEvent))},w=async()=>new Promise(e=>{var t,r;const n=null==(t=d.current)?void 0:t.toJSON();null==(r=d.current)||r.toPNG(t=>{e({json:n,png:t})},{padding:20,copyStyles:!1})}),R=async(e=!1)=>{if(e){b(!0);const e=await w();if("url"===o){const t=A(e.png),r=new FormData;r.append("file",t);const n=await(null==c?void 0:c({file:r}).catch(()=>{}));(null==n?void 0:n.url)&&(e.png=n.url)}null==n||n(e),b(!1)}null==i||i()},A=e=>{const t=e.replace(/^data:image\/png;base64,/,""),r=atob(t),n=r.length,i=new ArrayBuffer(n),o=new Uint8Array(i);for(let l=0;l<n;l++)o[l]=r.charCodeAt(l);const a=new Blob([i],{type:"image/png"}),s=`${nanoid()}.png`;return new File([a],s,{type:"image/png"})};return React.useImperativeHandle(t,()=>({getGraphInstance:()=>d.current,getData:async()=>{const e=await w();if("url"===o){const t=A(e.png),r=new FormData;r.append("file",t);const n=await(null==c?void 0:c({file:r}).catch(()=>{}));(null==n?void 0:n.url)&&(e.png=n.url)}return e}})),jsxRuntimeExports.jsxs("div",{className:classNames("drawx6","drawx6-editor"),children:[jsxRuntimeExports.jsxs("div",{className:"drawx6-editor-header drawx6-space",children:[jsxRuntimeExports.jsx("div",{children:"画板"}),jsxRuntimeExports.jsxs(Space,{size:10,children:[jsxRuntimeExports.jsx(Button$1,{ghost:!0,type:"primary",onClick:()=>R(!1),children:"仅退出"}),s&&jsxRuntimeExports.jsx(Button$1,{loading:y,type:"primary",onClick:()=>R(!0),children:"保存并退出"})]})]}),jsxRuntimeExports.jsxs("div",{className:"drawx6-editor-container",children:[jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%"},children:jsxRuntimeExports.jsx("div",{ref:u,className:"drawx6-container"})}),jsxRuntimeExports.jsxs("div",{className:"drawx6-editor-container-nav drawx6-overflow-y",children:[jsxRuntimeExports.jsxs("div",{className:"nav-item drawx6-space","data-type":"rect",onMouseDown:C,children:[jsxRuntimeExports.jsx("div",{className:"graph-rect"}),jsxRuntimeExports.jsx("span",{className:"nav-item-title",children:"矩形"})]}),jsxRuntimeExports.jsxs("div",{className:"nav-item drawx6-space","data-type":"circle",onMouseDown:C,children:[jsxRuntimeExports.jsx("div",{className:"graph-circle"}),jsxRuntimeExports.jsx("span",{className:"nav-item-title",children:"圆形"})]}),jsxRuntimeExports.jsxs("div",{className:"nav-item drawx6-space","data-type":"text",onMouseDown:C,children:[jsxRuntimeExports.jsx(TextSvg,{}),jsxRuntimeExports.jsx("span",{className:"nav-item-title",children:"文本"})]}),jsxRuntimeExports.jsxs("div",{className:"nav-item drawx6-space","data-type":"hori-line",onMouseDown:C,children:[jsxRuntimeExports.jsx(LineSvg,{}),jsxRuntimeExports.jsx("span",{className:"nav-item-title",children:"水平线"})]}),jsxRuntimeExports.jsxs("div",{className:"nav-item drawx6-space","data-type":"arrow",onMouseDown:C,children:[jsxRuntimeExports.jsx(ArrawSvg,{}),jsxRuntimeExports.jsx("span",{className:"nav-item-title",children:"箭头"})]}),jsxRuntimeExports.jsx(KeyBordModal,{children:jsxRuntimeExports.jsxs("div",{className:"nav-item drawx6-space",style:{cursor:"default"},children:[jsxRuntimeExports.jsx(KeyBoard,{}),jsxRuntimeExports.jsx("span",{className:"nav-item-title",children:"快捷键"})]})})]}),jsxRuntimeExports.jsx(Popconfirm,{title:null,description:jsxRuntimeExports.jsxs("div",{style:{marginTop:"-4px"},children:["确认清空画板?清空后无法恢复,",jsxRuntimeExports.jsx("br",{}),"请谨慎操作。"]}),onConfirm:()=>{var e;null==(e=d.current)||e.clearCells()},placement:"bottomRight",arrow:!1,children:jsxRuntimeExports.jsx("div",{className:"drawx6-editor-container-clear drawx6-center",style:{right:f?"220px":"20px"},children:jsxRuntimeExports.jsx(ClearSvg,{})})}),f&&jsxRuntimeExports.jsx("div",{className:"drawx6-editor-container-control drawx6-overflow-y",children:jsxRuntimeExports.jsx(CellPanel,{cell:m,graph:d.current})})]})]})}),TextSvg=()=>jsxRuntimeExports.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("g",{clipPath:"url(#clip0_6137_1319)",children:jsxRuntimeExports.jsx("path",{d:"M13.5394 28.9231H12.3086C11.9394 28.9231 11.6932 29.1692 11.6932 29.5385C11.6932 29.9077 11.9394 30.1539 12.3086 30.1539H13.5394C13.9086 30.1539 14.1547 29.9077 14.1547 29.5385C14.1547 29.1692 13.9086 28.9231 13.5394 28.9231ZM6.15475 28.9231H4.92398C4.8009 28.9231 4.67782 28.9846 4.61629 29.0462V28.3077C4.61629 27.8154 4.18552 27.3846 3.69321 27.3846H1.23167C0.739363 27.3846 0.308594 27.8154 0.308594 28.3077V30.7692C0.308594 31.2615 0.739363 31.6923 1.23167 31.6923H3.69321C4.18552 31.6923 4.61629 31.2615 4.61629 30.7692V30.0308C4.67782 30.0923 4.8009 30.1539 4.92398 30.1539H6.15475C6.52398 30.1539 6.77013 29.9077 6.77013 29.5385C6.77013 29.1692 6.52398 28.9231 6.15475 28.9231ZM3.07782 6.15385C3.07782 5.78462 2.83167 5.53846 2.46244 5.53846C2.09321 5.53846 1.84706 5.78462 1.84706 6.15385V7.38462C1.84706 7.75385 2.09321 8 2.46244 8C2.83167 8 3.07783 7.75385 3.07782 7.38462V6.15385ZM9.84706 28.9231H8.61629C8.24706 28.9231 8.0009 29.1692 8.0009 29.5385C8.0009 29.9077 8.24706 30.1539 8.61629 30.1539H9.84706C10.2163 30.1539 10.4624 29.9077 10.4624 29.5385C10.4624 29.1692 10.2163 28.9231 9.84706 28.9231ZM7.38552 1.84616H6.15475C5.78552 1.84616 5.53936 2.09231 5.53936 2.46154C5.53936 2.83077 5.78552 3.07692 6.15475 3.07692H7.38552C7.75475 3.07692 8.0009 2.83077 8.0009 2.46154C8.0009 2.09231 7.75475 1.84616 7.38552 1.84616ZM3.07782 17.2308C3.07782 16.8615 2.83167 16.6154 2.46244 16.6154C2.09321 16.6154 1.84706 16.8615 1.84706 17.2308V18.4615C1.84706 18.8308 2.09321 19.0769 2.46244 19.0769C2.83167 19.0769 3.07783 18.8308 3.07782 18.4615V17.2308ZM3.07782 20.9231C3.07782 20.5539 2.83167 20.3077 2.46244 20.3077C2.09321 20.3077 1.84706 20.5539 1.84706 20.9231V22.1539C1.84706 22.5231 2.09321 22.7692 2.46244 22.7692C2.83167 22.7692 3.07783 22.5231 3.07782 22.1539V20.9231ZM3.07782 9.84616C3.07782 9.47693 2.83167 9.23077 2.46244 9.23077C2.09321 9.23077 1.84706 9.47693 1.84706 9.84616V11.0769C1.84706 11.4462 2.09321 11.6923 2.46244 11.6923C2.83167 11.6923 3.07783 11.4462 3.07782 11.0769V9.84616ZM13.5394 3.07692H14.7701C15.1394 3.07692 15.3855 2.83077 15.3855 2.46154C15.3855 2.09231 15.1394 1.84616 14.7701 1.84616H13.5394C13.1701 1.84616 12.924 2.09231 12.924 2.46154C12.924 2.83077 13.1701 3.07692 13.5394 3.07692ZM2.46244 24C2.09321 24 1.84706 24.2462 1.84706 24.6154V25.8462C1.84706 26.2154 2.09321 26.4615 2.46244 26.4615C2.83167 26.4615 3.07783 26.2154 3.07782 25.8462V24.6154C3.07782 24.2462 2.83167 24 2.46244 24ZM3.07782 13.5385C3.07782 13.1692 2.83167 12.9231 2.46244 12.9231C2.09321 12.9231 1.84706 13.1692 1.84706 13.5385V14.7692C1.84706 15.1385 2.09321 15.3846 2.46244 15.3846C2.83167 15.3846 3.07783 15.1385 3.07782 14.7692V13.5385ZM20.924 3.07692H22.1548C22.524 3.07692 22.7701 2.83077 22.7701 2.46154C22.7701 2.09231 22.524 1.84616 22.1548 1.84616H20.924C20.5548 1.84616 20.3086 2.09231 20.3086 2.46154C20.3086 2.83077 20.5548 3.07692 20.924 3.07692ZM28.924 20.9231C28.924 21.2923 29.1701 21.5385 29.5394 21.5385C29.9086 21.5385 30.1548 21.2923 30.1548 20.9231V19.6923C30.1548 19.3231 29.9086 19.0769 29.5394 19.0769C29.1701 19.0769 28.924 19.3231 28.924 19.6923V20.9231ZM29.5394 10.4615C29.9086 10.4615 30.1548 10.2154 30.1548 9.84616V8.61539C30.1548 8.24616 29.9086 8 29.5394 8C29.1701 8 28.924 8.24616 28.924 8.61539V9.84616C28.924 10.2154 29.1701 10.4615 29.5394 10.4615ZM28.924 17.2308C28.924 17.6 29.1701 17.8462 29.5394 17.8462C29.9086 17.8462 30.1548 17.6 30.1548 17.2308V16C30.1548 15.6308 29.9086 15.3846 29.5394 15.3846C29.1701 15.3846 28.924 15.6308 28.924 16V17.2308ZM28.924 24.6154C28.924 24.9846 29.1701 25.2308 29.5394 25.2308C29.9086 25.2308 30.1548 24.9846 30.1548 24.6154V23.3846C30.1548 23.0154 29.9086 22.7692 29.5394 22.7692C29.1701 22.7692 28.924 23.0154 28.924 23.3846V24.6154ZM9.84706 3.07692H11.0778C11.4471 3.07692 11.6932 2.83077 11.6932 2.46154C11.6932 2.09231 11.4471 1.84616 11.0778 1.84616H9.84706C9.47783 1.84616 9.23167 2.09231 9.23167 2.46154C9.23167 2.83077 9.47783 3.07692 9.84706 3.07692ZM17.2317 28.9231H16.0009C15.6317 28.9231 15.3855 29.1692 15.3855 29.5385C15.3855 29.9077 15.6317 30.1539 16.0009 30.1539H17.2317C17.6009 30.1539 17.8471 29.9077 17.8471 29.5385C17.8471 29.1692 17.6009 28.9231 17.2317 28.9231ZM20.924 28.9231H19.6932C19.324 28.9231 19.0778 29.1692 19.0778 29.5385C19.0778 29.9077 19.324 30.1539 19.6932 30.1539H20.924C21.2932 30.1539 21.5394 29.9077 21.5394 29.5385C21.5394 29.1692 21.2932 28.9231 20.924 28.9231ZM24.6163 28.9231H23.3855C23.0163 28.9231 22.7701 29.1692 22.7701 29.5385C22.7701 29.9077 23.0163 30.1539 23.3855 30.1539H24.6163C24.9855 30.1539 25.2317 29.9077 25.2317 29.5385C25.2317 29.1692 24.9855 28.9231 24.6163 28.9231ZM17.2317 3.07692H18.4624C18.8317 3.07692 19.0778 2.83077 19.0778 2.46154C19.0778 2.09231 18.8317 1.84616 18.4624 1.84616H17.2317C16.8624 1.84616 16.6163 2.09231 16.6163 2.46154C16.6163 2.83077 16.8624 3.07692 17.2317 3.07692ZM28.924 13.5385C28.924 13.9077 29.1701 14.1538 29.5394 14.1538C29.9086 14.1538 30.1548 13.9077 30.1548 13.5385V12.3077C30.1548 11.9385 29.9086 11.6923 29.5394 11.6923C29.1701 11.6923 28.924 11.9385 28.924 12.3077V13.5385ZM25.8471 1.84616H24.6163C24.2471 1.84616 24.0009 2.09231 24.0009 2.46154C24.0009 2.83077 24.2471 3.07692 24.6163 3.07692H25.8471C26.2163 3.07692 26.4624 2.83077 26.4624 2.46154C26.4624 2.09231 26.2163 1.84616 25.8471 1.84616ZM17.6624 24V10.7692H22.7701V8H9.23167V10.7692H14.4624V24H17.6624ZM1.23167 4.61539H3.69321C4.18552 4.61539 4.61629 4.18462 4.61629 3.69231V1.23077C4.61629 0.738463 4.18552 0.307693 3.69321 0.307693H1.23167C0.739363 0.307693 0.308594 0.738463 0.308594 1.23077V3.69231C0.308594 4.18462 0.739363 4.61539 1.23167 4.61539ZM30.7701 0.307693H28.3086C27.8163 0.307693 27.3855 0.738463 27.3855 1.23077V3.69231C27.3855 4.18462 27.8163 4.61539 28.3086 4.61539H29.0471C28.9855 4.67692 28.924 4.8 28.924 4.92308V6.15385C28.924 6.52308 29.1701 6.76923 29.5394 6.76923C29.9086 6.76923 30.1548 6.52308 30.1548 6.15385V4.92308C30.1548 4.8 30.0932 4.67692 30.0317 4.61539H30.7701C31.2624 4.61539 31.6932 4.18462 31.6932 3.69231V1.23077C31.6932 0.738463 31.2624 0.307693 30.7701 0.307693ZM30.7701 27.3846H30.1548V27.0769C30.1548 26.7077 29.9086 26.4615 29.5394 26.4615C29.1701 26.4615 28.924 26.7077 28.924 27.0769V27.3846H28.3086C27.8163 27.3846 27.3855 27.8154 27.3855 28.3077V28.9231H27.0778C26.7086 28.9231 26.4624 29.1692 26.4624 29.5385C26.4624 29.9077 26.7086 30.1539 27.0778 30.1539H27.3855V30.7692C27.3855 31.2615 27.8163 31.6923 28.3086 31.6923H30.7701C31.2624 31.6923 31.6932 31.2615 31.6932 30.7692V28.3077C31.6932 27.8154 31.2624 27.3846 30.7701 27.3846Z",fill:"#999999"})}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_6137_1319",children:jsxRuntimeExports.jsx("rect",{width:"32",height:"32",fill:"white"})})})]}),LineSvg=()=>jsxRuntimeExports.jsx("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M6.2069 18.6207V21.1034H0V14.8965H6.2069V17.3793H29.7931V14.8965H36V21.1034H29.7931V18.6207H6.2069Z",fill:"#999999"})}),ArrawSvg=()=>jsxRuntimeExports.jsx("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M35.1875 17.9118L25.1875 11.3857V17.2H0.8125V18.8H25.1875V24.6143L35.1875 17.9118Z",fill:"#999999"})}),ClearSvg=()=>jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M11.884 12.8993C11.884 13.3639 11.5054 13.7425 11.0408 13.7425H4.96411C4.74038 13.7425 4.52579 13.6537 4.3675 13.4956C4.2092 13.3375 4.12014 13.123 4.11988 12.8993V3.94589H11.884V12.8993ZM5.80735 2.43241C5.80735 2.33553 5.88248 2.25941 5.98035 2.25941H10.0344C10.1323 2.25941 10.2074 2.33553 10.2074 2.43241V2.94053H5.80735V2.43241ZM14.4138 2.94053H11.2128V2.43241C11.2128 1.78391 10.6839 1.25404 10.0344 1.25404H5.98035C5.66807 1.25483 5.3688 1.37923 5.14798 1.60004C4.92717 1.82086 4.80277 2.12013 4.80198 2.43241V2.94053H1.59015C1.45539 2.94053 1.32615 2.99406 1.23086 3.08935C1.13557 3.18464 1.08203 3.31389 1.08203 3.44865C1.08203 3.58341 1.13557 3.71265 1.23086 3.80794C1.32615 3.90323 1.45539 3.95677 1.59015 3.95677H3.10364V12.8993C3.10364 13.9264 3.93699 14.7578 4.96411 14.7578H11.0398C11.284 14.7579 11.5258 14.7099 11.7515 14.6166C11.9771 14.5233 12.1822 14.3864 12.3549 14.2139C12.5277 14.0413 12.6648 13.8364 12.7583 13.6108C12.8519 13.3853 12.9001 13.1435 12.9003 12.8993V3.94589H14.4128C14.6945 3.94589 14.9219 3.71852 14.9219 3.43777C14.9218 3.37159 14.9085 3.30609 14.8827 3.2451C14.857 3.18411 14.8194 3.12886 14.7721 3.08257C14.7248 3.03628 14.6688 2.99987 14.6072 2.97549C14.5457 2.9511 14.4799 2.93921 14.4138 2.94053ZM8.00195 12.2182C8.28271 12.2182 8.51007 11.9908 8.51007 11.71V6.30262C8.51007 6.16786 8.45654 6.03862 8.36125 5.94333C8.26596 5.84804 8.13672 5.7945 8.00195 5.7945C7.86719 5.7945 7.73795 5.84804 7.64266 5.94333C7.54737 6.03862 7.49383 6.16786 7.49383 6.30262V11.71C7.49383 11.9908 7.7212 12.2182 8.00195 12.2182ZM5.63435 12.2182C5.9151 12.2182 6.14247 11.9908 6.14247 11.71V6.30262C6.14247 6.16786 6.08894 6.03862 5.99365 5.94333C5.89836 5.84804 5.76911 5.7945 5.63435 5.7945C5.49959 5.7945 5.37035 5.84804 5.27506 5.94333C5.17977 6.03862 5.12623 6.16786 5.12623 6.30262V11.71C5.13612 11.9908 5.36349 12.2182 5.63435 12.2182ZM10.3696 12.2182C10.6513 12.2182 10.8787 11.9908 10.8787 11.71V6.30262C10.8787 6.23583 10.8655 6.16969 10.8399 6.10798C10.8144 6.04628 10.7769 5.99021 10.7297 5.94298C10.6825 5.89575 10.6264 5.85828 10.5647 5.83272C10.503 5.80716 10.4368 5.79401 10.3701 5.79401C10.3033 5.79401 10.2371 5.80716 10.1754 5.83272C10.1137 5.85828 10.0576 5.89575 10.0104 5.94298C9.96318 5.99021 9.92571 6.04628 9.90015 6.10798C9.87459 6.16969 9.86144 6.23583 9.86144 6.30262V11.71C9.86144 11.9908 10.0888 12.2182 10.3696 12.2182Z"})}),KeyBoard=()=>jsxRuntimeExports.jsx("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M9.83398 4.15039C11.3405 4.15201 12.7852 4.75035 13.8506 5.81543C14.9161 6.88062 15.5156 8.32539 15.5176 9.83203V13.4824H20.4844V9.83594L20.4922 9.55371C20.5632 8.14986 21.152 6.81818 22.1504 5.81934C23.2155 4.75392 24.6596 4.15448 26.166 4.15234C27.6725 4.15384 29.1171 4.75238 30.1826 5.81738C31.2482 6.88257 31.8476 8.32733 31.8496 9.83398L31.8428 10.1152C31.7718 11.5193 31.1832 12.8516 30.1846 13.8506C29.1194 14.9161 27.6746 15.5156 26.168 15.5176H22.5176V20.4844H26.168C27.6743 20.4864 29.1185 21.0862 30.1836 22.1514C31.182 23.1499 31.7714 24.4812 31.8428 25.8848L31.8496 26.167C31.8479 27.6732 31.2494 29.1173 30.1846 30.1826C29.1194 31.2482 27.6746 31.8476 26.168 31.8496L25.8867 31.8428C24.4827 31.7718 23.1503 31.1832 22.1514 30.1846C21.0858 29.1194 20.4864 27.6746 20.4844 26.168V22.5176H15.5176V26.168L15.5098 26.4502C15.4383 27.8537 14.849 29.1851 13.8506 30.1836C12.7855 31.2486 11.3412 31.8466 9.83496 31.8486C8.32824 31.8474 6.88316 31.2496 5.81738 30.1846C4.75165 29.1194 4.15238 27.6748 4.15039 26.168L4.15723 25.8867C4.22817 24.4827 4.81682 23.1503 5.81543 22.1514C6.81394 21.1525 8.14594 20.5637 9.5498 20.4922L9.83203 20.4844H13.4824V15.5176H9.83594L9.55371 15.5098C8.14943 15.4392 6.81665 14.8511 5.81738 13.8525C4.75158 12.7874 4.15253 11.3427 4.15039 9.83594C4.15139 8.32878 4.74997 6.88336 5.81543 5.81738C6.81442 4.81806 8.14719 4.22829 9.55176 4.15723L9.83398 4.15039ZM9.68555 22.5225C7.74117 22.6014 6.18669 24.2064 6.18652 26.168C6.18652 28.1818 7.82394 29.8193 9.83594 29.8193C11.8497 29.8191 13.4863 28.1817 13.4863 26.168V22.5176H9.68555V22.5225ZM22.5176 26.168C22.5176 28.1817 24.1542 29.8192 26.168 29.8193C28.182 29.8193 29.8174 28.1817 29.8174 26.168C29.8172 24.1543 28.1799 22.5176 26.168 22.5176H22.5176V26.168ZM15.5176 20.4844H20.4844V15.5195H15.5176V20.4844ZM9.83594 6.18652C7.82195 6.18652 6.18652 7.82412 6.18652 9.83789C6.18673 11.8497 7.82412 13.4863 9.83594 13.4863H13.4863V9.83594C13.4863 7.82405 11.8496 6.18671 9.83594 6.18652ZM26.168 6.18652C24.1543 6.18669 22.5176 7.82404 22.5176 9.83594V13.4863H26.168C28.1818 13.4863 29.8172 11.8495 29.8174 9.83594C29.8174 7.82206 28.1818 6.18652 26.168 6.18652Z",fill:"#999999",stroke:"white",strokeWidth:"0.3"})}),Drawx6=React.forwardRef((e,t)=>{const{height:r="300px",maskTip:n="点击画板进入绘制",value:i,onSave:o,savePngType:a="url",showSaveBtn:s}=e,[l,c]=React.useState(!1),u=React.useRef(null);return React.useImperativeHandle(t,()=>{var e;return{getIsFullScreen:()=>l,getData:null==(e=u.current)?void 0:e.getData}}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Show,{height:r,value:i,maskTip:n,maskClick:()=>{c(!0)}}),l&&jsxRuntimeExports.jsx(Editor,{ref:u,value:i,savePngType:a,editabled:!0,onSave:o,onExit:()=>{c(!1)},showSaveBtn:s})]})}),Draw=e=>{const{status:t=QuestionStatus.EXAM,data:r,onSubmit:n}=e,[i,o]=React.useState(),a=React.useRef(null),s=(e,i=!0)=>{if("exam"!==t)return;const a={userAnswerOption:{content:null==e?void 0:e.json,photo:null==e?void 0:e.png},questionCode:null==r?void 0:r.questionCode};o(null==e?void 0:e.json),null==n||n(a),i&&staticMethods.success("保存成功")};return React.useEffect(()=>{if("exam"!==t)return;const e=async e=>{var t,r;const{type:n}=e.data??{};if("examTimeEnd5"===n&&(null==(t=a.current)?void 0:t.getIsFullScreen())){const e=await(null==(r=a.current)?void 0:r.getData());s(e,!1)}};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[t]),React.useEffect(()=>{if(r){const{answerOption:e}=r;e&&!Array.isArray(e)&&o(null==e?void 0:e.content)}},[r,t]),jsxRuntimeExports.jsxs("div",{className:"draw-question",children:[jsxRuntimeExports.jsx("div",{className:"draw-question-title",children:jsxRuntimeExports.jsxs("div",{className:"draw-question-title-content",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("span",{className:"score",children:[null==r?void 0:r.score,"分"]}),jsxRuntimeExports.jsx("span",{className:"type",children:"画图题"}),((null==r?void 0:r.hasAutoScore)??(null==r?void 0:r.judgeMode)===CCMJudgeMode.AI_AGENT)&&jsxRuntimeExports.jsx("span",{className:"auto",children:"自动判分"})]}),jsxRuntimeExports.jsx(RichEditor,{isBorder:!1,noPadding:!0,defaultValue:null==r?void 0:r.topic,readOnly:!0,autoHeight:{min:0,max:1e5}})]})}),jsxRuntimeExports.jsxs("div",{className:"draw-question-content",children:[jsxRuntimeExports.jsx(Drawx6,{ref:a,value:i,showSaveBtn:"mark"!==t&&"view"!==t,onSave:s,maskTip:"mark"===t||"view"===t?"点击画板查看答题":"点击画板进入答题"}),["add","mark"].includes(t)&&!!(null==r?void 0:r.judgeNorm)&&jsxRuntimeExports.jsx(Collapse,{defaultActiveKey:"add"===t?["1"]:[],ghost:!0,expandIcon:({isActive:e})=>jsxRuntimeExports.jsx(RefIcon$i,{rotate:e?90:0}),items:[{key:"1",label:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("span",{style:{fontWeight:"bold"},children:"判分标准"}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",color:"#999999"},children:"(学生不可见)"})]}),children:jsxRuntimeExports.jsx(RichEditor,{isBorder:!1,readOnly:!0,defaultValue:r.judgeNorm,noPadding:!0,autoHeight:{min:0,max:1e4}})}]}),r.difficulty&&jsxRuntimeExports.jsx("div",{className:"draw-question-content-others",children:jsxRuntimeExports.jsxs("div",{className:"difficulty",children:[jsxRuntimeExports.jsx("span",{children:"题目难度:"}),jsxRuntimeExports.jsx("span",{children:difficultyMap[r.difficulty]})]})})]})]},null==r?void 0:r.questionCode)},Composite=e=>{var t;const{data:r}=e,{children:n,difficulty:i,topic:o,score:a}=r,[s,l]=React.useState([]),c=React.useRef(null);return React.useEffect(()=>{const e=null==n?void 0:n.map((e,t)=>(null==e?void 0:e.questionCode)||t);l(e)},[null==(t=null==r?void 0:r.children)?void 0:t.length]),jsxRuntimeExports.jsxs("div",{className:"composite",children:[jsxRuntimeExports.jsx("div",{className:"composite-title",children:jsxRuntimeExports.jsxs("div",{className:"composite-title-content",children:[jsxRuntimeExports.jsxs("div",{children:[a&&jsxRuntimeExports.jsxs("span",{className:"score",children:[a,"分"]}),jsxRuntimeExports.jsx("span",{className:"type",children:"组合题"}),(null==r?void 0:r.hasAutoScore)&&jsxRuntimeExports.jsx("span",{className:"auto",children:"自动判分"})]}),jsxRuntimeExports.jsx(RichEditor,{isBorder:!1,noPadding:!0,defaultValue:o,readOnly:!0,autoHeight:{min:0,max:1e5}})]})}),jsxRuntimeExports.jsxs("div",{className:"composite-content",children:[jsxRuntimeExports.jsx(Collapse,{activeKey:s,ghost:!0,ref:c,expandIcon:({isActive:e})=>jsxRuntimeExports.jsx(RefIcon$i,{rotate:e?90:0}),onChange:e=>{l(Array.isArray(e)?e:[e])},items:null==n?void 0:n.map((e,t)=>({key:(null==e?void 0:e.questionCode)||t,label:`第${t+1}小题(${questionTypesMap[null==e?void 0:e.type]})`,children:jsxRuntimeExports.jsx(QuestionRender,{data:e})}))}),jsxRuntimeExports.jsx("div",{className:"composite-content-others",children:i&&jsxRuntimeExports.jsxs("div",{className:"difficulty",children:[jsxRuntimeExports.jsx("span",{children:"题目难度:"}),jsxRuntimeExports.jsx("span",{children:difficultyMap[i]})]})})]})]})},QuestionRender=React.forwardRef((e,t)=>{const{data:r,questionProps:n={},listeners:i}=e,{onSubmit:o,onNextQuestion:a,editable:s=!1,deleteable:l=!1,onDelete:c=()=>{},onEditOk:u=()=>{},buttonText:d="",showQuestionTip:p=!1,langList:h,showResult:f,status:g=QuestionStatus.PREVIEW,className:m="",styles:v={},uploadImg:y,codeTestURL:b,codeplayerURL:q,rightTopButtonArr:V,unknowQesutionRender:S,QuestionTopRender:E,QuestionBottomRender:x,onlyAdd:C,toRunCodeQuestion:w}=n,[R,A]=React.useState(!1),[T,k]=React.useState(!0),[N,P]=React.useState(!1),[O,F]=React.useState(""),_=React.useMemo(()=>{const e={...r},{optionJson:t,type:n}=r;return!t||n!==QuestionTypeEnum.ACM&&n!==QuestionTypeEnum.CCM||(e.lang=null==t?void 0:t.defaultLanguage),e},[r]);React.useImperativeHandle(t,()=>({setEditShow:e=>A(e),setShowOperateButton:k,addQuestion:()=>{P(!0)}}));const[D,I]=React.useState((e=>{switch(e){case QuestionTypeEnum.RADIO:return"";case QuestionTypeEnum.CHECKBOX:return[];case QuestionTypeEnum.ANSWER:case QuestionTypeEnum.JUDGE:return"";case QuestionTypeEnum.ACM:case QuestionTypeEnum.CCM:return{code:"",language:"javascript"};case QuestionTypeEnum.COMPLETION:return[];case QuestionTypeEnum.DRAW:case QuestionTypeEnum.COMPOSITE:return{};default:return null}})(_.type)),U=e=>jsxRuntimeExports.jsx(QuestionContext.Provider,{value:{topProps:{uploadImg:y}},children:jsxRuntimeExports.jsxs("div",{className:`question-wrapper ${m}`,style:{...v},children:[T&&jsxRuntimeExports.jsxs("div",{className:"operate-area",children:[s&&jsxRuntimeExports.jsx(Tooltip,{title:"编辑",children:jsxRuntimeExports.jsx(Button$1,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$a,{}),onClick:()=>A(!0)},"edit")}),l&&jsxRuntimeExports.jsx(Tooltip,{title:"删除",children:jsxRuntimeExports.jsx(Button$1,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$e,{}),onClick:()=>c(_)},"delete")}),(null==V?void 0:V.length)&&V.map(e=>{const{text:r,icon:n,needBindRef:o}=e,a={...e};return delete a.needBindRef,jsxRuntimeExports.jsx(Tooltip,{title:r,children:React.createElement(Button$1,{...a,ref:o?t:null,size:"small",key:r??(null==n?void 0:n.toString()),"data-cypress":o?"draggable-handle":"",...o?i:{}})},r??(null==n?void 0:n.toString()))})]}),E&&E(_),e,x&&x(_)]})}),L={data:_,onSubmit:o,buttonText:d,status:g,onNextQuestion:a};if(C)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(QuestionContext.Provider,{value:{topProps:{uploadImg:y}},children:N&&jsxRuntimeExports.jsx(Modal,{style:{top:"40%"},open:N,footer:null,title:"请选择题型",width:300,onCancel:()=>{P(!1),F("")},children:jsxRuntimeExports.jsx(Select,{style:{width:"100%"},placeholder:"请选择",onChange:e=>{P(!1),F(e),A(!0)},options:questionTypeSelectOptions})})})});switch(_.type){case QuestionTypeEnum.RADIO:case QuestionTypeEnum.CHECKBOX:return(()=>{const e=jsxRuntimeExports.jsx(ChoiceQuestion,{showQuestionTip:p,showResult:f,...L});return U(e)})();case QuestionTypeEnum.ACM:case QuestionTypeEnum.CCM:return(()=>{const e=jsxRuntimeExports.jsx(Preview,{codeTestURL:b,codeplayerURL:q,toRunCodeQuestion:w,...L});return U(e)})();case QuestionTypeEnum.COMPLETION:return(()=>{const e=jsxRuntimeExports.jsx(Completion,{showResult:f,...L});return U(e)})();case QuestionTypeEnum.ANSWER:return(()=>{const e=jsxRuntimeExports.jsx(AnswerQuestion,{...L});return U(e)})();case QuestionTypeEnum.DRAW:return(()=>{const e=jsxRuntimeExports.jsx(Draw,{...L});return U(e)})();case QuestionTypeEnum.COMPOSITE:return(()=>{const e=jsxRuntimeExports.jsx(Composite,{...L});return U(e)})();default:return S?S(_):jsxRuntimeExports.jsx("div",{children:"未知题型"})}}),useQuestionRender=()=>{const e=React.useRef(null);return{ref:e,setEditShow:t=>{var r,n;return null==(n=null==(r=e.current)?void 0:r.setEditShow)?void 0:n.call(r,t)},setShowOperateButton:t=>{var r,n;return null==(n=null==(r=e.current)?void 0:r.setShowOperateButton)?void 0:n.call(r,t)}}},QuestionPractice=({questionsList:e,questionOperations:t,submitQuestion:r,getCodeSaveAnswer:n,createQuestionCallback:i})=>{var o,a,s;const[l,c]=React.useState(0),[u,d]=React.useState(!1),[p,h]=React.useState(),[f,g]=React.useState(),[m,v]=React.useState(!1),[y,b]=React.useState(!1);React.useEffect(()=>{(null==E?void 0:E.userAnswer)?b(!0):b(!1)},[l,e]);const q=React.useRef(null),V=()=>{d(!0),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{d(!1)},0)},S=e=>{const t=E,r=e||t.userAnswer,{answer:n,answerOption:i}=t;switch(t.type){case QuestionTypeEnum.CHECKBOX:case QuestionTypeEnum.RADIO:return r===n||r&&isArrayEqual(null==r?void 0:r.split(","),null==n?void 0:n.split(","));case QuestionTypeEnum.COMPLETION:return null==i?void 0:i.every((e,t)=>{var n;return(null==e?void 0:e.answer)===(null==(n=null==r?void 0:r[t])?void 0:n.answer)});default:return!0}},E=React.useMemo(()=>e?e[l]:{},[l,e]);return jsxRuntimeExports.jsx("div",{className:"tailwind-scoped questionPractice",children:(null==e?void 0:e.length)>0?jsxRuntimeExports.jsxs(Splitter,{style:{maxHeight:"568px"},children:[jsxRuntimeExports.jsx(Splitter.Panel,{min:275,max:400,defaultSize:300,children:jsxRuntimeExports.jsx("div",{className:"mr",style:{height:"100%"},children:jsxRuntimeExports.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-sm overflow-y-auto h-full",children:[jsxRuntimeExports.jsx("h3",{className:"font-semibold text-gray-800 mb-4",children:"题目列表"}),(null==e?void 0:e.length)>0&&jsxRuntimeExports.jsx("div",{className:"space-y-3 pr-[12px] left-que-item",children:e.map((t,r)=>{var n,i,o;return jsxRuntimeExports.jsxs("button",{onClick:()=>{c(r),V()},className:"w-full text-left p-4 rounded-lg border-2 transition-all "+(l===r?"border-blue-500 bg-blue-50 shadow-md":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"),children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntimeExports.jsx("span",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium "+(l===r?"bg-blue-600 text-white":"bg-gray-200 text-gray-600"),children:r+1}),jsxRuntimeExports.jsx("div",{className:"p-1 rounded "+(l===r?"bg-blue-100":"bg-gray-100"),children:getQuestionTypeIcon(t.type)}),e[r].userAnswer&&jsxRuntimeExports.jsx("div",{className:"text-xs px-2 py-1 rounded-1 font-medium text-green-500 bg-green-100}",children:"已完成"})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntimeExports.jsx("span",{className:`text-xs px-2 py-1 rounded-full font-medium ${getDifficultyColor(t.difficulty||"")}`,children:"low"===t.difficulty?"简单":"middle"===t.difficulty?"中等":"困难"}),t.score?jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1 text-xs text-gray-500",children:[jsxRuntimeExports.jsx(Star,{className:"w-3 h-3"}),jsxRuntimeExports.jsx("span",{children:t.score})]}):null]})]}),jsxRuntimeExports.jsx(Tooltip,{title:(t.topic||t.content||"").replace(/<[^>]*>/g,""),children:jsxRuntimeExports.jsx("h4",{className:"font-medium text-sm mb-1 text-ellipsis line-clamp-2 "+(l===r?"text-blue-800":"text-gray-800"),children:jsxRuntimeExports.jsx("span",{dangerouslySetInnerHTML:{__html:t.topic||t.content||""}})})}),jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[(null==(n=null==t?void 0:t.labels)?void 0:n.length)?jsxRuntimeExports.jsx("span",{className:"text-xs text-blue-600 bg-blue-100 px-2 py-1 rounded-full",children:null==(o=null==(i=null==t?void 0:t.labels)?void 0:i[0])?void 0:o.labelName}):jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-500",children:getQuestionTypeName(t.type)})]})]},t.content||""+r)})})]})})}),jsxRuntimeExports.jsx(Splitter.Panel,{children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("div",{className:"bg-white rounded-lg pb-5 pt-4 relative",children:[!u&&E&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{className:"flex justify-end ant-btn-important absolute top-3 right-3 z-10",children:null==t?void 0:t(E)}),jsxRuntimeExports.jsx(QuestionRender,{data:E,questionProps:{onSubmit:e=>{null==r||r(E,e)},toRunCodeQuestion:()=>(async e=>{var t,r;h(e);const{lang:i="",topic:o,content:a,title:s,exampleList:l,verifyMode:c,userAnswer:u,optionJson:d}=e;let f=u||(null==n?void 0:n(p));g({lang:i||(null==(t=null==d?void 0:d.languages)?void 0:t[0]),topic:o||s,content:a,verifyMode:c||(null==d?void 0:d.verifyMode)||(null==(r=null==e?void 0:e.optionJson)?void 0:r.verifyMode),code:f,cases:l||e.testCaseList||e.exampleList}),v(!0)})(E),showResult:!0,onNextQuestion:()=>{l<e.length-1?(c(l+1),V(),b(!1)):staticMethods.warning("已经是最后一题了")}}})]},E.id+E.questionId+E.userAnswer),y&&(null==E?void 0:E.type)!==QuestionTypeEnum.CCM&&(null==E?void 0:E.type)!==QuestionTypeEnum.ACM&&jsxRuntimeExports.jsxs("div",{className:"question-result mt-6 p-4 rounded-lg "+(S()?"bg-green-50 border border-green-200":"bg-red-50 border border-red-200"),children:[[QuestionTypeEnum.RADIO,QuestionTypeEnum.CHECKBOX,QuestionTypeEnum.COMPLETION].includes(E.type)&&jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[S()?jsxRuntimeExports.jsx(CircleCheckBig,{className:"w-5 h-5 text-green-600"}):jsxRuntimeExports.jsx(CircleX,{className:"w-5 h-5 text-red-600"}),jsxRuntimeExports.jsx("span",{className:"font-medium "+(S()?"text-green-800":"text-red-800"),children:S()?"回答正确!":"回答错误"}),!S()&&jsxRuntimeExports.jsx("span",{className:"text-red-600 text-sm bg-red-100 px-2 py-1 rounded-full",children:"已加入错题本"})]}),jsxRuntimeExports.jsx("div",{className:"text-gray-700 text-sm",children:(null==E?void 0:E.analyze)&&jsxRuntimeExports.jsxs("div",{className:"analyze",children:[jsxRuntimeExports.jsx("div",{className:"analyzeTitle",children:"答案分析"}),jsxRuntimeExports.jsx("div",{className:"analyzeContent",children:"answer"===E.type?jsxRuntimeExports.jsx(MyReactMarkdown,{children:(null==(o=null==E?void 0:E.analyze)?void 0:o.answerAnalysis)||(null==(a=null==E?void 0:E.analyze)?void 0:a.answer)}):jsxRuntimeExports.jsx(MyReactMarkdown,{children:null==(s=null==E?void 0:E.analyze)?void 0:s.answerAnalysis})})]})})]})]})})})]}):jsxRuntimeExports.jsx(Empty,{image:Empty.PRESENTED_IMAGE_SIMPLE,description:jsxRuntimeExports.jsxs("div",{className:"emptyDescription",children:["暂无相关题目 ",i&&jsxRuntimeExports.jsx("span",{onClick:()=>i(),children:"现在生成"})]})})})};function _getDefaults(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let _defaults=_getDefaults();function changeDefaults(e){_defaults=e}const escapeTest=/[&<>"']/,escapeReplace=new RegExp(escapeTest.source,"g"),escapeTestNoEncode=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode=new RegExp(escapeTestNoEncode.source,"g"),escapeReplacements={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},getEscapeReplacement=e=>escapeReplacements[e];function escape$1(e,t){if(t){if(escapeTest.test(e))return e.replace(escapeReplace,getEscapeReplacement)}else if(escapeTestNoEncode.test(e))return e.replace(escapeReplaceNoEncode,getEscapeReplacement);return e}const caret=/(^|[^\[])\^/g;function edit(e,t){let r="string"==typeof e?e:e.source;t=t||"";const n={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(caret,"$1"),r=r.replace(e,i),n},getRegex:()=>new RegExp(r,t)};return n}function cleanUrl(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const noopTest={exec:()=>null};function splitCells(e,t){const r=e.replace(/\|/g,(e,t,r)=>{let n=!1,i=t;for(;--i>=0&&"\\"===r[i];)n=!n;return n?"|":" |"}).split(/ \|/);let n=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(/\\\|/g,"|");return r}function rtrim(e,t,r){const n=e.length;if(0===n)return"";let i=0;for(;i<n;){if(e.charAt(n-i-1)!==t)break;i++}return e.slice(0,n-i)}function findClosingBracket(e,t){if(-1===e.indexOf(t[1]))return-1;let r=0;for(let n=0;n<e.length;n++)if("\\"===e[n])n++;else if(e[n]===t[0])r++;else if(e[n]===t[1]&&(r--,r<0))return n;return-1}function outputLink(e,t,r,n){const i=t.href,o=t.title?escape$1(t.title):null,a=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){n.state.inLink=!0;const e={type:"link",raw:r,href:i,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,e}return{type:"image",raw:r,href:i,title:o,text:escape$1(a)}}function indentCodeCompensation(e,t){const r=e.match(/^(\s+)(?:```)/);if(null===r)return t;const n=r[1];return t.split("\n").map(e=>{const t=e.match(/^\s+/);if(null===t)return e;const[r]=t;return r.length>=n.length?e.slice(n.length):e}).join("\n")}class _Tokenizer{constructor(e){__publicField(this,"options"),__publicField(this,"rules"),__publicField(this,"lexer"),this.options=e||_defaults}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:rtrim(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],r=indentCodeCompensation(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=rtrim(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:rtrim(t[0],"\n")}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=rtrim(t[0],"\n").split("\n"),r="",n="";const i=[];for(;e.length>0;){let t=!1;const o=[];let a;for(a=0;a<e.length;a++)if(/^ {0,3}>/.test(e[a]))o.push(e[a]),t=!0;else{if(t)break;o.push(e[a])}e=e.slice(a);const s=o.join("\n"),l=s.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1").replace(/^ {0,3}>[ \t]?/gm,"");r=r?`${r}\n${s}`:s,n=n?`${n}\n${l}`:l;const c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,i,!0),this.lexer.state.top=c,0===e.length)break;const u=i[i.length-1];if("code"===(null==u?void 0:u.type))break;if("blockquote"===(null==u?void 0:u.type)){const t=u,o=t.raw+"\n"+e.join("\n"),a=this.blockquote(o);i[i.length-1]=a,r=r.substring(0,r.length-t.raw.length)+a.raw,n=n.substring(0,n.length-t.text.length)+a.text;break}if("list"===(null==u?void 0:u.type)){const t=u,o=t.raw+"\n"+e.join("\n"),a=this.list(o);i[i.length-1]=a,r=r.substring(0,r.length-u.raw.length)+a.raw,n=n.substring(0,n.length-t.raw.length)+a.raw,e=o.substring(i[i.length-1].raw.length).split("\n");continue}}return{type:"blockquote",raw:r,tokens:i,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim();const n=r.length>1,i={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");const o=new RegExp(`^( {0,3}${r})((?:[\t ][^\\n]*)?(?:\\n|$))`);let a=!1;for(;e;){let r=!1,n="",s="";if(!(t=o.exec(e)))break;if(this.rules.block.hr.test(e))break;n=t[0],e=e.substring(n.length);let l=t[2].split("\n",1)[0].replace(/^\t+/,e=>" ".repeat(3*e.length)),c=e.split("\n",1)[0],u=!l.trim(),d=0;if(this.options.pedantic?(d=2,s=l.trimStart()):u?d=t[1].length+1:(d=t[2].search(/[^ ]/),d=d>4?1:d,s=l.slice(d),d+=t[1].length),u&&/^ *$/.test(c)&&(n+=c+"\n",e=e.substring(c.length+1),r=!0),!r){const t=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),r=new RegExp(`^ {0,${Math.min(3,d-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),i=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:\`\`\`|~~~)`),o=new RegExp(`^ {0,${Math.min(3,d-1)}}#`);for(;e;){const a=e.split("\n",1)[0];if(c=a,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),i.test(c))break;if(o.test(c))break;if(t.test(c))break;if(r.test(e))break;if(c.search(/[^ ]/)>=d||!c.trim())s+="\n"+c.slice(d);else{if(u)break;if(l.search(/[^ ]/)>=4)break;if(i.test(l))break;if(o.test(l))break;if(r.test(l))break;s+="\n"+c}u||c.trim()||(u=!0),n+=a+"\n",e=e.substring(a.length+1),l=c.slice(d)}}i.loose||(a?i.loose=!0:/\n *\n *$/.test(n)&&(a=!0));let p,h=null;this.options.gfm&&(h=/^\[[ xX]\] /.exec(s),h&&(p="[ ] "!==h[0],s=s.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:n,task:!!h,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=n}i.items[i.items.length-1].raw=i.items[i.items.length-1].raw.trimEnd(),i.items[i.items.length-1].text=i.items[i.items.length-1].text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){const t=i.items[e].tokens.filter(e=>"space"===e.type),r=t.length>0&&t.some(e=>/\n.*\n/.test(e.raw));i.loose=r}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),r=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:r,title:n}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const r=splitCells(t[1]),n=t[2].replace(/^\||\| *$/g,"").split("|"),i=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===n.length){for(const e of n)/^ *-+: *$/.test(e)?o.align.push("right"):/^ *:-+: *$/.test(e)?o.align.push("center"):/^ *:-+ *$/.test(e)?o.align.push("left"):o.align.push(null);for(let e=0;e<r.length;e++)o.header.push({text:r[e],tokens:this.lexer.inline(r[e]),header:!0,align:o.align[e]});for(const e of i)o.rows.push(splitCells(e,o.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:o.align[t]})));return o}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:escape$1(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=rtrim(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=findClosingBracket(t[2],"()");if(e>-1){const r=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let r=t[2],n="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);e&&(r=e[1],n=e[3])}else n=t[3]?t[3].slice(1,-1):"";return r=r.trim(),/^</.test(r)&&(r=this.options.pedantic&&!/>$/.test(e)?r.slice(1):r.slice(1,-1)),outputLink(t,{href:r?r.replace(this.rules.inline.anyPunctuation,"$1"):r,title:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n},t[0],this.lexer)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){const e=t[(r[2]||r[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=r[0].charAt(0);return{type:"text",raw:e,text:e}}return outputLink(r,e,r[0],this.lexer)}}emStrong(e,t,r=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!n)return;if(n[3]&&r.match(/[\p{L}\p{N}]/u))return;if(!(n[1]||n[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const r=[...n[0]].length-1;let i,o,a=r,s=0;const l="*"===n[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+r);null!=(n=l.exec(t));){if(i=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!i)continue;if(o=[...i].length,n[3]||n[4]){a+=o;continue}if((n[5]||n[6])&&r%3&&!((r+o)%3)){s+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+s);const t=[...n[0]][0].length,l=e.slice(0,r+n.index+t+o);if(Math.min(r,o)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const r=/[^ ]/.test(e),n=/^ /.test(e)&&/ $/.test(e);return r&&n&&(e=e.substring(1,e.length-1)),e=escape$1(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,r;return"@"===t[2]?(e=escape$1(t[1]),r="mailto:"+e):(e=escape$1(t[1]),r=e),{type:"link",raw:t[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}url(e){var t;let r;if(r=this.rules.inline.url.exec(e)){let e,n;if("@"===r[2])e=escape$1(r[0]),n="mailto:"+e;else{let i;do{i=r[0],r[0]=(null==(t=this.rules.inline._backpedal.exec(r[0]))?void 0:t[0])??""}while(i!==r[0]);e=escape$1(r[0]),n="www."===r[1]?"http://"+r[0]:r[0]}return{type:"link",raw:r[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:escape$1(t[0]),{type:"text",raw:t[0],text:e}}}}const newline=/^(?: *(?:\n|$))+/,blockCode=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bullet=/(?:[*+-]|\d{1,9}[.)])/,lheading=edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,bullet).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),_paragraph=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,blockText=/^[^\n]+/,_blockLabel=/(?!\s*\])(?:\\.|[^\[\]\\])+/,def=edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",_blockLabel).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),list=edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bullet).getRegex(),_tag="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_comment=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,html$3=edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",_comment).replace("tag",_tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),paragraph=edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockquote=edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",paragraph).getRegex(),blockNormal={blockquote:blockquote,code:blockCode,def:def,fences:fences,heading:heading,hr:hr,html:html$3,lheading:lheading,list:list,newline:newline,paragraph:paragraph,table:noopTest,text:blockText},gfmTable=edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockGfm={...blockNormal,table:gfmTable,paragraph:edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",gfmTable).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex()},blockPedantic={...blockNormal,html:edit("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",_comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:noopTest,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:edit(_paragraph).replace("hr",hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",lheading).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},escape$2=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,inlineCode=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br=/^( {2,}|\\)\n(?!\s*$)/,inlineText=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_punctuation="\\p{P}\\p{S}",punctuation=edit(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,_punctuation).getRegex(),blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,emStrongLDelim=edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,_punctuation).getRegex(),emStrongRDelimAst=edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,_punctuation).getRegex(),emStrongRDelimUnd=edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,_punctuation).getRegex(),anyPunctuation=edit(/\\([punct])/,"gu").replace(/punct/g,_punctuation).getRegex(),autolink=edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_inlineComment=edit(_comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),tag=edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_inlineComment).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_inlineLabel=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,link=edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",_inlineLabel).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),reflink=edit(/^!?\[(label)\]\[(ref)\]/).replace("label",_inlineLabel).replace("ref",_blockLabel).getRegex(),nolink=edit(/^!?\[(ref)\](?:\[\])?/).replace("ref",_blockLabel).getRegex(),reflinkSearch=edit("reflink|nolink(?!\\()","g").replace("reflink",reflink).replace("nolink",nolink).getRegex(),inlineNormal={_backpedal:noopTest,anyPunctuation:anyPunctuation,autolink:autolink,blockSkip:blockSkip,br:br,code:inlineCode,del:noopTest,emStrongLDelim:emStrongLDelim,emStrongRDelimAst:emStrongRDelimAst,emStrongRDelimUnd:emStrongRDelimUnd,escape:escape$2,link:link,nolink:nolink,punctuation:punctuation,reflink:reflink,reflinkSearch:reflinkSearch,tag:tag,text:inlineText,url:noopTest},inlinePedantic={...inlineNormal,link:edit(/^!?\[(label)\]\((.*?)\)/).replace("label",_inlineLabel).getRegex(),reflink:edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_inlineLabel).getRegex()},inlineGfm={...inlineNormal,escape:edit(escape$2).replace("])","~|])").getRegex(),url:edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},inlineBreaks={...inlineGfm,br:edit(br).replace("{2,}","*").getRegex(),text:edit(inlineGfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},block={normal:blockNormal,gfm:blockGfm,pedantic:blockPedantic},inline={normal:inlineNormal,gfm:inlineGfm,breaks:inlineBreaks,pedantic:inlinePedantic};class _Lexer{constructor(e){__publicField(this,"tokens"),__publicField(this,"options"),__publicField(this,"state"),__publicField(this,"tokenizer"),__publicField(this,"inlineQueue"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||_defaults,this.options.tokenizer=this.options.tokenizer||new _Tokenizer,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:block.normal,inline:inline.normal};this.options.pedantic?(t.block=block.pedantic,t.inline=inline.pedantic):this.options.gfm&&(t.block=block.gfm,this.options.breaks?t.inline=inline.breaks:t.inline=inline.gfm),this.tokenizer.rules=t}static get rules(){return{block:block,inline:inline}}static lex(e,t){return new _Lexer(t).lex(e)}static lexInline(e,t){return new _Lexer(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const e=this.inlineQueue[t];this.inlineTokens(e.src,e.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){let n,i,o;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,(e,t,r)=>t+" ".repeat(r.length));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?t.push(n):(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(i.raw+="\n"+n.raw,i.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(o=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const r=e.slice(1);let n;this.options.extensions.startBlock.forEach(e=>{n=e.call({lexer:this},r),"number"==typeof n&&n>=0&&(t=Math.min(t,n))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o)))i=t[t.length-1],r&&"paragraph"===(null==i?void 0:i.type)?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),r=o.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r,n,i,o,a,s,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(o=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,o.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(a||(s=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))if(r=this.tokenizer.escape(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.tag(e))e=e.substring(r.raw.length),n=t[t.length-1],n&&"text"===r.type&&"text"===n.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);else if(r=this.tokenizer.link(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(r.raw.length),n=t[t.length-1],n&&"text"===r.type&&"text"===n.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);else if(r=this.tokenizer.emStrong(e,l,s))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.codespan(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.br(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.del(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.autolink(e))e=e.substring(r.raw.length),t.push(r);else if(this.state.inLink||!(r=this.tokenizer.url(e))){if(i=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const r=e.slice(1);let n;this.options.extensions.startInline.forEach(e=>{n=e.call({lexer:this},r),"number"==typeof n&&n>=0&&(t=Math.min(t,n))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i))e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(s=r.raw.slice(-1)),a=!0,n=t[t.length-1],n&&"text"===n.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(t)}}else e=e.substring(r.raw.length),t.push(r);return t}}class _Renderer{constructor(e){__publicField(this,"options"),__publicField(this,"parser"),this.options=e||_defaults}space(e){return""}code({text:e,lang:t,escaped:r}){var n;const i=null==(n=(t||"").match(/^\S*/))?void 0:n[0],o=e.replace(/\n$/,"")+"\n";return i?'<pre><code class="language-'+escape$1(i)+'">'+(r?o:escape$1(o,!0))+"</code></pre>\n":"<pre><code>"+(r?o:escape$1(o,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){const t=e.ordered,r=e.start;let n="";for(let o=0;o<e.items.length;o++){const t=e.items[o];n+=this.listitem(t)}const i=t?"ol":"ul";return"<"+i+(t&&1!==r?' start="'+r+'"':"")+">\n"+n+"</"+i+">\n"}listitem(e){let t="";if(e.task){const r=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&"paragraph"===e.tokens[0].type?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=r+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" "}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",r="";for(let i=0;i<e.header.length;i++)r+=this.tablecell(e.header[i]);t+=this.tablerow({text:r});let n="";for(let i=0;i<e.rows.length;i++){const t=e.rows[i];r="";for(let e=0;e<t.length;e++)r+=this.tablecell(t[e]);n+=this.tablerow({text:r})}return n&&(n=`<tbody>${n}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+n+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){const t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${e}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){const n=this.parser.parseInline(r),i=cleanUrl(e);if(null===i)return n;let o='<a href="'+(e=i)+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>",o}image({href:e,title:t,text:r}){const n=cleanUrl(e);if(null===n)return r;let i=`<img src="${e=n}" alt="${r}"`;return t&&(i+=` title="${t}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}}class _TextRenderer{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class _Parser{constructor(e){__publicField(this,"options"),__publicField(this,"renderer"),__publicField(this,"textRenderer"),this.options=e||_defaults,this.options.renderer=this.options.renderer||new _Renderer,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _TextRenderer}static parse(e,t){return new _Parser(t).parse(e)}static parseInline(e,t){return new _Parser(t).parseInline(e)}parse(e,t=!0){let r="";for(let n=0;n<e.length;n++){const i=e[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){r+=t||"";continue}}const o=i;switch(o.type){case"space":r+=this.renderer.space(o);continue;case"hr":r+=this.renderer.hr(o);continue;case"heading":r+=this.renderer.heading(o);continue;case"code":r+=this.renderer.code(o);continue;case"table":r+=this.renderer.table(o);continue;case"blockquote":r+=this.renderer.blockquote(o);continue;case"list":r+=this.renderer.list(o);continue;case"html":r+=this.renderer.html(o);continue;case"paragraph":r+=this.renderer.paragraph(o);continue;case"text":{let i=o,a=this.renderer.text(i);for(;n+1<e.length&&"text"===e[n+1].type;)i=e[++n],a+="\n"+this.renderer.text(i);r+=t?this.renderer.paragraph({type:"paragraph",raw:a,text:a,tokens:[{type:"text",raw:a,text:a}]}):a;continue}default:{const e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return"";throw new Error(e)}}}return r}parseInline(e,t){t=t||this.renderer;let r="";for(let n=0;n<e.length;n++){const i=e[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=e||"";continue}}const o=i;switch(o.type){case"escape":case"text":r+=t.text(o);break;case"html":r+=t.html(o);break;case"link":r+=t.link(o);break;case"image":r+=t.image(o);break;case"strong":r+=t.strong(o);break;case"em":r+=t.em(o);break;case"codespan":r+=t.codespan(o);break;case"br":r+=t.br(o);break;case"del":r+=t.del(o);break;default:{const e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return"";throw new Error(e)}}}return r}}class _Hooks{constructor(e){__publicField(this,"options"),this.options=e||_defaults}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}__publicField(_Hooks,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Marked{constructor(...e){__publicField(this,"defaults",_getDefaults()),__publicField(this,"options",this.setOptions),__publicField(this,"parse",this.parseMarkdown(_Lexer.lex,_Parser.parse)),__publicField(this,"parseInline",this.parseMarkdown(_Lexer.lexInline,_Parser.parseInline)),__publicField(this,"Parser",_Parser),__publicField(this,"Renderer",_Renderer),__publicField(this,"TextRenderer",_TextRenderer),__publicField(this,"Lexer",_Lexer),__publicField(this,"Tokenizer",_Tokenizer),__publicField(this,"Hooks",_Hooks),this.use(...e)}walkTokens(e,t){var r,n;let i=[];for(const o of e)switch(i=i.concat(t.call(this,o)),o.type){case"table":{const e=o;for(const r of e.header)i=i.concat(this.walkTokens(r.tokens,t));for(const r of e.rows)for(const e of r)i=i.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=o;i=i.concat(this.walkTokens(e.items,t));break}default:{const e=o;(null==(n=null==(r=this.defaults.extensions)?void 0:r.childTokens)?void 0:n[e.type])?this.defaults.extensions.childTokens[e.type].forEach(r=>{const n=e[r].flat(1/0);i=i.concat(this.walkTokens(n,t))}):e.tokens&&(i=i.concat(this.walkTokens(e.tokens,t)))}}return i}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{const r={...e};if(r.async=this.defaults.async||r.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const r=t.renderers[e.name];t.renderers[e.name]=r?function(...t){let n=e.renderer.apply(this,t);return!1===n&&(n=r.apply(this,t)),n}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const r=t[e.level];r?r.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),r.extensions=t),e.renderer){const t=this.defaults.renderer||new _Renderer(this.defaults);for(const r in e.renderer){if(!(r in t))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const n=r,i=e.renderer[n],o=t[n];t[n]=(...e)=>{let r=i.apply(t,e);return!1===r&&(r=o.apply(t,e)),r||""}}r.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new _Tokenizer(this.defaults);for(const r in e.tokenizer){if(!(r in t))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const n=r,i=e.tokenizer[n],o=t[n];t[n]=(...e)=>{let r=i.apply(t,e);return!1===r&&(r=o.apply(t,e)),r}}r.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new _Hooks;for(const r in e.hooks){if(!(r in t))throw new Error(`hook '${r}' does not exist`);if("options"===r)continue;const n=r,i=e.hooks[n],o=t[n];_Hooks.passThroughHooks.has(r)?t[n]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>o.call(t,e));const r=i.call(t,e);return o.call(t,r)}:t[n]=(...e)=>{let r=i.apply(t,e);return!1===r&&(r=o.apply(t,e)),r}}r.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,n=e.walkTokens;r.walkTokens=function(e){let r=[];return r.push(n.call(this,e)),t&&(r=r.concat(t.call(this,e))),r}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return _Lexer.lex(e,t??this.defaults)}parser(e,t){return _Parser.parse(e,t??this.defaults)}parseMarkdown(e,t){return(r,n)=>{const i={...n},o={...this.defaults,...i},a=this.onError(!!o.silent,!!o.async);if(!0===this.defaults.async&&!1===i.async)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(null==r)return a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof r)return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(o.hooks&&(o.hooks.options=o),o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(t=>e(t,o)).then(e=>o.hooks?o.hooks.processAllTokens(e):e).then(e=>o.walkTokens?Promise.all(this.walkTokens(e,o.walkTokens)).then(()=>e):e).then(e=>t(e,o)).then(e=>o.hooks?o.hooks.postprocess(e):e).catch(a);try{o.hooks&&(r=o.hooks.preprocess(r));let n=e(r,o);o.hooks&&(n=o.hooks.processAllTokens(n)),o.walkTokens&&this.walkTokens(n,o.walkTokens);let i=t(n,o);return o.hooks&&(i=o.hooks.postprocess(i)),i}catch(e10){return a(e10)}}}onError(e,t){return r=>{if(r.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+escape$1(r.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(r);throw r}}}const markedInstance=new Marked;function marked(e,t){return markedInstance.parse(e,t)}marked.options=marked.setOptions=function(e){return markedInstance.setOptions(e),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.getDefaults=_getDefaults,marked.defaults=_defaults,marked.use=function(...e){return markedInstance.use(...e),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.walkTokens=function(e,t){return markedInstance.walkTokens(e,t)},marked.parseInline=markedInstance.parseInline,marked.Parser=_Parser,marked.parser=_Parser.parse,marked.Renderer=_Renderer,marked.TextRenderer=_TextRenderer,marked.Lexer=_Lexer,marked.lexer=_Lexer.lex,marked.Tokenizer=_Tokenizer,marked.Hooks=_Hooks,marked.parse=marked,marked.options,marked.setOptions,marked.use,marked.walkTokens,marked.parseInline,_Parser.parse,_Lexer.lex;const CodePlayer=React.forwardRef((e,t)=>{const{envStatus:r,podName:n,runnerBaseUrl:i}=React.useContext(KnowledgeCardContext),{data:o,hasTitle:a=!0,toScore:s,errorHanle:l,codeChange:c}=e,u=React.useRef(null),[d,p]=React.useState(!0),[h,f]=React.useState(!1),g=debounce$2(e=>{null==c||c(e.code)}),m=React.useRef(null);return React.useEffect(()=>(f(!1),p(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{f(!0)},1e3),()=>{m.current&&clearTimeout(m.current)}),[o]),React.useImperativeHandle(t,()=>({toInstallPackage:e=>{var t,r;(null==(t=u.current)?void 0:t.contentWindow)&&postRobot.send(null==(r=u.current)?void 0:r.contentWindow,"vgenPackages",{packages:e})}})),jsxRuntimeExports.jsx(Spin,{spinning:d,children:jsxRuntimeExports.jsx("div",{className:"codePlayer",children:jsxRuntimeExports.jsx("div",{className:"codePlayerContent",style:{height:a?"":"100%"},children:h&&jsxRuntimeExports.jsx("iframe",{ref:u,allowFullScreen:!0,allow:"clipboard-write;clipboard-read",src:`${i||"https://run.cloudlab.top"}/embedded?fromVgen=true`,style:{border:"none"},title:"CodeRunner",className:"CodeRunner-iframe",onLoad:async()=>{var e,t,i;try{p(!1);const l=null==(e=u.current)?void 0:e.contentWindow,{topic:c="",content:d="",lang:h="",code:f="",cases:m=[]}=o;let v=d;try{v=marked.parse(d)}catch(a){}let y=[];if("html"===h)try{const e=JSON.parse(f);y=[e.html,e.css,e.js]}catch(a){}let b={...o};const q={title:c,content:v,lang:h,code:"html"===h?y:f,aiEnabled:!1,run:!1,cases:m,customButtons:s?[{name:"提交",value:"submit",style:{background:"#0064ff",color:"#ffffff"}}]:[]};r&&n&&(q.podName=n,q.nameSpace="pty-prod"),postRobot.send(l,"send",q),s&&postRobot.on("submit",{window:l},async function(e){var t,r;(null==(t=e.data)?void 0:t.code)?(staticMethods.success("提交成功,AI开始自动评分..."),s(null==(r=e.data)?void 0:r.code)):staticMethods.warning("请先作答!")}),postRobot.on("change",{window:null==(t=u.current)?void 0:t.contentWindow},async function(e){var t,r,n,i,o;if("html"===h)try{const i={html:(null==(t=e.data)?void 0:t[0])??"",css:(null==(r=e.data)?void 0:r[1])??"",js:(null==(n=e.data)?void 0:n[2])??""};b.code=JSON.stringify(i)}catch(a){b.code=(null==(i=e.data)?void 0:i[0])??""}else b.code=(null==(o=e.data)?void 0:o[0])??"";g(b)}),postRobot.on("getToken",{window:null==(i=u.current)?void 0:i.contentWindow},async e=>({token:localStorage.getItem("token")}))}catch(a){}}})})})})}),ExCodePlayer=React.memo(e=>{const{codePlayerData:t}=e,{envDetail:r,envStatus:n,podName:i,saveCode:o}=React.useContext(KnowledgeCardContext),[a,s]=React.useState(!1),l=React.useRef(null);React.useEffect(()=>{if(r)return""===n?Modal.confirm({title:"温馨提示",content:"该示例需要启动环境,请先启动环境后再使用。",cancelText:"我知道了",okText:"启动环境",centered:!0,width:400,onOk(e){e(),s(!0),window.postMessage({type:"startupEnv"})}}):n===EnvStatus.Running&&s(!1),()=>{l.current&&clearTimeout(l.current)}},[r,n]);const c=React.useRef(null);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Spin,{spinning:a,fullscreen:!0,tip:"环境启动中..."}),!r&&jsxRuntimeExports.jsx(CodePlayer,{data:{...t,topic:"",content:""},ref:c,codeChange:o}),r&&n===EnvStatus.Running&&i&&jsxRuntimeExports.jsx(CodePlayer,{data:{...t,topic:"",content:""},ref:c,codeChange:o})]})});var xterm={exports:{}};!function(e,t){var r;self,r=()=>(()=>{var e={4567:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const o=r(9042),a=r(6114),s=r(9924),l=r(844),c=r(5596),u=r(4725),d=r(3656);let p=t.AccessibilityManager=class extends l.Disposable{constructor(e,t){super(),this._terminal=e,this._renderService=t,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let r=0;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new s.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(e=>this._handleResize(e.rows))),this.register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(e=>this._handleChar(e))),this.register(this._terminal.onLineFeed(()=>this._handleChar("\n"))),this.register(this._terminal.onA11yTab(e=>this._handleTab(e))),this.register(this._terminal.onKey(e=>this._handleKey(e.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._screenDprMonitor=new c.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener(()=>this._refreshRowsDimensions()),this.register((0,d.addDisposableDomListener)(window,"resize",()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,l.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=o.tooMuchOutput)),a.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(()=>{this._accessibilityContainer.appendChild(this._liveRegion)},0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,a.isMac&&this._liveRegion.remove()}_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){const r=this._terminal.buffer,n=r.lines.length.toString();for(let i=e;i<=t;i++){const e=r.translateBufferLineToString(r.ydisp+i,!0),t=(r.ydisp+i+1).toString(),o=this._rowElements[i];o&&(0===e.length?o.innerText=" ":o.textContent=e,o.setAttribute("aria-posinset",t),o.setAttribute("aria-setsize",n))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){const r=e.target,n=this._rowElements[0===t?1:this._rowElements.length-2];if(r.getAttribute("aria-posinset")===(0===t?"1":`${this._terminal.buffer.lines.length}`))return;if(e.relatedTarget!==n)return;let i,o;if(0===t?(i=r,o=this._rowElements.pop(),this._rowContainer.removeChild(o)):(i=this._rowElements.shift(),o=r,this._rowContainer.removeChild(i)),i.removeEventListener("focus",this._topBoundaryFocusListener),o.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){const e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{const e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_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(){const e=document.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=p=n([i(1,u.IRenderService)],p)},3614:(e,t)=>{function r(e){return e.replace(/\r?\n/g,"\r")}function n(e,t){return t?"[200~"+e+"[201~":e}function i(e,t,i,o){e=n(e=r(e),i.decPrivateModes.bracketedPasteMode&&!0!==o.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=""}function o(e,t,r){const n=r.getBoundingClientRect(),i=e.clientX-n.left-10,o=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=r,t.bracketTextForPaste=n,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,r,n){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData("text/plain"),t,r,n)},t.paste=i,t.moveTextAreaUnderMouseCursor=o,t.rightClickHandler=function(e,t,r,n,i){o(e,t,r),i&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}},7239:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const n=r(1505);t.ColorContrastCache=class{constructor(){this._color=new n.TwoKeyMap,this._css=new n.TwoKeyMap}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,r,n){e.addEventListener(t,r,n);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,r,n))}}}},6465:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier2=void 0;const o=r(3656),a=r(8460),s=r(844),l=r(2585);let c=t.Linkifier2=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new a.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new a.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)(()=>{this._lastMouseEvent=void 0})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0}))}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{const t=this._linkProviders.indexOf(e);-1!==t&&this._linkProviders.splice(t,1)}}}attachToDom(e,t,r){this._element=e,this._mouseService=t,this._renderService=r,this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;const r=e.composedPath();for(let n=0;n<r.length;n++){const e=r[n];if(e.classList.contains("xterm"))break;if(e.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)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,n;this._activeProviderReplies&&t||(null===(r=this._activeProviderReplies)||void 0===r||r.forEach(e=>{null==e||e.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(const[o,a]of this._linkProviders.entries())t?(null===(n=this._activeProviderReplies)||void 0===n?void 0:n.get(o))&&(i=this._checkLinkProviderResult(o,e,i)):a.provideLinks(e.y,t=>{var r,n;if(this._isMouseOut)return;const a=null==t?void 0:t.map(e=>({link:e}));null===(r=this._activeProviderReplies)||void 0===r||r.set(o,a),i=this._checkLinkProviderResult(o,e,i),(null===(n=this._activeProviderReplies)||void 0===n?void 0:n.size)===this._linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){const r=new Set;for(let n=0;n<t.size;n++){const i=t.get(n);if(i)for(let t=0;t<i.length;t++){const n=i[t],o=n.link.range.start.y<e?0:n.link.range.start.x,a=n.link.range.end.y>e?this._bufferService.cols:n.link.range.end.x;for(let e=o;e<=a;e++){if(r.has(e)){i.splice(t--,1);break}r.add(e)}}}}_checkLinkProviderResult(e,t,r){var n;if(!this._activeProviderReplies)return r;const i=this._activeProviderReplies.get(e);let o=!1;for(let a=0;a<e;a++)this._activeProviderReplies.has(a)&&!this._activeProviderReplies.get(a)||(o=!0);if(!o&&i){const e=i.find(e=>this._linkAtPosition(e.link,t));e&&(r=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviders.length&&!r)for(let a=0;a<this._activeProviderReplies.size;a++){const e=null===(n=this._activeProviderReplies.get(a))||void 0===n?void 0:n.find(e=>this._linkAtPosition(e.link,t));if(e){r=!0,this._handleNewLink(e);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._element&&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,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var e,t;return null===(t=null===(e=this._currentLink)||void 0===e?void 0:e.state)||void 0===t?void 0:t.decorations.pointerCursor},set:e=>{var t,r;(null===(t=this._currentLink)||void 0===t?void 0:t.state)&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&(null===(r=this._element)||void 0===r||r.classList.toggle("xterm-cursor-pointer",e)))}},underline:{get:()=>{var e,t;return null===(t=null===(e=this._currentLink)||void 0===e?void 0:e.state)||void 0===t?void 0:t.decorations.underline},set:t=>{var r,n,i;(null===(r=this._currentLink)||void 0===r?void 0:r.state)&&(null===(i=null===(n=this._currentLink)||void 0===n?void 0:n.state)||void 0===i?void 0:i.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;const t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(t,r),this._lastMouseEvent&&this._element)){const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,r){var n;(null===(n=this._currentLink)||void 0===n?void 0:n.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(r,t.text)}_fireUnderlineEvent(e,t){const r=e.range,n=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,r){var n;(null===(n=this._currentLink)||void 0===n?void 0:n.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(r,t.text)}_linkAtPosition(e,t){const r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return r<=i&&i<=n}_positionFromMouseEvent(e,t,r){const n=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,n,i){return{x1:e,y1:t,x2:r,y2:n,cols:this._bufferService.cols,fg:i}}};t.Linkifier2=c=n([i(0,l.IBufferService)],c)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const o=r(511),a=r(2585);let s=t.OscLinkProvider=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var r;const n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);const i=[],a=this._optionsService.rawOptions.linkHandler,s=new o.CellData,c=n.getTrimmedLength();let u=-1,d=-1,p=!1;for(let o=0;o<c;o++)if(-1!==d||n.hasContent(o)){if(n.loadCell(o,s),s.hasExtendedAttrs()&&s.extended.urlId){if(-1===d){d=o,u=s.extended.urlId;continue}p=s.extended.urlId!==u}else-1!==d&&(p=!0);if(p||-1!==d&&o===c-1){const t=null===(r=this._oscLinkService.getLinkData(u))||void 0===r?void 0:r.uri;if(t){const r={start:{x:d+1,y:e},end:{x:o+(p||o!==c-1?0:1),y:e}};let n=!1;if(!(null==a?void 0:a.allowNonHttpProtocols))try{const e=new URL(t);["http:","https:"].includes(e.protocol)||(n=!0)}catch(h){n=!0}n||i.push({text:t,range:r,activate:(e,t)=>a?a.activate(e,t,r):l(0,t),hover:(e,t)=>{var n;return null===(n=null==a?void 0:a.hover)||void 0===n?void 0:n.call(a,e,t,r)},leave:(e,t)=>{var n;return null===(n=null==a?void 0:a.leave)||void 0===n?void 0:n.call(a,e,t,r)}})}p=!1,s.hasExtendedAttrs()&&s.extended.urlId?(d=o,u=s.extended.urlId):(d=-1,u=-1)}}t(i)}};function l(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){const e=window.open();if(e){try{e.opener=null}catch(r){}e.location.href=t}}}t.OscLinkProvider=s=n([i(0,a.IBufferService),i(1,a.IOptionsService),i(2,a.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._parentWindow=e,this._renderCallback=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,r){this._rowCount=r,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();const 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(const e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},5596:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ScreenDprMonitor=void 0;const n=r(844);class i extends n.Disposable{constructor(e){super(),this._parentWindow=e,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,n.toDisposable)(()=>{this.clearListener()}))}setListener(e){this._listener&&this.clearListener(),this._listener=e,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var e;this._outerListener&&(null===(e=this._resolutionMediaMatchList)||void 0===e||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}t.ScreenDprMonitor=i},3236:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const n=r(3614),i=r(3656),o=r(6465),a=r(9042),s=r(3730),l=r(1680),c=r(3107),u=r(5744),d=r(2950),p=r(1296),h=r(428),f=r(4269),g=r(5114),m=r(8934),v=r(3230),y=r(9312),b=r(4725),q=r(6731),V=r(8055),S=r(8969),E=r(8460),x=r(844),C=r(6114),w=r(8437),R=r(2584),A=r(7399),T=r(5941),k=r(9074),N=r(2585),P=r(5435),O=r(4567),F="undefined"!=typeof window?window.document:null;class _ extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=C,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new x.MutableDisposable),this._onCursorMove=this.register(new E.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new E.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new E.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new E.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new E.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new E.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new E.EventEmitter),this._onBlur=this.register(new E.EventEmitter),this._onA11yCharEmitter=this.register(new E.EventEmitter),this._onA11yTabEmitter=this.register(new E.EventEmitter),this._onWillOpen=this.register(new E.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(o.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(k.DecorationService),this._instantiationService.setService(N.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((e,t)=>this.refresh(e,t))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this.register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this.register((0,E.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,E.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,E.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,E.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this.register((0,x.toDisposable)(()=>{var e,t;this._customKeyEventHandler=void 0,null===(t=null===(e=this.element)||void 0===e?void 0:e.parentNode)||void 0===t||t.removeChild(this.element)}))}_handleColorEvent(e){if(this._themeService)for(const t of e){let e,r="";switch(t.index){case 256:e="foreground",r="10";break;case 257:e="background",r="11";break;case 258:e="cursor",r="12";break;default:e="ansi",r="4;"+t.index}switch(t.type){case 0:const n=V.color.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${R.C0.ESC}]${r};${(0,T.toRgbString)(n)}${R.C1_ESCAPED.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=V.rgba.toColor(...t.color));else{const r=e;this._themeService.modifyColors(e=>e[r]=V.rgba.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_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(O.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(R.C0.ESC+"[I"),this.updateCursorStyle(e),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return null===(e=this.textarea)||void 0===e?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(R.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;const r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,i=t.getWidth(r),o=this._renderService.dimensions.css.cell.width*i,a=this.buffer.y*this._renderService.dimensions.css.cell.height,s=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+"px",this.textarea.style.top=a+"px",this.textarea.style.width=o+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,"copy",e=>{this.hasSelection()&&(0,n.copyHandler)(e,this._selectionService)}));const e=e=>(0,n.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,"paste",e)),this.register((0,i.addDisposableDomListener)(this.element,"paste",e)),C.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,"mousedown",e=>{2===e.button&&(0,n.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,i.addDisposableDomListener)(this.element,"contextmenu",e=>{(0,n.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),C.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,"auxclick",e=>{1===e.button&&(0,n.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,"keyup",e=>this._keyUp(e),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,"keydown",e=>this._keyDown(e),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,"keypress",e=>this._keyPress(e),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,i.addDisposableDomListener)(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this.register((0,i.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,i.addDisposableDomListener)(this.textarea,"input",e=>this._inputEvent(e),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var t;if(!e)throw new Error("Terminal requires a parent element.");e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=e.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);const r=F.createDocumentFragment();this._viewportElement=F.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),r.appendChild(this._viewportElement),this._viewportScrollArea=F.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=F.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=F.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),r.appendChild(this.screenElement),this.textarea=F.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",a.promptLabel),C.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this._instantiationService.createInstance(g.CoreBrowserService,this.textarea,null!==(t=this._document.defaultView)&&void 0!==t?t:window),this._instantiationService.setService(b.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this.register((0,i.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(h.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(b.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(q.ThemeService),this._instantiationService.setService(b.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(f.CharacterJoinerService),this._instantiationService.setService(b.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(v.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(b.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=F.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(r);try{this._onWillOpen.fire(this.element)}catch(n){}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(m.MouseService),this._instantiationService.setService(b.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(l.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(y.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(b.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,i.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(c.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),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(O.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(p.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const e=this,t=this.element;function r(t){const r=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!r)return!1;let n,i;switch(t.overrideType||t.type){case"mousemove":i=32,void 0===t.buttons?(n=3,void 0!==t.button&&(n=t.button<3?t.button:3)):n=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case"mouseup":i=0,n=t.button<3?t.button:3;break;case"mousedown":i=1,n=t.button<3?t.button:3;break;case"wheel":if(0===e.viewport.getLinesScrolled(t))return!1;i=t.deltaY<0?0:1,n=4;break;default:return!1}return!(void 0===i||void 0===n||n>4)&&e.coreMouseService.triggerMouseEvent({col:r.col,row:r.row,x:r.x,y:r.y,button:n,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}const n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:e=>(r(e),e.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(e)),wheel:e=>(r(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&r(e)},mousemove:e=>{e.buttons||r(e)}};this.register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&e?n.mousemove||(t.addEventListener("mousemove",o.mousemove),n.mousemove=o.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),16&e?n.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),n.wheel=o.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),2&e?n.mouseup||(t.addEventListener("mouseup",o.mouseup),n.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),t.removeEventListener("mouseup",n.mouseup),n.mouseup=null),4&e?n.mousedrag||(n.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,"mousedown",e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return r(e),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(e)})),this.register((0,i.addDisposableDomListener)(t,"wheel",e=>{if(!n.wheel){if(!this.buffer.hasScrollback){const t=this.viewport.getLinesScrolled(e);if(0===t)return;const r=R.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(e.deltaY<0?"A":"B");let n="";for(let e=0;e<Math.abs(t);e++)n+=r;return this.coreService.triggerDataEvent(n,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}},{passive:!1})),this.register((0,i.addDisposableDomListener)(t,"touchstart",e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)},{passive:!0})),this.register((0,i.addDisposableDomListener)(t,"touchmove",e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)},{passive:!1}))}refresh(e,t){var r;null===(r=this._renderService)||void 0===r||r.refreshRows(e,t)}updateCursorStyle(e){var t;(null===(t=this._selectionService)||void 0===t?void 0:t.shouldColumnSelect(e))?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,r=0){var n;1===r?(super.scrollLines(e,t,r),this.refresh(0,this.rows-1)):null===(n=this.viewport)||void 0===n||n.scrollLines(e)}paste(e){(0,n.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}registerLinkProvider(e){return this.linkifier2.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const 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}select(e,t,r){this._selectionService.setSelection(e,t,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;null===(e=this._selectionService)||void 0===e||e.clearSelection()}selectAll(){var e;null===(e=this._selectionService)||void 0===e||e.selectAll()}selectLines(e,t){var r;null===(r=this._selectionService)||void 0===r||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;const 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(),!1;t||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);const r=(0,A.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===r.type||2===r.type){const t=this.rows-1;return this.scrollLines(2===r.type?-t:t),this.cancel(e,!0)}return 1===r.type&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(r.key!==R.C0.ETX&&r.key!==R.C0.CR||(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){const r=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"keypress"===t.type?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){var t;this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(16===(t=e).keyCode||17===t.keyCode||18===t.keyCode||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(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&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){var r,n;null===(r=this._charSizeService)||void 0===r||r.measure(),null===(n=this.viewport)||void 0===n||n.syncScrollArea(!0)}clear(){var e;if(0!==this.buffer.ybase||0!==this.buffer.y){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(w.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),null===(e=this.viewport)||void 0===e||e.reset(),this.refresh(0,this.rows-1)}}reset(){var e,t;this.options.rows=this.rows,this.options.cols=this.cols;const r=this._customKeyEventHandler;this._setup(),super.reset(),null===(e=this._selectionService)||void 0===e||e.reset(),this._decorationService.reset(),null===(t=this.viewport)||void 0===t||t.reset(),this._customKeyEventHandler=r,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;null===(e=this._renderService)||void 0===e||e.clearTextureAtlas()}_reportFocus(){var e;(null===(e=this.element)||void 0===e?void 0:e.classList.contains("focus"))?this.coreService.triggerDataEvent(R.C0.ESC+"[I"):this.coreService.triggerDataEvent(R.C0.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case P.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${R.C0.ESC}[4;${t};${e}t`);break;case P.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const r=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${R.C0.ESC}[6;${n};${r}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=_},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t;const n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const e=n-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;const 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)}}},1680:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const o=r(3656),a=r(4725),s=r(8460),l=r(844),c=r(2585);let u=t.Viewport=class extends l.Disposable{constructor(e,t,r,n,i,a,l,c){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=r,this._optionsService=n,this._charSizeService=i,this._renderService=a,this._coreBrowserService=l,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(e=>this._renderDimensions=e)),this._handleThemeChange(c.colors),this.register(c.onChangeColors(e=>this._handleThemeChange(e))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(e){if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||-1===this._smoothScrollState.origin||-1===this._smoothScrollState.target)return;const e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){const r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&r<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){const t=this._getPixelsScrolled(e);return 0!==t&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,-1===this._smoothScrollState.target?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(0!==e)if(this._optionsService.rawOptions.smoothScrollDuration){const t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}_getPixelsScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){var r;let n,i="";const o=[],a=null!=t?t:this._bufferService.buffer.lines.length,s=this._bufferService.buffer.lines;for(let l=e;l<a;l++){const e=s.get(l);if(!e)continue;const t=null===(r=s.get(l+1))||void 0===r?void 0:r.isWrapped;if(i+=e.translateToString(!t),!t||l===s.length-1){const e=document.createElement("div");e.textContent=i,o.push(e),i.length>0&&(n=e),i=""}}return{bufferElements:o,cursorElement:n}}getLinesScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){const r=this._optionsService.rawOptions.fastScrollModifier;return"alt"===r&&t.altKey||"ctrl"===r&&t.ctrlKey||"shift"===r&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){const t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=n([i(2,c.IBufferService),i(3,c.IOptionsService),i(4,a.ICharSizeService),i(5,a.IRenderService),i(6,a.ICoreBrowserService),i(7,a.IThemeService)],u)},3107:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const o=r(3656),a=r(4725),s=r(844),l=r(2585);let c=t.BufferDecorationRenderer=class extends s.Disposable{constructor(e,t,r,n){super(),this._screenElement=e,this._bufferService=t,this._decorationService=r,this._renderService=n,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((0,o.addDisposableDomListener)(window,"resize",()=>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(e=>this._removeDecoration(e))),this.register((0,s.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var t,r;const n=document.createElement("div");n.classList.add("xterm-decoration"),n.classList.toggle("xterm-decoration-top-layer","top"===(null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.layer)),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=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const i=null!==(r=e.options.x)&&void 0!==r?r:0;return i&&i>this._bufferService.cols&&(n.style.display="none"),this._refreshXPosition(e,n),n}_refreshStyle(e){const 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 r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.top=t*this._renderService.dimensions.css.cell.height+"px",r.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){var r;if(!t)return;const n=null!==(r=e.options.x)&&void 0!==r?r:0;"right"===(e.options.anchor||"left")?t.style.right=n?n*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=n?n*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){var t;null===(t=this._decorationElements.get(e))||void 0===t||t.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=n([i(1,l.IBufferService),i(2,l.IDecorationService),i(3,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(const 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))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return 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,void this._zones.push(this._zonePool[this._zonePoolIndex++]);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,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const o=r(5871),a=r(3656),s=r(4725),l=r(844),c=r(2585),u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},p={full:0,left:0,center:0,right:0};let h=t.OverviewRulerRenderer=class extends l.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,r,n,i,a,s){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=n,this._renderService=i,this._optionsService=a,this._coreBrowseService=s,this._colorZoneStore=new o.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),null===(c=this._viewportElement.parentElement)||void 0===c||c.insertBefore(this._canvas,this._viewportElement);const u=this._canvas.getContext("2d");if(!u)throw new Error("Ctx cannot be null");this._ctx=u,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,l.toDisposable)(()=>{var e;null===(e=this._canvas)||void 0===e||e.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register((0,a.addDisposableDomListener)(this._coreBrowseService.window,"resize",()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);d.full=this._canvas.width,d.left=e,d.center=t,d.right=e,this._refreshDrawHeightConstants(),p.full=0,p.left=0,p.center=d.left,p.right=d.left+d.center}_refreshDrawHeightConstants(){u.full=Math.round(2*this._coreBrowseService.dpr);const e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowseService.dpr);u.left=t,u.center=t,u.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.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._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1;const e=this._colorZoneStore.zones;for(const t of e)"full"!==t.position&&this._renderColorZone(t);for(const t of e)"full"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(p[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-u[e.position||"full"]/2),d[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+u[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=h=n([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,s.IRenderService),i(5,c.IOptionsService),i(6,s.ICoreBrowserService)],h)},2950:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const o=r(4725),a=r(2585),s=r(2584);let l=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,r,n,i,o){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=n,this._coreService=i,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${s.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const i=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(i.width,1)+"px",this._textarea.style.height=Math.max(i.height,1)+"px",this._textarea.style.lineHeight=i.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=l=n([i(2,a.IBufferService),i(3,a.IOptionsService),i(4,a.ICoreService),i(5,o.IRenderService)],l)},9806:(e,t)=>{function r(e,t,r){const n=r.getBoundingClientRect(),i=e.getComputedStyle(r),o=parseInt(i.getPropertyValue("padding-left")),a=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-n.left-o,t.clientY-n.top-a]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=r,t.getCoords=function(e,t,n,i,o,a,s,l,c){if(!a)return;const u=r(e,t,n);return u?(u[0]=Math.ceil((u[0]+(c?s/2:0))/s),u[1]=Math.ceil(u[1]/l),u[0]=Math.min(Math.max(u[0],1),i+(c?1:0)),u[1]=Math.min(Math.max(u[1],1),o),u):void 0}},9504:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const n=r(2584);function i(e,t,r,n){const i=e-o(e,r),s=t-o(t,r);return c(Math.abs(i-s)-function(e,t,r){let n=0;const i=e-o(e,r),s=t-o(t,r);for(let o=0;o<Math.abs(i-s);o++){const s="A"===a(e,t)?-1:1,l=r.buffer.lines.get(i+s*o);(null==l?void 0:l.isWrapped)&&n++}return n}(e,t,r),l(a(e,t),n))}function o(e,t){let r=0,n=t.buffer.lines.get(e),i=null==n?void 0:n.isWrapped;for(;i&&e>=0&&e<t.rows;)r++,n=t.buffer.lines.get(--e),i=null==n?void 0:n.isWrapped;return r}function a(e,t){return e>t?"A":"B"}function s(e,t,r,n,i,o){let a=e,s=t,l="";for(;a!==r||s!==n;)a+=i?1:-1,i&&a>o.cols-1?(l+=o.buffer.translateBufferLineToString(s,!1,e,a),a=0,e=0,s++):!i&&a<0&&(l+=o.buffer.translateBufferLineToString(s,!1,0,e+1),a=o.cols-1,e=a,s--);return l+o.buffer.translateBufferLineToString(s,!1,e,a)}function l(e,t){const r=t?"O":"[";return n.C0.ESC+r+e}function c(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}t.moveToCellSequence=function(e,t,r,n){const a=r.buffer.x,u=r.buffer.y;if(!r.buffer.hasScrollback)return d=a,(0===i(p=u,t,h=r,f=n).length?"":c(s(d,p,d,p-o(p,h),!1,h).length,l("D",f)))+i(u,t,r,n)+function(e,t,r,n,a,u){let d;d=i(t,n,a,u).length>0?n-o(n,a):t;const p=n,h=function(e,t,r,n,a,s){let l;return l=i(r,n,a,s).length>0?n-o(n,a):t,e<r&&l<=n||e>=r&&l<n?"C":"D"}(e,t,r,n,a,u);return c(s(e,d,r,p,"C"===h,a).length,l(h,u))}(a,u,e,t,r,n);var d,p,h,f;let g;if(u===t)return g=a>e?"D":"C",c(Math.abs(a-e),l(g,n));g=u>t?"D":"C";const m=Math.abs(u-t);return c(function(e,t){return t.cols-e}(u>t?e:a,r)+(m-1)*r.cols+1+((u>t?a:e)-1),l(g,n))}},1296:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const o=r(3787),a=r(2550),s=r(2223),l=r(6171),c=r(4725),u=r(8055),d=r(8460),p=r(844),h=r(2585),f="xterm-dom-renderer-owner-",g="xterm-rows",m="xterm-fg-",v="xterm-bg-",y="xterm-focus",b="xterm-selection";let q=1,V=t.DomRenderer=class extends p.Disposable{constructor(e,t,r,n,i,s,c,u,h,m){super(),this._element=e,this._screenElement=t,this._viewportElement=r,this._linkifier2=n,this._charSizeService=s,this._optionsService=c,this._bufferService=u,this._coreBrowserService=h,this._themeService=m,this._terminalClass=q++,this._rowElements=[],this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,l.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=i.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(f+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this.register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this.register((0,p.toDisposable)(()=>{this._element.classList.remove(f+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new a.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const 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(const r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const t=`${this._terminalSelector} .${g} 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=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { 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} .${g} .xterm-dim { color: ${u.color.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;}`,t+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",t+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(const[r,n]of e.ansi.entries())t+=`${this._terminalSelector} .${m}${r} { color: ${n.css}; }${this._terminalSelector} .${m}${r}.xterm-dim { color: ${u.color.multiplyOpacity(n,.5).css}; }${this._terminalSelector} .${v}${r} { background-color: ${n.css}; }`;t+=`${this._terminalSelector} .${m}${s.INVERTED_DEFAULT_COLOR} { color: ${u.color.opaque(e.background).css}; }${this._terminalSelector} .${m}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${u.color.multiplyOpacity(u.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){const 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 r=this._rowElements.length;r<=t;r++){const e=document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;const n=e[1]-this._bufferService.buffer.ydisp,i=t[1]-this._bufferService.buffer.ydisp,o=Math.max(n,0),a=Math.min(i,this._bufferService.rows-1);if(o>=this._bufferService.rows||a<0)return;const s=document.createDocumentFragment();if(r){const r=e[0]>t[0];s.appendChild(this._createSelectionElement(o,r?t[0]:e[0],r?e[0]:t[0],a-o+1))}else{const r=n===o?e[0]:0,l=o===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,r,l));const c=a-o-1;if(s.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,c)),o!==a){const e=i===a?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,r,n=1){const i=document.createElement("div");return i.style.height=n*this.dimensions.css.cell.height+"px",i.style.top=e*this.dimensions.css.cell.height+"px",i.style.left=t*this.dimensions.css.cell.width+"px",i.style.width=this.dimensions.css.cell.width*(r-t)+"px",i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const e of this._rowElements)e.replaceChildren()}renderRows(e,t){const r=this._bufferService.buffer,n=r.ybase+r.y,i=Math.min(r.x,this._bufferService.cols-1),o=this._optionsService.rawOptions.cursorBlink,a=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){const e=l+r.ydisp,t=this._rowElements[l],c=r.lines.get(e);if(!t||!c)break;t.replaceChildren(...this._rowFactory.createRow(c,e,e===n,a,s,i,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${f}${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,r,n,i,o){r<0&&(e=0),n<0&&(t=0);const a=this._bufferService.rows-1;r=Math.max(Math.min(r,a),0),n=Math.max(Math.min(n,a),0),i=Math.min(i,this._bufferService.cols);const s=this._bufferService.buffer,l=s.ybase+s.y,c=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=r;h<=n;++h){const a=h+s.ydisp,f=this._rowElements[h],g=s.lines.get(a);if(!f||!g)break;f.replaceChildren(...this._rowFactory.createRow(g,a,a===l,d,p,c,u,this.dimensions.css.cell.width,this._widthCache,o?h===r?e:0:-1,o?(h===n?t:i)-1:-1))}}};t.DomRenderer=V=n([i(4,h.IInstantiationService),i(5,c.ICharSizeService),i(6,h.IOptionsService),i(7,h.IBufferService),i(8,c.ICoreBrowserService),i(9,c.IThemeService)],V)},3787:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const o=r(2223),a=r(643),s=r(511),l=r(2585),c=r(8055),u=r(4725),d=r(4269),p=r(6171),h=r(3734);let f=t.DomRendererRowFactory=class{constructor(e,t,r,n,i,o,a){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=n,this._coreService=i,this._decorationService=o,this._themeService=a,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,n,i,s,l,u,p,f,m){const v=[],y=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors;let q,V=e.getNoBgTrimmedLength();r&&V<s+1&&(V=s+1);let S=0,E="",x=0,C=0,w=0,R=!1,A=0,T=!1,k=0;const N=[],P=-1!==f&&-1!==m;for(let O=0;O<V;O++){e.loadCell(O,this._workCell);let V=this._workCell.getWidth();if(0===V)continue;let F=!1,_=O,D=this._workCell;if(y.length>0&&O===y[0][0]){F=!0;const t=y.shift();D=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),_=t[1]-1,V=D.getWidth()}const I=this._isCellInSelection(O,t),U=r&&O===s,L=P&&O>=f&&O<=m;let B=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{B=!0});let W=D.getChars()||a.WHITESPACE_CELL_CHAR;if(" "===W&&(D.isUnderline()||D.isOverline())&&(W=" "),k=V*u-p.get(W,D.isBold(),D.isItalic()),q){if(S&&(I&&T||!I&&!T&&D.bg===x)&&(I&&T&&b.selectionForeground||D.fg===C)&&D.extended.ext===w&&L===R&&k===A&&!U&&!F&&!B){E+=W,S++;continue}S&&(q.textContent=E),q=this._document.createElement("span"),S=0,E=""}else q=this._document.createElement("span");if(x=D.bg,C=D.fg,w=D.extended.ext,R=L,A=k,T=I,F&&s>=O&&s<=_&&(s=O),!this._coreService.isCursorHidden&&U)if(N.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&N.push("xterm-cursor-blink"),N.push("bar"===n?"xterm-cursor-bar":"underline"===n?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":N.push("xterm-cursor-outline");break;case"block":N.push("xterm-cursor-block");break;case"bar":N.push("xterm-cursor-bar");break;case"underline":N.push("xterm-cursor-underline")}if(D.isBold()&&N.push("xterm-bold"),D.isItalic()&&N.push("xterm-italic"),D.isDim()&&N.push("xterm-dim"),E=D.isInvisible()?a.WHITESPACE_CELL_CHAR:D.getChars()||a.WHITESPACE_CELL_CHAR,D.isUnderline()&&(N.push(`xterm-underline-${D.extended.underlineStyle}`)," "===E&&(E=" "),!D.isUnderlineColorDefault()))if(D.isUnderlineColorRGB())q.style.textDecorationColor=`rgb(${h.AttributeData.toColorRGB(D.getUnderlineColor()).join(",")})`;else{let e=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&e<8&&(e+=8),q.style.textDecorationColor=b.ansi[e].css}D.isOverline()&&(N.push("xterm-overline")," "===E&&(E=" ")),D.isStrikethrough()&&N.push("xterm-strikethrough"),L&&(q.style.textDecoration="underline");let M=D.getFgColor(),j=D.getFgColorMode(),K=D.getBgColor(),H=D.getBgColorMode();const z=!!D.isInverse();if(z){const e=M;M=K,K=e;const t=j;j=H,H=t}let X,G,Z,Y=!1;switch(this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{"top"!==e.options.layer&&Y||(e.backgroundColorRGB&&(H=50331648,K=e.backgroundColorRGB.rgba>>8&16777215,X=e.backgroundColorRGB),e.foregroundColorRGB&&(j=50331648,M=e.foregroundColorRGB.rgba>>8&16777215,G=e.foregroundColorRGB),Y="top"===e.options.layer)}),!Y&&I&&(X=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,K=X.rgba>>8&16777215,H=50331648,Y=!0,b.selectionForeground&&(j=50331648,M=b.selectionForeground.rgba>>8&16777215,G=b.selectionForeground)),Y&&N.push("xterm-decoration-top"),H){case 16777216:case 33554432:Z=b.ansi[K],N.push(`xterm-bg-${K}`);break;case 50331648:Z=c.rgba.toColor(K>>16,K>>8&255,255&K),this._addStyle(q,`background-color:#${g((K>>>0).toString(16),"0",6)}`);break;default:z?(Z=b.foreground,N.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):Z=b.background}switch(X||D.isDim()&&(X=c.color.multiplyOpacity(Z,.5)),j){case 16777216:case 33554432:D.isBold()&&M<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(M+=8),this._applyMinimumContrast(q,Z,b.ansi[M],D,X,void 0)||N.push(`xterm-fg-${M}`);break;case 50331648:const e=c.rgba.toColor(M>>16&255,M>>8&255,255&M);this._applyMinimumContrast(q,Z,e,D,X,G)||this._addStyle(q,`color:#${g(M.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(q,Z,b.foreground,D,X,void 0)||z&&N.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}N.length&&(q.className=N.join(" "),N.length=0),U||F||B?q.textContent=E:S++,k!==this.defaultSpacing&&(q.style.letterSpacing=`${k}px`),v.push(q),O=_}return q&&S&&(q.textContent=E),v}_applyMinimumContrast(e,t,r,n,i,o){if(1===this._optionsService.rawOptions.minimumContrastRatio||(0,p.excludeFromContrastRatioDemands)(n.getCode()))return!1;const a=this._getContrastCache(n);let s;if(i||o||(s=a.getColor(t.rgba,r.rgba)),void 0===s){const e=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);s=c.color.ensureContrastRatio(i||t,o||r,e),a.setColor((i||t).rgba,(o||r).rgba,null!=s?s:null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_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){const r=this._selectionStart,n=this._selectionEnd;return!(!r||!n)&&(this._columnSelectMode?r[0]<=n[0]?e>=r[0]&&t>=r[1]&&e<n[0]&&t<=n[1]:e<r[0]&&t>=r[1]&&e>=n[0]&&t<=n[1]:t>r[1]&&t<n[1]||r[1]===n[1]&&t===r[1]&&e>=r[0]&&e<n[0]||r[1]<n[1]&&t===n[1]&&e<n[0]||r[1]<n[1]&&t===r[1]&&e>=r[0])}};function g(e,t,r){for(;e.length<r;)e=t+e;return e}t.DomRendererRowFactory=f=n([i(1,u.ICharacterJoinerService),i(2,l.IOptionsService),i(3,u.ICoreBrowserService),i(4,l.ICoreService),i(5,l.IDecorationService),i(6,u.IThemeService)],f)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e){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.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const t=e.createElement("span"),r=e.createElement("span");r.style.fontWeight="bold";const n=e.createElement("span");n.style.fontStyle="italic";const i=e.createElement("span");i.style.fontWeight="bold",i.style.fontStyle="italic",this._measureElements=[t,r,n,i],this._container.appendChild(t),this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(i),e.body.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,r,n){e===this._font&&t===this._fontSize&&r===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,r){let n=0;if(!t&&!r&&1===e.length&&(n=e.charCodeAt(0))<256)return-9999!==this._flat[n]?this._flat[n]:this._flat[n]=this._measure(e,0);let i=e;t&&(i+="B"),r&&(i+="I");let o=this._holey.get(i);if(void 0===o){let n=0;t&&(n|=1),r&&(n|=2),o=this._measure(e,n),this._holey.set(i,o)}return o}_measure(e,t){const r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}}},2223:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const n=r(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=n.isFirefox||n.isLegacyEdge?"bottom":"ideographic"},6171:(e,t)=>{function r(e){return 57508<=e&&e<=57558}Object.defineProperty(t,"__esModule",{value:!0}),t.createRenderDimensions=t.excludeFromContrastRatioDemands=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e},t.isPowerlineGlyph=r,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.excludeFromContrastRatioDemands=function(e){return r(e)||9472<=(t=e)&&t<=9631;var t},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=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.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const 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]){const 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(){const e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(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)}}},428:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const o=r(2585),a=r(8460),s=r(844);let l=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this.register(new a.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new c(e,t,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=l=n([i(2,o.IOptionsService)],l);class c{constructor(e,t,r){this._document=e,this._parentElement=t,this._optionsService=r,this._result={width:0,height:0},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(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const e={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return 0!==e.width&&0!==e.height&&(this._result.width=e.width/32,this._result.height=Math.ceil(e.height)),this._result}}},4269:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const o=r(3734),a=r(643),s=r(511),l=r(2585);class c extends o.AttributeData{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}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()]}}t.JoinedCellData=c;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){const 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(0===this._characterJoiners.length)return[];const t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];const r=[],n=t.translateToString(!0);let i=0,o=0,s=0,l=t.getFg(0),c=t.getBg(0);for(let u=0;u<t.getTrimmedLength();u++)if(t.loadCell(u,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(u-i>1){const e=this._getJoinedRanges(n,s,o,t,i);for(let t=0;t<e.length;t++)r.push(e[t])}i=u,s=o,l=this._workCell.fg,c=this._workCell.bg}o+=this._workCell.getChars().length||a.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){const e=this._getJoinedRanges(n,s,o,t,i);for(let t=0;t<e.length;t++)r.push(e[t])}return r}_getJoinedRanges(t,r,n,i,o){const a=t.substring(r,n);let s=[];try{s=this._characterJoiners[0].handler(a)}catch(l){}for(let c=1;c<this._characterJoiners.length;c++)try{const t=this._characterJoiners[c].handler(a);for(let r=0;r<t.length;r++)e._mergeRanges(s,t[r])}catch(l){}return this._stringRangesToCellRanges(s,i,o),s}_stringRangesToCellRanges(e,t,r){let n=0,i=!1,o=0,s=e[n];if(s){for(let l=r;l<this._bufferService.cols;l++){const r=t.getWidth(l),c=t.getString(l).length||a.WHITESPACE_CELL_CHAR.length;if(0!==r){if(!i&&s[0]<=o&&(s[0]=l,i=!0),s[1]<=o){if(s[1]=l,s=e[++n],!s)break;s[0]<=o?(s[0]=l,i=!0):i=!1}o+=c}}s&&(s[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let n=0;n<e.length;n++){const i=e[n];if(r){if(t[1]<=i[0])return e[n-1][1]=t[1],e;if(t[1]<=i[1])return e[n-1][1]=Math.max(t[1],i[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=i[0])return e.splice(n,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),r=!0)}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=n([i(0,l.IBufferService)],u)},5114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0,t.CoreBrowserService=class{constructor(e,t){this._textarea=e,this.window=t,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}},8934:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const o=r(4725),a=r(9806);let s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,i){return(0,a.getCoords)(window,e,t,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){const r=(0,a.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};t.MouseService=s=n([i(0,o.IRenderService),i(1,o.ICharSizeService)],s)},3230:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const o=r(3656),a=r(6193),s=r(5596),l=r(4725),c=r(8460),u=r(844),d=r(7226),p=r(2585);let h=t.RenderService=class extends u.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,r,n,i,l,p,h){if(super(),this._rowCount=e,this._charSizeService=n,this._renderer=this.register(new u.MutableDisposable),this._pausedResizeTask=new d.DebouncedIdleTask,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new c.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new c.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new c.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new c.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(p.window,(e,t)=>this._renderRows(e,t)),this.register(this._renderDebouncer),this._screenDprMonitor=new s.ScreenDprMonitor(p.window),this._screenDprMonitor.setListener(()=>this.handleDevicePixelRatioChange()),this.register(this._screenDprMonitor),this.register(l.onResize(()=>this._fullRefresh())),this.register(l.buffers.onBufferActivate(()=>{var e;return null===(e=this._renderer.value)||void 0===e?void 0:e.clear()})),this.register(r.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(i.onDecorationRegistered(()=>this._fullRefresh())),this.register(i.onDecorationRemoved(()=>this._fullRefresh())),this.register(r.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this.register(r.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this.register((0,o.addDisposableDomListener)(p.window,"resize",()=>this.handleDevicePixelRatioChange())),this.register(h.onChangeColors(()=>this._fullRefresh())),"IntersectionObserver"in p.window){const e=new p.window.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});e.observe(t),this.register({dispose:()=>e.disconnect()})}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!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,r=!1){this._isPaused?this._needsFullRefresh=!0:(r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(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.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&(null===(t=(e=this._renderer.value).clearTextureAtlas)||void 0===t||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;null===(e=this._renderer.value)||void 0===e||e.handleCharSizeChanged()}handleBlur(){var e;null===(e=this._renderer.value)||void 0===e||e.handleBlur()}handleFocus(){var e;null===(e=this._renderer.value)||void 0===e||e.handleFocus()}handleSelectionChanged(e,t,r){var n;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,null===(n=this._renderer.value)||void 0===n||n.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;null===(e=this._renderer.value)||void 0===e||e.handleCursorMove()}clear(){var e;null===(e=this._renderer.value)||void 0===e||e.clear()}};t.RenderService=h=n([i(2,p.IOptionsService),i(3,l.ICharSizeService),i(4,p.IDecorationService),i(5,p.IBufferService),i(6,l.ICoreBrowserService),i(7,l.IThemeService)],h)},9312:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const o=r(9806),a=r(9504),s=r(456),l=r(4725),c=r(8460),u=r(844),d=r(6114),p=r(4841),h=r(511),f=r(2585),g=String.fromCharCode(160),m=new RegExp(g,"g");let v=t.SelectionService=class extends u.Disposable{constructor(e,t,r,n,i,o,a,l,d){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=i,this._mouseService=o,this._optionsService=a,this._renderService=l,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new h.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new c.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new c.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new c.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new c.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this.register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";const r=this._bufferService.buffer,n=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";const i=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let a=e[1];a<=t[1];a++){const e=r.translateBufferLineToString(a,!0,i,o);n.push(e)}}else{const i=e[1]===t[1]?t[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],i));for(let o=e[1]+1;o<=t[1]-1;o++){const e=r.lines.get(o),t=r.translateBufferLineToString(o,!0);(null==e?void 0:e.isWrapped)?n[n.length-1]+=t:n.push(t)}if(e[1]!==t[1]){const e=r.lines.get(t[1]),i=r.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?n[n.length-1]+=i:n.push(i)}}return n.map(e=>e.replace(m," ")).join(d.isWindows?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),d.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){const t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!!(r&&n&&t)&&this._areCoordsInSelection(t,r,n)}isCellInSelection(e,t){const r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!(!r||!n)&&this._areCoordsInSelection([e,t],r,n)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var r,n;const i=null===(n=null===(r=this._linkifier.currentLink)||void 0===r?void 0:r.link)||void 0===n?void 0:n.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=(0,p.getRangeLength)(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const o=this._getMouseBufferCoords(e);return!!o&&(this._selectWordAt(o,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){const t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1];const r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){const t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;const t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){const e=r.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&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});const e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){const t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){const e=(0,a.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);r?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,r)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let n=0;t>=n;n++){const i=e.loadCell(n,this._workCell).getChars().length;0===this._workCell.getWidth()?r--:i>1&&t!==n&&(r+=i-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;const i=this._bufferService.buffer,o=i.lines.get(e[1]);if(!o)return;const a=i.translateBufferLineToString(e[1],!1);let s=this._convertViewportColToCharacterIndex(o,e[0]),l=s;const c=e[0]-s;let u=0,d=0,p=0,h=0;if(" "===a.charAt(s)){for(;s>0&&" "===a.charAt(s-1);)s--;for(;l<a.length&&" "===a.charAt(l+1);)l++}else{let t=e[0],r=e[0];0===o.getWidth(t)&&(u++,t--),2===o.getWidth(r)&&(d++,r++);const n=o.getString(r).length;for(n>1&&(h+=n-1,l+=n-1);t>0&&s>0&&!this._isCharWordSeparator(o.loadCell(t-1,this._workCell));){o.loadCell(t-1,this._workCell);const e=this._workCell.getChars().length;0===this._workCell.getWidth()?(u++,t--):e>1&&(p+=e-1,s-=e-1),s--,t--}for(;r<o.length&&l+1<a.length&&!this._isCharWordSeparator(o.loadCell(r+1,this._workCell));){o.loadCell(r+1,this._workCell);const e=this._workCell.getChars().length;2===this._workCell.getWidth()?(d++,r++):e>1&&(h+=e-1,l+=e-1),l++,r++}}l++;let f=s+c-u+p,g=Math.min(this._bufferService.cols,l-s+u+d-p-h);if(t||""!==a.slice(s,l).trim()){if(r&&0===f&&32!==o.getCodePoint(0)){const t=i.lines.get(e[1]-1);if(t&&o.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){const t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){const e=this._bufferService.cols-t.start;f-=e,g+=e}}}if(n&&f+g===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){const t=i.lines.get(e[1]+1);if((null==t?void 0:t.isWrapped)&&32!==t.getCodePoint(0)){const t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(g+=t.length)}}return{start:f,length:g}}}_selectWordAt(e,t){const r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){const t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){const t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,p.getRangeLength)(r,this._bufferService.cols)}};t.SelectionService=v=n([i(3,f.IBufferService),i(4,f.ICoreService),i(5,l.IMouseService),i(6,f.IOptionsService),i(7,l.IRenderService),i(8,l.ICoreBrowserService)],v)},4725:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const n=r(8343);t.ICharSizeService=(0,n.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,n.createDecorator)("CoreBrowserService"),t.IMouseService=(0,n.createDecorator)("MouseService"),t.IRenderService=(0,n.createDecorator)("RenderService"),t.ISelectionService=(0,n.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,n.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,n.createDecorator)("ThemeService")},6731:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const o=r(7239),a=r(8055),s=r(8460),l=r(844),c=r(2585),u=a.css.toColor("#ffffff"),d=a.css.toColor("#000000"),p=a.css.toColor("#ffffff"),h=a.css.toColor("#000000"),f={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const e=[a.css.toColor("#2e3436"),a.css.toColor("#cc0000"),a.css.toColor("#4e9a06"),a.css.toColor("#c4a000"),a.css.toColor("#3465a4"),a.css.toColor("#75507b"),a.css.toColor("#06989a"),a.css.toColor("#d3d7cf"),a.css.toColor("#555753"),a.css.toColor("#ef2929"),a.css.toColor("#8ae234"),a.css.toColor("#fce94f"),a.css.toColor("#729fcf"),a.css.toColor("#ad7fa8"),a.css.toColor("#34e2e2"),a.css.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){const n=t[r/36%6|0],i=t[r/6%6|0],o=t[r%6];e.push({css:a.channels.toCss(n,i,o),rgba:a.channels.toRgba(n,i,o)})}for(let r=0;r<24;r++){const t=8+10*r;e.push({css:a.channels.toCss(t,t,t),rgba:a.channels.toRgba(t,t,t)})}return e})());let g=t.ThemeService=class extends l.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new s.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:d,cursor:p,cursorAccent:h,selectionForeground:void 0,selectionBackgroundTransparent:f,selectionBackgroundOpaque:a.color.blend(d,f),selectionInactiveBackgroundTransparent:f,selectionInactiveBackgroundOpaque:a.color.blend(d,f),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(e={}){const r=this._colors;if(r.foreground=m(e.foreground,u),r.background=m(e.background,d),r.cursor=m(e.cursor,p),r.cursorAccent=m(e.cursorAccent,h),r.selectionBackgroundTransparent=m(e.selectionBackground,f),r.selectionBackgroundOpaque=a.color.blend(r.background,r.selectionBackgroundTransparent),r.selectionInactiveBackgroundTransparent=m(e.selectionInactiveBackground,r.selectionBackgroundTransparent),r.selectionInactiveBackgroundOpaque=a.color.blend(r.background,r.selectionInactiveBackgroundTransparent),r.selectionForeground=e.selectionForeground?m(e.selectionForeground,a.NULL_COLOR):void 0,r.selectionForeground===a.NULL_COLOR&&(r.selectionForeground=void 0),a.color.isOpaque(r.selectionBackgroundTransparent)){const e=.3;r.selectionBackgroundTransparent=a.color.opacity(r.selectionBackgroundTransparent,e)}if(a.color.isOpaque(r.selectionInactiveBackgroundTransparent)){const e=.3;r.selectionInactiveBackgroundTransparent=a.color.opacity(r.selectionInactiveBackgroundTransparent,e)}if(r.ansi=t.DEFAULT_ANSI_COLORS.slice(),r.ansi[0]=m(e.black,t.DEFAULT_ANSI_COLORS[0]),r.ansi[1]=m(e.red,t.DEFAULT_ANSI_COLORS[1]),r.ansi[2]=m(e.green,t.DEFAULT_ANSI_COLORS[2]),r.ansi[3]=m(e.yellow,t.DEFAULT_ANSI_COLORS[3]),r.ansi[4]=m(e.blue,t.DEFAULT_ANSI_COLORS[4]),r.ansi[5]=m(e.magenta,t.DEFAULT_ANSI_COLORS[5]),r.ansi[6]=m(e.cyan,t.DEFAULT_ANSI_COLORS[6]),r.ansi[7]=m(e.white,t.DEFAULT_ANSI_COLORS[7]),r.ansi[8]=m(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),r.ansi[9]=m(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),r.ansi[10]=m(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),r.ansi[11]=m(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),r.ansi[12]=m(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),r.ansi[13]=m(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),r.ansi[14]=m(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),r.ansi[15]=m(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){const n=Math.min(r.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<n;i++)r.ansi[i+16]=m(e.extendedAnsi[i],t.DEFAULT_ANSI_COLORS[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0!==e)switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}else for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t]}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function m(e,t){if(void 0!==e)try{return a.css.toColor(e)}catch(r){}return t}t.ThemeService=g=n([i(0,c.IOptionsService)],g)},6349:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const n=r(8460),i=r(844);class o extends i.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new n.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new n.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new n.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;const t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];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,...r){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<r.length;n++)this._array[this._getCyclicIndex(e+n)]=r[n];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){const e=this._length+r.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let i=t-1;i>=0;i--)this.set(e+i+r,this.get(e+i));const n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+r,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}}t.CircularList=o},1439:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,r=5){if("object"!=typeof t)return t;const n=Array.isArray(t)?[]:{};for(const i in t)n[i]=r<=1?t[i]:t[i]&&e(t[i],r-1);return n}},8055:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;const n=r(6114);let i=0,o=0,a=0,s=0;var l,c,u,d,p,h;function f(e){const t=e.toString(16);return t.length<2?"0"+t:t}function g(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},(h=l||(t.channels=l={})).toCss=function(e,t,r,n){return void 0!==n?`#${f(e)}${f(t)}${f(r)}${f(n)}`:`#${f(e)}${f(t)}${f(r)}`},h.toRgba=function(e,t,r,n=255){return(e<<24|t<<16|r<<8|n)>>>0},function(e){function t(e,t){return s=Math.round(255*t),[i,o,a]=p.toChannels(e.rgba),{css:l.toCss(i,o,a,s),rgba:l.toRgba(i,o,a,s)}}e.blend=function(e,t){if(s=(255&t.rgba)/255,1===s)return{css:t.css,rgba:t.rgba};const r=t.rgba>>24&255,n=t.rgba>>16&255,c=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,p=e.rgba>>8&255;return i=u+Math.round((r-u)*s),o=d+Math.round((n-d)*s),a=p+Math.round((c-p)*s),{css:l.toCss(i,o,a),rgba:l.toRgba(i,o,a)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,r){const n=p.ensureContrastRatio(e.rgba,t.rgba,r);if(n)return p.toColor(n>>24&255,n>>16&255,n>>8&255)},e.opaque=function(e){const t=(255|e.rgba)>>>0;return[i,o,a]=p.toChannels(t),{css:l.toCss(i,o,a),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,r){return s=255&e.rgba,t(e,s*r/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(c||(t.color=c={})),function(e){let t,r;if(!n.isNode){const e=document.createElement("canvas");e.width=1,e.height=1;const n=e.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return i=parseInt(e.slice(1,2).repeat(2),16),o=parseInt(e.slice(2,3).repeat(2),16),a=parseInt(e.slice(3,4).repeat(2),16),p.toColor(i,o,a);case 5:return i=parseInt(e.slice(1,2).repeat(2),16),o=parseInt(e.slice(2,3).repeat(2),16),a=parseInt(e.slice(3,4).repeat(2),16),s=parseInt(e.slice(4,5).repeat(2),16),p.toColor(i,o,a,s);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}const n=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return i=parseInt(n[1]),o=parseInt(n[2]),a=parseInt(n[3]),s=Math.round(255*(void 0===n[5]?1:parseFloat(n[5]))),p.toColor(i,o,a,s);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[i,o,a,s]=t.getImageData(0,0,1,1).data,255!==s)throw new Error("css.toColor: Unsupported css format");return{rgba:l.toRgba(i,o,a,s),css:e}}}(u||(t.css=u={})),function(e){function t(e,t,r){const n=e/255,i=t/255,o=r/255;return.2126*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.7152*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(d||(t.rgb=d={})),function(e){function t(e,t,r){const n=e>>24&255,i=e>>16&255,o=e>>8&255;let a=t>>24&255,s=t>>16&255,l=t>>8&255,c=g(d.relativeLuminance2(a,s,l),d.relativeLuminance2(n,i,o));for(;c<r&&(a>0||s>0||l>0);)a-=Math.max(0,Math.ceil(.1*a)),s-=Math.max(0,Math.ceil(.1*s)),l-=Math.max(0,Math.ceil(.1*l)),c=g(d.relativeLuminance2(a,s,l),d.relativeLuminance2(n,i,o));return(a<<24|s<<16|l<<8|255)>>>0}function r(e,t,r){const n=e>>24&255,i=e>>16&255,o=e>>8&255;let a=t>>24&255,s=t>>16&255,l=t>>8&255,c=g(d.relativeLuminance2(a,s,l),d.relativeLuminance2(n,i,o));for(;c<r&&(a<255||s<255||l<255);)a=Math.min(255,a+Math.ceil(.1*(255-a))),s=Math.min(255,s+Math.ceil(.1*(255-s))),l=Math.min(255,l+Math.ceil(.1*(255-l))),c=g(d.relativeLuminance2(a,s,l),d.relativeLuminance2(n,i,o));return(a<<24|s<<16|l<<8|255)>>>0}e.ensureContrastRatio=function(e,n,i){const o=d.relativeLuminance(e>>8),a=d.relativeLuminance(n>>8);if(g(o,a)<i){if(a<o){const a=t(e,n,i),s=g(o,d.relativeLuminance(a>>8));if(s<i){const t=r(e,n,i);return s>g(o,d.relativeLuminance(t>>8))?a:t}return a}const s=r(e,n,i),l=g(o,d.relativeLuminance(s>>8));if(l<i){const r=t(e,n,i);return l>g(o,d.relativeLuminance(r>>8))?s:r}return s}},e.reduceLuminance=t,e.increaseLuminance=r,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,r,n){return{css:l.toCss(e,t,r,n),rgba:l.toRgba(e,t,r,n)}}}(p||(t.rgba=p={})),t.toPaddedHex=f,t.contrastRatio=g},8969:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const n=r(844),i=r(2585),o=r(4348),a=r(7866),s=r(744),l=r(7302),c=r(6975),u=r(8460),d=r(1753),p=r(1480),h=r(7994),f=r(9282),g=r(5435),m=r(5981),v=r(2660);let y=!1;class b extends n.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),this._onScroll.event(e=>{var t;null===(t=this._onScrollApi)||void 0===t||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(const t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new n.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new l.OptionsService(e)),this._instantiationService.setService(i.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(s.BufferService)),this._instantiationService.setService(i.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(a.LogService)),this._instantiationService.setService(i.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(c.CoreService)),this._instantiationService.setService(i.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(i.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(p.UnicodeService)),this._instantiationService.setService(i.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(h.CharsetService),this._instantiationService.setService(i.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(v.OscLinkService),this._instantiationService.setService(i.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new m.WriteBuffer((e,t)=>this._inputHandler.parse(e,t))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=i.LogLevelEnum.WARN&&!y&&(this._logService.warn("writeSync is unreliable and will be removed soon."),y=!0),this._writeBuffer.writeSync(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,s.MINIMUM_COLS),t=Math.max(t,s.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,r){this._bufferService.scrollLines(e,t,r)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){const t=e-this._bufferService.buffer.ydisp;0!==t&&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;const t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.buildNumber&&void 0!==t.buildNumber?e=!!("conpty"===t.backend&&t.buildNumber<21376):this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const e=[];e.push(this.onLineFeed(f.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>((0,f.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,n.toDisposable)(()=>{for(const t of e)t.dispose()})}}}t.CoreTerminal=b},8460:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed)for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}})),this._event}fire(e,t){const r=[];for(let n=0;n<this._listeners.length;n++)r.push(this._listeners[n]);for(let n=0;n<r.length;n++)r[n].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e(e=>t.fire(e))}},5435:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const o=r(2584),a=r(7116),s=r(2015),l=r(844),c=r(482),u=r(8437),d=r(8460),p=r(643),h=r(511),f=r(3734),g=r(2585),m=r(6242),v=r(6351),y=r(5941),b={"(":0,")":1,"*":2,"+":3,"-":1,".":2},q=131072;function V(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 S,E;(E=S||(t.WindowsOptionsReportType=S={}))[E.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",E[E.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS";let x=0;class C extends l.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,r,n,i,l,p,f,g=new s.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=i,this._oscLinkService=l,this._coreMouseService=p,this._unicodeService=f,this._parser=g,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new c.StringToUtf32,this._utf8Decoder=new c.Utf8ToUtf32,this._workCell=new h.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new w(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,t,r)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:r})}),this._parser.setDcsHandlerFallback((e,t,r)=>{"HOOK"===t&&(r=r.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:r})}),this._parser.setPrintHandler((e,t,r)=>this.print(e,t,r)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(o.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(o.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(o.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(o.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(o.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(o.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(o.C1.IND,()=>this.index()),this._parser.setExecuteHandler(o.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(o.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new m.OscHandler(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new m.OscHandler(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new m.OscHandler(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new m.OscHandler(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new m.OscHandler(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new m.OscHandler(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new m.OscHandler(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new m.OscHandler(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new m.OscHandler(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new m.OscHandler(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new m.OscHandler(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new m.OscHandler(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(const o in a.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:o},()=>this.selectCharset("("+o)),this._parser.registerEscHandler({intermediates:")",final:o},()=>this.selectCharset(")"+o)),this._parser.registerEscHandler({intermediates:"*",final:o},()=>this.selectCharset("*"+o)),this._parser.registerEscHandler({intermediates:"+",final:o},()=>this.selectCharset("+"+o)),this._parser.registerEscHandler({intermediates:"-",final:o},()=>this.selectCharset("-"+o)),this._parser.registerEscHandler({intermediates:".",final:o},()=>this.selectCharset("."+o)),this._parser.registerEscHandler({intermediates:"/",final:o},()=>this.selectCharset("/"+o));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new v.DcsHandler((e,t)=>this.requestStatusString(e,t)))}_preserveStack(e,t,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,i=this._activeBuffer.y,o=0;const a=this._parseStack.paused;if(a){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>q&&(o=this._parseStack.position+q)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+("string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`),"string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<q&&(this._parseBuffer=new Uint32Array(Math.min(e.length,q))),a||this._dirtyRowTracker.clearRange(),e.length>q)for(let s=o;s<e.length;s+=q){const t=s+q<e.length?s+q:e.length,o="string"==typeof e?this._stringDecoder.decode(e.substring(s,t),this._parseBuffer):this._utf8Decoder.decode(e.subarray(s,t),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,o))return this._preserveStack(n,i,o,s),this._logSlowResolvingAsync(r),r}else if(!a){const t="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,t))return this._preserveStack(n,i,t,0),this._logSlowResolvingAsync(r),r}this._activeBuffer.x===n&&this._activeBuffer.y===i||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(e,t,r){let n,i;const o=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,u=this._coreService.modes.insertMode,d=this._curAttrData;let h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&2===h.getWidth(this._activeBuffer.x-1)&&h.setCellFromCodePoint(this._activeBuffer.x-1,0,1,d.fg,d.bg,d.extended);for(let f=t;f<r;++f){if(n=e[f],i=this._unicodeService.wcwidth(n),n<127&&o){const e=o[String.fromCharCode(n)];e&&(n=e.charCodeAt(0))}if(a&&this._onA11yChar.fire((0,c.stringFromCodePoint)(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),i||!this._activeBuffer.x){if(this._activeBuffer.x+i-1>=s)if(l){for(;this._activeBuffer.x<s;)h.setCellFromCodePoint(this._activeBuffer.x++,0,1,d.fg,d.bg,d.extended);this._activeBuffer.x=0,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=s-1,2===i)continue;if(u&&(h.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(d),d),2===h.getWidth(s-1)&&h.setCellFromCodePoint(s-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,d.fg,d.bg,d.extended)),h.setCellFromCodePoint(this._activeBuffer.x++,n,i,d.fg,d.bg,d.extended),i>0)for(;--i;)h.setCellFromCodePoint(this._activeBuffer.x++,0,0,d.fg,d.bg,d.extended)}else h.getWidth(this._activeBuffer.x-1)?h.addCodepointToCell(this._activeBuffer.x-1,n):h.addCodepointToCell(this._activeBuffer.x-2,n)}r-t>0&&(h.loadCell(this._activeBuffer.x-1,this._workCell),2===this._workCell.getWidth()||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<s&&r-t>0&&0===h.getWidth(this._activeBuffer.x)&&!h.hasContent(this._activeBuffer.x)&&h.setCellFromCodePoint(this._activeBuffer.x,0,1,d.fg,d.bg,d.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,e=>!V(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new v.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new m.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(null===(e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))||void 0===e?void 0:e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const 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;const 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){const 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){const 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){const t=e.params[0];return 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(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){const t=e.params[0];return 1===t&&(this._curAttrData.bg|=536870912),2!==t&&0!==t||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,n=!1,i=!1){const o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),i),n&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){const r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){let r;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 3:const e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const r=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}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;const r=this._activeBuffer.ybase+this._activeBuffer.y;let n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(r,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}insertChars(e){this._restrictCursor();const 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._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();const 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._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(u.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);e.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),e.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;const t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);e.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),e.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;const t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);e.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),e.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;const t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);e.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();const 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._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){if(!this._parser.precedingCodepoint)return!0;const t=e.params[0]||1,r=new Uint32Array(t);for(let n=0;n<t;++n)r[n]=this._parser.precedingCodepoint;return this.print(r,0,r.length),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,a.DEFAULT_CHARSET),this._charsetService.setgCharset(1,a.DEFAULT_CHARSET),this._charsetService.setgCharset(2,a.DEFAULT_CHARSET),this._charsetService.setgCharset(3,a.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),1049===e.params[t]&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(e,t){const r=this._coreService.decPrivateModes,{activeProtocol:n,activeEncoding:i}=this._coreMouseService,a=this._coreService,{buffers:s,cols:l}=this._bufferService,{active:c,alt:u}=s,d=this._optionsService.rawOptions,p=e=>e?1:2,h=e.params[0];return f=h,g=t?2===h?4:4===h?p(a.modes.insertMode):12===h?3:20===h?p(d.convertEol):0:1===h?p(r.applicationCursorKeys):3===h?d.windowOptions.setWinLines?80===l?2:132===l?1:0:0:6===h?p(r.origin):7===h?p(r.wraparound):8===h?3:9===h?p("X10"===n):12===h?p(d.cursorBlink):25===h?p(!a.isCursorHidden):45===h?p(r.reverseWraparound):66===h?p(r.applicationKeypad):67===h?4:1e3===h?p("VT200"===n):1002===h?p("DRAG"===n):1003===h?p("ANY"===n):1004===h?p(r.sendFocus):1005===h?4:1006===h?p("SGR"===i):1015===h?4:1016===h?p("SGR_PIXELS"===i):1048===h?1:47===h||1047===h||1049===h?p(c===u):2004===h?p(r.bracketedPasteMode):0,a.triggerDataEvent(`${o.C0.ESC}[${t?"":"?"}${f};${g}$y`),!0;var f,g}_updateAttrColor(e,t,r,n,i){return 2===t?(e|=50331648,e&=-16777216,e|=f.AttributeData.fromColorRGB([r,n,i])):5===t&&(e&=-50331904,e|=33554432|255&r),e}_extractColor(e,t,r){const n=[0,0,-1,0,0,0];let i=0,o=0;do{if(n[o+i]=e.params[t+o],e.hasSubParams(t+o)){const r=e.getSubParams(t+o);let a=0;do{5===n[1]&&(i=1),n[o+a+1+i]=r[a]}while(++a<r.length&&a+o+1+i<n.length);break}if(5===n[1]&&o+i>=2||2===n[1]&&o+i>=5)break;n[1]&&(i=1)}while(++o+t<e.length&&o+i<n.length);for(let a=2;a<n.length;++a)-1===n[a]&&(n[a]=0);switch(n[0]){case 38:r.fg=this._updateAttrColor(r.fg,n[1],n[3],n[4],n[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,n[1],n[3],n[4],n[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,n[1],n[3],n[4],n[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=u.DEFAULT_ATTR_DATA.fg,e.bg=u.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;const t=e.length;let r;const n=this._curAttrData;for(let i=0;i<t;i++)r=e.params[i],r>=30&&r<=37?(n.fg&=-50331904,n.fg|=16777216|r-30):r>=40&&r<=47?(n.bg&=-50331904,n.bg|=16777216|r-40):r>=90&&r<=97?(n.fg&=-50331904,n.fg|=16777224|r-90):r>=100&&r<=107?(n.bg&=-50331904,n.bg|=16777224|r-100):0===r?this._processSGR0(n):1===r?n.fg|=134217728:3===r?n.bg|=67108864:4===r?(n.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,n)):5===r?n.fg|=536870912:7===r?n.fg|=67108864:8===r?n.fg|=1073741824:9===r?n.fg|=2147483648:2===r?n.bg|=134217728:21===r?this._processUnderline(2,n):22===r?(n.fg&=-134217729,n.bg&=-134217729):23===r?n.bg&=-67108865:24===r?(n.fg&=-268435457,this._processUnderline(0,n)):25===r?n.fg&=-536870913:27===r?n.fg&=-67108865:28===r?n.fg&=-1073741825:29===r?n.fg&=2147483647:39===r?(n.fg&=-67108864,n.fg|=16777215&u.DEFAULT_ATTR_DATA.fg):49===r?(n.bg&=-67108864,n.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):38===r||48===r||58===r?i+=this._extractColor(e,i,n):53===r?n.bg|=1073741824:55===r?n.bg&=-1073741825:59===r?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):100===r?(n.fg&=-67108864,n.fg|=16777215&u.DEFAULT_ATTR_DATA.fg,n.bg&=-67108864,n.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){const t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const r=t%2==1;return this._optionsService.options.cursorBlink=r,!0}setScrollRegion(e){const t=e.params[0]||1;let r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||0===r)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!V(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;const t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(S.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(S.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){const t=[],r=e.split(";");for(;r.length>1;){const e=r.shift(),n=r.shift();if(/^\d+$/.exec(e)){const r=parseInt(e);if(R(r))if("?"===n)t.push({type:0,index:r});else{const e=(0,y.parseColor)(n);e&&t.push({type:1,index:r,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){const t=e.split(";");return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();const r=e.split(":");let n;const i=r.findIndex(e=>e.startsWith("id="));return-1!==i&&(n=r[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,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){const r=e.split(";");for(let n=0;n<r.length&&!(t>=this._specialColors.length);++n,++t)if("?"===r[n])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{const e=(0,y.parseColor)(r[n]);e&&this._onColor.fire([{type:1,index:this._specialColors[t],color:e}])}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;const t=[],r=e.split(";");for(let n=0;n<r.length;++n)if(/^\d+$/.exec(r[n])){const e=parseInt(r[n]);R(e)&&t.push({type:2,index:e})}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,a.DEFAULT_CHARSET),!0}selectCharset(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(b[e[0]],a.CHARSETS[e[1]]||a.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){const e=new h.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){const r=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(r);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){const r=this._bufferService.buffer,n=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${e}${o.C0.ESC}\\`),!0))('"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[n.cursorStyle]-(n.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=C;let w=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&&(x=e,e=t,t=x),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function R(e){return 0<=e&&e<256}w=n([i(0,g.IBufferService)],w)},844:(e,t)=>{function r(e){for(const t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){const t=this._disposables.indexOf(e);-1!==t&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null===(t=this._value)||void 0===t||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,null===(e=this._value)||void 0===e||e.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=r,t.getDisposeArrayDisposable=function(e){return{dispose:()=>r(e)}}},1505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class r{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=r,t.FourKeyMap=class{constructor(){this._data=new r}set(e,t,n,i,o){this._data.get(e,t)||this._data.set(e,t,new r),this._data.get(e,t).set(n,i,o)}get(e,t,r,n){var i;return null===(i=this._data.get(e,t))||void 0===i?void 0:i.get(r,n)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode="undefined"==typeof navigator;const r=t.isNode?"node":navigator.userAgent,n=t.isNode?"node":navigator.platform;t.isFirefox=r.includes("Firefox"),t.isLegacyEdge=r.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(r),t.getSafariVersion=function(){if(!t.isSafari)return 0;const e=r.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(n),t.isIpad="iPad"===n,t.isIphone="iPhone"===n,t.isWindows=["Windows","Win16","Win32","WinCE"].includes(n),t.isLinux=n.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(r)},6106:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let r=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){0!==this._array.length?(r=this._search(this._getKey(e)),this._array.splice(r,0,e)):this._array.push(e)}delete(e){if(0===this._array.length)return!1;const t=this._getKey(e);if(void 0===t)return!1;if(r=this._search(t),-1===r)return!1;if(this._getKey(this._array[r])!==t)return!1;do{if(this._array[r]===e)return this._array.splice(r,1),!0}while(++r<this._array.length&&this._getKey(this._array[r])===t);return!1}*getKeyIterator(e){if(0!==this._array.length&&(r=this._search(e),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===e))do{yield this._array[r]}while(++r<this._array.length&&this._getKey(this._array[r])===e)}forEachByKey(e,t){if(0!==this._array.length&&(r=this._search(e),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===e))do{t(this._array[r])}while(++r<this._array.length&&this._getKey(this._array[r])===e)}values(){return[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let n=t+r>>1;const i=this._getKey(this._array[n]);if(i>e)r=n-1;else{if(!(i<e)){for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}t=n+1}}return t}}},7226:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const n=r(6114);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),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,r=0,n=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),r=Math.max(t,r),i=e.timeRemaining(),1.5*r>i)return void this._start();n=i}this.clear()}}class o extends i{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){const t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=o,t.IdleTaskQueue=!n.isNode&&"requestIdleCallback"in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:o,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const n=r(643);t.updateWindowsModeWrappedState=function(e){const t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),r=null==t?void 0:t.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&r&&(i.isWrapped=r[n.CHAR_DATA_CODE_INDEX]!==n.NULL_CELL_CODE&&r[n.CHAR_DATA_CODE_INDEX]!==n.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class r{constructor(){this.fg=0,this.bg=0,this.extended=new n}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){const e=new r;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return!(50331648&~this.fg)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&~this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}t.AttributeData=r;class n{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new n(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}}t.ExtendedAttrs=n},9092:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const n=r(6349),i=r(7226),o=r(3734),a=r(8437),s=r(4634),l=r(511),c=r(643),u=r(4863),d=r(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=a.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=l.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]),this._whitespaceCell=l.CellData.fromCharData([0,c.WHITESPACE_CELL_CHAR,c.WHITESPACE_CELL_WIDTH,c.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new i.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new n.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new a.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;const r=e+this._optionsService.rawOptions.scrollback;return r>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:r}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=a.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new n.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){const r=this.getNullCell(a.DEFAULT_ATTR_DATA);let n=0;const i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)n+=+this.lines.get(t).resize(e,r);let o=0;if(this._rows<t)for(let n=this._rows;n<t;n++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new a.BufferLine(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new a.BufferLine(e,r)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){const e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),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 o=0;o<this.lines.length;o++)n+=+this.lines.get(o).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.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(){const e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&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){const r=(0,s.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(a.DEFAULT_ATTR_DATA));if(r.length>0){const n=(0,s.reflowLargerCreateNewLayout)(this.lines,r);(0,s.reflowLargerApplyNewLayout)(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){const n=this.getNullCell(a.DEFAULT_ATTR_DATA);let i=r;for(;i-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new a.BufferLine(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){const r=this.getNullCell(a.DEFAULT_ATTR_DATA),n=[];let i=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;const c=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),c.unshift(l);const u=this.ybase+this.y;if(u>=o&&u<o+c.length)continue;const d=c[c.length-1].getTrimmedLength(),p=(0,s.reflowSmallerGetNewLineLengths)(c,this._cols,e),h=p.length-c.length;let f;f=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+h):Math.max(0,this.lines.length-this.lines.maxLength+h);const g=[];for(let e=0;e<h;e++){const e=this.getBlankLine(a.DEFAULT_ATTR_DATA,!0);g.push(e)}g.length>0&&(n.push({start:o+c.length+i,newLines:g}),i+=g.length),c.push(...g);let m=p.length-1,v=p[m];0===v&&(m--,v=p[m]);let y=c.length-h-1,b=d;for(;y>=0;){const e=Math.min(b,v);if(void 0===c[m])break;if(c[m].copyCellsFrom(c[y],b-e,v-e,e,!0),v-=e,0===v&&(m--,v=p[m]),b-=e,0===b){y--;const e=Math.max(y,0);b=(0,s.getWrappedLineTrimmedLength)(c,e,this._cols)}}for(let t=0;t<c.length;t++)p[t]<e&&c[t].setCell(p[t],r);let q=h-f;for(;q-- >0;)0===this.ybase?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+i)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+h,this.ybase+t-1)}if(n.length>0){const e=[],t=[];for(let n=0;n<this.lines.length;n++)t.push(this.lines.get(n));const r=this.lines.length;let o=r-1,a=0,s=n[a];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+i);let l=0;for(let d=Math.min(this.lines.maxLength-1,r+i-1);d>=0;d--)if(s&&s.start>o+l){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(d--,s.newLines[e]);d++,e.push({index:o+1,amount:s.newLines.length}),l+=s.newLines.length,s=n[++a]}else this.lines.set(d,t[o--]);let c=0;for(let n=e.length-1;n>=0;n--)e[n].index+=c,this.lines.onInsertEmitter.fire(e[n]),c+=e[n].amount;const u=Math.max(0,r+i-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,r=0,n){const i=this.lines.get(e);return i?i.translateToString(t,r,n):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(null!=e?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(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){const t=new u.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const n=r(3734),i=r(511),o=r(643),a=r(482);t.DEFAULT_ATTR_DATA=Object.freeze(new n.AttributeData);let s=0;class l{constructor(e,t,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const n=t||i.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let i=0;i<e;++i)this.setCell(i,n);this.length=e}get(e){const t=this._data[3*e+0],r=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:r?(0,a.stringFromCodePoint)(r):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,t){this._data[3*e+1]=t[o.CHAR_DATA_ATTR_INDEX],t[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,a.stringFromCodePoint)(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return s=3*e,t.content=this._data[s+0],t.fg=this._data[s+1],t.bg=this._data[s+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodePoint(e,t,r,n,i,o){268435456&i&&(this._extendedAttrs[e]=o),this._data[3*e+0]=t|r<<22,this._data[3*e+1]=n,this._data[3*e+2]=i}addCodepointToCell(e,t){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,a.stringFromCodePoint)(t):(2097151&r?(this._combined[e]=(0,a.stringFromCodePoint)(2097151&r)+(0,a.stringFromCodePoint)(t),r&=-2097152,r|=2097152):r=t|1<<22,this._data[3*e+0]=r)}insertCells(e,t,r,o){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==o?void 0:o.fg)||0,(null==o?void 0:o.bg)||0,(null==o?void 0:o.extended)||new n.ExtendedAttrs),t<this.length-e){const n=new i.CellData;for(let r=this.length-e-t-1;r>=0;--r)this.setCell(e+t+r,this.loadCell(e+r,n));for(let i=0;i<t;++i)this.setCell(e+i,r)}else for(let n=e;n<this.length;++n)this.setCell(n,r);2===this.getWidth(this.length-1)&&this.setCellFromCodePoint(this.length-1,0,1,(null==o?void 0:o.fg)||0,(null==o?void 0:o.bg)||0,(null==o?void 0:o.extended)||new n.ExtendedAttrs)}deleteCells(e,t,r,o){if(e%=this.length,t<this.length-e){const n=new i.CellData;for(let r=0;r<this.length-e-t;++r)this.setCell(e+r,this.loadCell(e+t+r,n));for(let e=this.length-t;e<this.length;++e)this.setCell(e,r)}else for(let n=e;n<this.length;++n)this.setCell(n,r);e&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==o?void 0:o.fg)||0,(null==o?void 0:o.bg)||0,(null==o?void 0:o.extended)||new n.ExtendedAttrs),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodePoint(e,0,1,(null==o?void 0:o.fg)||0,(null==o?void 0:o.bg)||0,(null==o?void 0:o.extended)||new n.ExtendedAttrs)}replaceCells(e,t,r,i,o=!1){if(o)for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new n.ExtendedAttrs),t<this.length&&2===this.getWidth(t-1)&&!this.isProtected(t)&&this.setCellFromCodePoint(t,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new n.ExtendedAttrs);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;else for(e&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new n.ExtendedAttrs),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodePoint(t,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new n.ExtendedAttrs);e<t&&e<this.length;)this.setCell(e++,r)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const r=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{const e=new Uint32Array(r);e.set(this._data),this._data=e}for(let r=this.length;r<e;++r)this.setCell(r,t)}else{this._data=this._data.subarray(0,r);const t=Object.keys(this._combined);for(let r=0;r<t.length;r++){const n=parseInt(t[r],10);n>=e&&delete this._combined[n]}const n=Object.keys(this._extendedAttrs);for(let r=0;r<n.length;r++){const t=parseInt(n[r],10);t>=e&&delete this._extendedAttrs[t]}}return this.length=e,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(const t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){const e=new l(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const t in this._combined)e._combined[t]=this._combined[t];for(const t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,r,n,i){const o=e._data;if(i)for(let s=n-1;s>=0;s--){for(let e=0;e<3;e++)this._data[3*(r+s)+e]=o[3*(t+s)+e];268435456&o[3*(t+s)+2]&&(this._extendedAttrs[r+s]=e._extendedAttrs[t+s])}else for(let s=0;s<n;s++){for(let e=0;e<3;e++)this._data[3*(r+s)+e]=o[3*(t+s)+e];268435456&o[3*(t+s)+2]&&(this._extendedAttrs[r+s]=e._extendedAttrs[t+s])}const a=Object.keys(e._combined);for(let s=0;s<a.length;s++){const n=parseInt(a[s],10);n>=t&&(this._combined[n-t+r]=e._combined[n])}}translateToString(e=!1,t=0,r=this.length){e&&(r=Math.min(r,this.getTrimmedLength()));let n="";for(;t<r;){const e=this._data[3*t+0],r=2097151&e;n+=2097152&e?this._combined[t]:r?(0,a.stringFromCodePoint)(r):o.WHITESPACE_CELL_CHAR,t+=e>>22||1}return n}}t.BufferLine=l},4841:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw 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)}},4634:(e,t)=>{function r(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();const n=!e[t].hasContent(r-1)&&1===e[t].getWidth(r-1),i=2===e[t+1].getWidth(0);return n&&i?r-1:r}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,n,i,o){const a=[];for(let s=0;s<e.length-1;s++){let l=s,c=e.get(++l);if(!c.isWrapped)continue;const u=[e.get(s)];for(;l<e.length&&c.isWrapped;)u.push(c),c=e.get(++l);if(i>=s&&i<l){s+=u.length-1;continue}let d=0,p=r(u,d,t),h=1,f=0;for(;h<u.length;){const e=r(u,h,t),i=e-f,a=n-p,s=Math.min(i,a);u[d].copyCellsFrom(u[h],f,p,s,!1),p+=s,p===n&&(d++,p=0),f+=s,f===e&&(h++,f=0),0===p&&0!==d&&2===u[d-1].getWidth(n-1)&&(u[d].copyCellsFrom(u[d-1],n-1,p++,1,!1),u[d-1].setCell(n-1,o))}u[d].replaceCells(p,n,o);let g=0;for(let e=u.length-1;e>0&&(e>d||0===u[e].getTrimmedLength());e--)g++;g>0&&(a.push(s+u.length-g),a.push(g)),s+=u.length-1}return a},t.reflowLargerCreateNewLayout=function(e,t){const r=[];let n=0,i=t[n],o=0;for(let a=0;a<e.length;a++)if(i===a){const r=t[++n];e.onDeleteEmitter.fire({index:a-o,amount:r}),a+=r-1,o+=r,i=t[++n]}else r.push(a);return{layout:r,countRemoved:o}},t.reflowLargerApplyNewLayout=function(e,t){const r=[];for(let n=0;n<t.length;n++)r.push(e.get(t[n]));for(let n=0;n<r.length;n++)e.set(n,r[n]);e.length=t.length},t.reflowSmallerGetNewLineLengths=function(e,t,n){const i=[],o=e.map((n,i)=>r(e,i,t)).reduce((e,t)=>e+t);let a=0,s=0,l=0;for(;l<o;){if(o-l<n){i.push(o-l);break}a+=n;const c=r(e,s,t);a>c&&(a-=c,s++);const u=2===e[s].getWidth(a-1);u&&a--;const d=u?n-1:n;i.push(d),l+=d}return i},t.getWrappedLineTrimmedLength=r},5295:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const n=r(8460),i=r(844),o=r(9092);class a extends i.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new n.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=a},511:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const n=r(482),i=r(643),o=r(3734);class a extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(e){const t=new a;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,n.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[i.CHAR_DATA_CHAR_INDEX].length){const r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=r&&r<=56319){const n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(r-55296)+n-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=a},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const n=r(8460),i=r(844);class o{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new n.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,i.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=o,o._nextId=1},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(e,t)=>{var r,n,i,o;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,(o=r||(t.C0=r={})).NUL="\0",o.SOH="",o.STX="",o.ETX="",o.EOT="",o.ENQ="",o.ACK="",o.BEL="",o.BS="\b",o.HT="\t",o.LF="\n",o.VT="\v",o.FF="\f",o.CR="\r",o.SO="",o.SI="",o.DLE="",o.DC1="",o.DC2="",o.DC3="",o.DC4="",o.NAK="",o.SYN="",o.ETB="",o.CAN="",o.EM="",o.SUB="",o.ESC="",o.FS="",o.GS="",o.RS="",o.US="",o.SP=" ",o.DEL="",function(e){e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"}(n||(t.C1=n={})),function(e){e.ST=`${r.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const n=r(2584),i={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(e,t,r,o){const a={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?a.key=t?n.C0.ESC+"OA":n.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?a.key=t?n.C0.ESC+"OD":n.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?a.key=t?n.C0.ESC+"OC":n.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(a.key=t?n.C0.ESC+"OB":n.C0.ESC+"[B");break;case 8:if(e.altKey){a.key=n.C0.ESC+n.C0.DEL;break}a.key=n.C0.DEL;break;case 9:if(e.shiftKey){a.key=n.C0.ESC+"[Z";break}a.key=n.C0.HT,a.cancel=!0;break;case 13:a.key=e.altKey?n.C0.ESC+n.C0.CR:n.C0.CR,a.cancel=!0;break;case 27:a.key=n.C0.ESC,e.altKey&&(a.key=n.C0.ESC+n.C0.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;s?(a.key=n.C0.ESC+"[1;"+(s+1)+"D",a.key===n.C0.ESC+"[1;3D"&&(a.key=n.C0.ESC+(r?"b":"[1;5D"))):a.key=t?n.C0.ESC+"OD":n.C0.ESC+"[D";break;case 39:if(e.metaKey)break;s?(a.key=n.C0.ESC+"[1;"+(s+1)+"C",a.key===n.C0.ESC+"[1;3C"&&(a.key=n.C0.ESC+(r?"f":"[1;5C"))):a.key=t?n.C0.ESC+"OC":n.C0.ESC+"[C";break;case 38:if(e.metaKey)break;s?(a.key=n.C0.ESC+"[1;"+(s+1)+"A",r||a.key!==n.C0.ESC+"[1;3A"||(a.key=n.C0.ESC+"[1;5A")):a.key=t?n.C0.ESC+"OA":n.C0.ESC+"[A";break;case 40:if(e.metaKey)break;s?(a.key=n.C0.ESC+"[1;"+(s+1)+"B",r||a.key!==n.C0.ESC+"[1;3B"||(a.key=n.C0.ESC+"[1;5B")):a.key=t?n.C0.ESC+"OB":n.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(a.key=n.C0.ESC+"[2~");break;case 46:a.key=s?n.C0.ESC+"[3;"+(s+1)+"~":n.C0.ESC+"[3~";break;case 36:a.key=s?n.C0.ESC+"[1;"+(s+1)+"H":t?n.C0.ESC+"OH":n.C0.ESC+"[H";break;case 35:a.key=s?n.C0.ESC+"[1;"+(s+1)+"F":t?n.C0.ESC+"OF":n.C0.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=n.C0.ESC+"[5;"+(s+1)+"~":a.key=n.C0.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=n.C0.ESC+"[6;"+(s+1)+"~":a.key=n.C0.ESC+"[6~";break;case 112:a.key=s?n.C0.ESC+"[1;"+(s+1)+"P":n.C0.ESC+"OP";break;case 113:a.key=s?n.C0.ESC+"[1;"+(s+1)+"Q":n.C0.ESC+"OQ";break;case 114:a.key=s?n.C0.ESC+"[1;"+(s+1)+"R":n.C0.ESC+"OR";break;case 115:a.key=s?n.C0.ESC+"[1;"+(s+1)+"S":n.C0.ESC+"OS";break;case 116:a.key=s?n.C0.ESC+"[15;"+(s+1)+"~":n.C0.ESC+"[15~";break;case 117:a.key=s?n.C0.ESC+"[17;"+(s+1)+"~":n.C0.ESC+"[17~";break;case 118:a.key=s?n.C0.ESC+"[18;"+(s+1)+"~":n.C0.ESC+"[18~";break;case 119:a.key=s?n.C0.ESC+"[19;"+(s+1)+"~":n.C0.ESC+"[19~";break;case 120:a.key=s?n.C0.ESC+"[20;"+(s+1)+"~":n.C0.ESC+"[20~";break;case 121:a.key=s?n.C0.ESC+"[21;"+(s+1)+"~":n.C0.ESC+"[21~";break;case 122:a.key=s?n.C0.ESC+"[23;"+(s+1)+"~":n.C0.ESC+"[23~";break;case 123:a.key=s?n.C0.ESC+"[24;"+(s+1)+"~":n.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(r&&!o||!e.altKey||e.metaKey)!r||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?a.key=e.key:e.key&&e.ctrlKey&&("_"===e.key&&(a.key=n.C0.US),"@"===e.key&&(a.key=n.C0.NUL)):65===e.keyCode&&(a.type=1);else{const t=i[e.keyCode],r=null==t?void 0:t[e.shiftKey?1:0];if(r)a.key=n.C0.ESC+r;else if(e.keyCode>=65&&e.keyCode<=90){const t=e.ctrlKey?e.keyCode-64:e.keyCode+32;let r=String.fromCharCode(t);e.shiftKey&&(r=r.toUpperCase()),a.key=n.C0.ESC+r}else if(32===e.keyCode)a.key=n.C0.ESC+(e.ctrlKey?n.C0.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),a.key=n.C0.ESC+t,a.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?a.key=n.C0.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?a.key=n.C0.DEL:219===e.keyCode?a.key=n.C0.ESC:220===e.keyCode?a.key=n.C0.FS:221===e.keyCode&&(a.key=n.C0.GS)}return a}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,r=e.length){let n="";for(let i=t;i<r;++i){let t=e[i];t>65535?(t-=65536,n+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):n+=String.fromCharCode(t)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){const r=e.length;if(!r)return 0;let n=0,i=0;if(this._interim){const r=e.charCodeAt(i++);56320<=r&&r<=57343?t[n++]=1024*(this._interim-55296)+r-56320+65536:(t[n++]=this._interim,t[n++]=r),this._interim=0}for(let o=i;o<r;++o){const i=e.charCodeAt(o);if(55296<=i&&i<=56319){if(++o>=r)return this._interim=i,n;const a=e.charCodeAt(o);56320<=a&&a<=57343?t[n++]=1024*(i-55296)+a-56320+65536:(t[n++]=i,t[n++]=a)}else 65279!==i&&(t[n++]=i)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){const r=e.length;if(!r)return 0;let n,i,o,a,s=0,l=0,c=0;if(this.interim[0]){let n=!1,i=this.interim[0];i&=192==(224&i)?31:224==(240&i)?15:7;let o,a=0;for(;(o=63&this.interim[++a])&&a<4;)i<<=6,i|=o;const l=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,u=l-a;for(;c<u;){if(c>=r)return 0;if(o=e[c++],128!=(192&o)){c--,n=!0;break}this.interim[a++]=o,i<<=6,i|=63&o}n||(2===l?i<128?c--:t[s++]=i:3===l?i<2048||i>=55296&&i<=57343||65279===i||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}const u=r-4;let d=c;for(;d<r;){for(;!(!(d<u)||128&(n=e[d])||128&(i=e[d+1])||128&(o=e[d+2])||128&(a=e[d+3]));)t[s++]=n,t[s++]=i,t[s++]=o,t[s++]=a,d+=4;if(n=e[d++],n<128)t[s++]=n;else if(192==(224&n)){if(d>=r)return this.interim[0]=n,s;if(i=e[d++],128!=(192&i)){d--;continue}if(l=(31&n)<<6|63&i,l<128){d--;continue}t[s++]=l}else if(224==(240&n)){if(d>=r)return this.interim[0]=n,s;if(i=e[d++],128!=(192&i)){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=i,s;if(o=e[d++],128!=(192&o)){d--;continue}if(l=(15&n)<<12|(63&i)<<6|63&o,l<2048||l>=55296&&l<=57343||65279===l)continue;t[s++]=l}else if(240==(248&n)){if(d>=r)return this.interim[0]=n,s;if(i=e[d++],128!=(192&i)){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=i,s;if(o=e[d++],128!=(192&o)){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=i,this.interim[2]=o,s;if(a=e[d++],128!=(192&a)){d--;continue}if(l=(7&n)<<18|(63&i)<<12|(63&o)<<6|63&a,l<65536||l>1114111)continue;t[s++]=l}}return s}}},225:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const r=[[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]],n=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let i;t.UnicodeV6=class{constructor(){if(this.version="6",!i){i=new Uint8Array(65536),i.fill(1),i[0]=0,i.fill(0,1,32),i.fill(0,127,160),i.fill(2,4352,4448),i[9001]=2,i[9002]=2,i.fill(2,11904,42192),i[12351]=1,i.fill(2,44032,55204),i.fill(2,63744,64256),i.fill(2,65040,65050),i.fill(2,65072,65136),i.fill(2,65280,65377),i.fill(2,65504,65511);for(let e=0;e<r.length;++e)i.fill(0,r[e][0],r[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?i[e]:function(e,t){let r,n=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else{if(!(e<t[r][0]))return!0;i=r-1}return!1}(e,n)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}}},5981:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const n=r(8460),i=r(844);class o extends i.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new n.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let r;for(this._isSyncWriting=!0;r=this._writeBuffer.shift();){this._action(r);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){const r=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],n=this._action(e,t);if(n){const e=e=>Date.now()-r>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(r,e);return void n.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-r>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=o},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const r=/^([\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})$/,n=/^[\da-f]+$/;function i(e,t){const r=e.toString(16),n=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(0===t.indexOf("rgb:")){t=t.slice(4);const e=r.exec(t);if(e){const t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(0===t.indexOf("#")&&(t=t.slice(1),n.exec(t)&&[3,6,9,12].includes(t.length))){const e=t.length/3,r=[0,0,0];for(let n=0;n<3;++n){const i=parseInt(t.slice(e*n,e*n+e),16);r[n]=1===e?i<<4:2===e?i:3===e?i>>4:i>>8}return r}},t.toRgbString=function(e,t=16){const[r,n,o]=e;return`rgb:${i(r,t)}/${i(n,t)}/${i(o,t)}`}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const n=r(482),i=r(8742),o=r(5770),a=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=a,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const r=this._handlers[e];return r.push(t),{dispose:()=>{const e=r.indexOf(t);-1!==e&&r.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=a,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||a,this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,r){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r);else this._handlerFb(this._ident,"PUT",(0,n.utf32ToString)(e,t,r))}unhook(e,t=!0){if(this._active.length){let r=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===r){for(;n>=0&&(r=this._active[n].unhook(e),!0!==r);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}else this._handlerFb(this._ident,"UNHOOK",e);this._active=a,this._ident=0}};const s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data="",this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=(0,n.utf32ToString)(e,t,r),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=s,this._data="",this._hitLimit=!1,e));return this._params=s,this._data="",this._hitLimit=!1,t}}},2015:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const n=r(844),i=r(8742),o=r(6242),a=r(6351);class s{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,n){this.table[t<<8|e]=r<<4|n}addMany(e,t,r,n){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=r<<4|n}}t.TransitionTable=s;const l=160;t.VT500_TRANSITION_TABLE=function(){const e=new s(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),r=(e,r)=>t.slice(e,r),n=r(32,127),i=r(0,24);i.push(25),i.push.apply(i,r(28,32));const o=r(0,14);let a;for(a in e.setDefault(1,0),e.addMany(n,0,2,0),o)e.addMany([24,26,153,154],a,3,0),e.addMany(r(128,144),a,3,0),e.addMany(r(144,152),a,3,0),e.add(156,a,0,0),e.add(27,a,11,1),e.add(157,a,4,8),e.addMany([152,158,159],a,0,7),e.add(155,a,11,3),e.add(144,a,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(l,0,2,0),e.add(l,8,5,8),e.add(l,6,0,6),e.add(l,11,0,11),e.add(l,13,13,13),e}();class c extends n.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new i.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(e,t,r)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,n.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new o.OscParser),this._dcsParser=this.register(new a.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>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 t=0;t<e.intermediates.length;++t){const n=e.intermediates.charCodeAt(t);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=n}}if(1!==e.final.length)throw new Error("final must be a single byte");const n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=n,r}identToString(e){const t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){const r=this._identifier(e,[48,126]);void 0===this._escHandlers[r]&&(this._escHandlers[r]=[]);const n=this._escHandlers[r];return n.push(t),{dispose:()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){const r=this._identifier(e);void 0===this._csiHandlers[r]&&(this._csiHandlers[r]=[]);const n=this._csiHandlers[r];return n.push(t),{dispose:()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,n,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=i}parse(e,t,r){let n,i=0,o=0,a=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(void 0===r||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const t=this._parseStack.handlers;let o=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===r&&o>-1)for(;o>=0&&(n=t[o](this._params),!0!==n);o--)if(n instanceof Promise)return this._parseStack.handlerPos=o,n;this._parseStack.handlers=[];break;case 4:if(!1===r&&o>-1)for(;o>=0&&(n=t[o](),!0!==n);o--)if(n instanceof Promise)return this._parseStack.handlerPos=o,n;this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],n=this._dcsParser.unhook(24!==i&&26!==i,r),n)return n;27===i&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],n=this._oscParser.end(24!==i&&26!==i,r),n)return n;27===i&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let s=a;s<t;++s){switch(i=e[s],o=this._transitions.table[this.currentState<<8|(i<160?i:l)],o>>4){case 2:for(let n=s+1;;++n){if(n>=t||(i=e[n])<32||i>126&&i<l){this._printHandler(e,s,n),s=n-1;break}if(++n>=t||(i=e[n])<32||i>126&&i<l){this._printHandler(e,s,n),s=n-1;break}if(++n>=t||(i=e[n])<32||i>126&&i<l){this._printHandler(e,s,n),s=n-1;break}if(++n>=t||(i=e[n])<32||i>126&&i<l){this._printHandler(e,s,n),s=n-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:s,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const r=this._csiHandlers[this._collect<<8|i];let a=r?r.length-1:-1;for(;a>=0&&(n=r[a](this._params),!0!==n);a--)if(n instanceof Promise)return this._preserveStack(3,r,a,o,s),n;a<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingCodepoint=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(++s<t&&(i=e[s])>47&&i<60);s--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:const c=this._escHandlers[this._collect<<8|i];let u=c?c.length-1:-1;for(;u>=0&&(n=c[u](),!0!==n);u--)if(n instanceof Promise)return this._preserveStack(4,c,u,o,s),n;u<0&&this._escHandlerFb(this._collect<<8|i),this.precedingCodepoint=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 n=s+1;;++n)if(n>=t||24===(i=e[n])||26===i||27===i||i>127&&i<l){this._dcsParser.put(e,s,n),s=n-1;break}break;case 14:if(n=this._dcsParser.unhook(24!==i&&26!==i),n)return this._preserveStack(6,[],0,o,s),n;27===i&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let n=s+1;;n++)if(n>=t||(i=e[n])<32||i>127&&i<l){this._oscParser.put(e,s,n),s=n-1;break}break;case 6:if(n=this._oscParser.end(24!==i&&26!==i),n)return this._preserveStack(5,[],0,o,s),n;27===i&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&o}}}t.EscapeSequenceParser=c},6242:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const n=r(5770),i=r(482),o=[];t.OscParser=class{constructor(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const r=this._handlers[e];return r.push(t),{dispose:()=>{const e=r.indexOf(t);-1!==e&&r.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(2===this._state)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=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,r){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r);else this._handlerFb(this._id,"PUT",(0,i.utf32ToString)(e,t,r))}start(){this.reset(),this._state=1}put(e,t,r){if(3!==this._state){if(1===this._state)for(;t<r;){const r=e[t++];if(59===r){this._state=2,this._start();break}if(r<48||57<r)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+r-48}2===this._state&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let r=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===r){for(;n>=0&&(r=this._active[n].end(e),!0!==r);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}else this._handlerFb(this._id,"END",e);this._active=o,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=(0,i.utf32ToString)(e,t,r),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const r=2147483647;class n{static fromArray(e){const t=new n;if(!e.length)return t;for(let r=Array.isArray(e[0])?1:0;r<e.length;++r){const n=e[r];if(Array.isArray(n))for(let e=0;e<n.length;++e)t.addSubParam(n[e]);else t.addParam(n)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const e=new n(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){const e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);const r=this._subParamsIdx[t]>>8,n=255&this._subParamsIdx[t];n-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,n))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>r?r:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>r?r:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){const t=this._subParamsIdx[e]>>8,r=255&this._subParamsIdx[e];return r-t>0?this._subParams.subarray(t,r):null}getSubParamsAll(){const e={};for(let t=0;t<this.length;++t){const r=this._subParamsIdx[t]>>8,n=255&this._subParamsIdx[t];n-r>0&&(e[t]=this._subParams.slice(r,n))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const n=this._digitIsSub?this._subParams:this.params,i=n[t-1];n[t-1]=~i?Math.min(10*i+e,r):e}}t.Params=n},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){const r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(-1===t)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)}}},8771:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const n=r(3785),i=r(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){const t=this._buffer.lines.get(e);if(t)return new n.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const n=r(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new n.CellData)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}}},8285:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const n=r(8771),i=r(8460),o=r(844);class a extends o.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new n.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new n.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=a},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,r)=>t(e,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const o=r(8460),a=r(844),s=r(5295),l=r(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let c=t.BufferService=class extends a.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){const r=this.buffer;let n;n=this._cachedBlankLine,n&&n.length===this.cols&&n.getFg(0)===e.fg&&n.getBg(0)===e.bg||(n=r.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;const i=r.ybase+r.scrollTop,o=r.ybase+r.scrollBottom;if(0===r.scrollTop){const e=r.lines.isFull;o===r.lines.length-1?e?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(o+1,0,n.clone()),e?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{const e=o-i+1;r.lines.shiftElements(i+1,e-1,-1),r.lines.set(o,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t,r){const n=this.buffer;if(e<0){if(0===n.ydisp)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);const i=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),i!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};t.BufferService=c=n([i(0,l.IOptionsService)],c)},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const o=r(2585),a=r(8460),s=r(844),l={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function c(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(r|=64,r|=e.action):(r|=3&e.button,4&e.button&&(r|=64),8&e.button&&(r|=128),32===e.action?r|=32:0!==e.action||t||(r|=3)),r}const u=String.fromCharCode,d={DEFAULT:e=>{const t=[c(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${c(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${c(e,!0)};${e.x};${e.y}${t}`}};let p=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new a.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const r of Object.keys(l))this.addProtocol(r,l[r]);for(const r of Object.keys(d))this.addEncoding(r,d[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}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}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;const t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,r){if(r){if(e.x!==t.x)return!1;if(e.y!==t.y)return!1}else{if(e.col!==t.col)return!1;if(e.row!==t.row)return!1}return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=p=n([i(0,o.IBufferService),i(1,o.ICoreService)],p)},6975:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const o=r(1439),a=r(8460),s=r(844),l=r(2585),c=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let d=t.CoreService=class extends s.Disposable{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new a.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new a.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new a.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new a.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(c),this.decPrivateModes=(0,o.clone)(u)}reset(){this.modes=(0,o.clone)(c),this.decPrivateModes=(0,o.clone)(u)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;const r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};t.CoreService=d=n([i(0,l.IBufferService),i(1,l.ILogService),i(2,l.IOptionsService)],d)},9074:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const n=r(8055),i=r(8460),o=r(844),a=r(6106);let s=0,l=0;class c extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new a.SortedList(e=>null==e?void 0:e.marker.line),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)(()=>this.reset()))}registerDecoration(e){if(e.marker.isDisposed)return;const t=new u(e);if(t){const e=t.marker.onDispose(()=>t.dispose());t.onDispose(()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())}),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){var n,i,o;let a=0,s=0;for(const l of this._decorations.getKeyIterator(t))a=null!==(n=l.options.x)&&void 0!==n?n:0,s=a+(null!==(i=l.options.width)&&void 0!==i?i:1),e>=a&&e<s&&(!r||(null!==(o=l.options.layer)&&void 0!==o?o:"bottom")===r)&&(yield l)}forEachDecorationAtCell(e,t,r,n){this._decorations.forEachByKey(t,t=>{var i,o,a;s=null!==(i=t.options.x)&&void 0!==i?i:0,l=s+(null!==(o=t.options.width)&&void 0!==o?o:1),e>=s&&e<l&&(!r||(null!==(a=t.options.layer)&&void 0!==a?a:"bottom")===r)&&n(t)})}}t.DecorationService=c;class u extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=n.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=n.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new i.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new i.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const n=r(2585),i=r(8343);class o{constructor(...e){this._entries=new Map;for(const[t,r]of e)this.set(t,r)}set(e,t){const r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(const[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=o,t.InstantiationService=class{constructor(){this._services=new o,this._services.set(n.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){const r=(0,i.getServiceDependencies)(e).sort((e,t)=>e.index-t.index),n=[];for(const i of r){const t=this._services.get(i.id);if(!t)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${i.id}.`);n.push(t)}const o=r.length>0?r[0].index:t.length;if(t.length!==o)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${t.length} static arguments`);return new e(...[...t,...n])}}},7866:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const o=r(844),a=r(2585),s={trace:a.LogLevelEnum.TRACE,debug:a.LogLevelEnum.DEBUG,info:a.LogLevelEnum.INFO,warn:a.LogLevelEnum.WARN,error:a.LogLevelEnum.ERROR,off:a.LogLevelEnum.OFF};let l,c=t.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=a.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),l=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...r)}trace(e,...t){var r,n;this._logLevel<=a.LogLevelEnum.TRACE&&this._log(null!==(n=null===(r=this._optionsService.options.logger)||void 0===r?void 0:r.trace.bind(this._optionsService.options.logger))&&void 0!==n?n:console.log,e,t)}debug(e,...t){var r,n;this._logLevel<=a.LogLevelEnum.DEBUG&&this._log(null!==(n=null===(r=this._optionsService.options.logger)||void 0===r?void 0:r.debug.bind(this._optionsService.options.logger))&&void 0!==n?n:console.log,e,t)}info(e,...t){var r,n;this._logLevel<=a.LogLevelEnum.INFO&&this._log(null!==(n=null===(r=this._optionsService.options.logger)||void 0===r?void 0:r.info.bind(this._optionsService.options.logger))&&void 0!==n?n:console.info,e,t)}warn(e,...t){var r,n;this._logLevel<=a.LogLevelEnum.WARN&&this._log(null!==(n=null===(r=this._optionsService.options.logger)||void 0===r?void 0:r.warn.bind(this._optionsService.options.logger))&&void 0!==n?n:console.warn,e,t)}error(e,...t){var r,n;this._logLevel<=a.LogLevelEnum.ERROR&&this._log(null!==(n=null===(r=this._optionsService.options.logger)||void 0===r?void 0:r.error.bind(this._optionsService.options.logger))&&void 0!==n?n:console.error,e,t)}};t.LogService=c=n([i(0,a.IOptionsService)],c),t.setTraceLogger=function(e){l=e},t.traceCall=function(e,t,r){if("function"!=typeof r.value)throw new Error("not supported");const n=r.value;r.value=function(...e){if(l.logLevel!==a.LogLevelEnum.TRACE)return n.apply(this,e);l.trace(`GlyphRenderer#${n.name}(${e.map(e=>JSON.stringify(e)).join(", ")})`);const t=n.apply(this,e);return l.trace(`GlyphRenderer#${n.name} return`,t),t}}},7302:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const n=r(8460),i=r(844),o=r(6114);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:o.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const a=["normal","bold","100","200","300","400","500","600","700","800","900"];class s extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new n.EventEmitter),this.onOptionChange=this._onOptionChange.event;const r=Object.assign({},t.DEFAULT_OPTIONS);for(const t in e)if(t in r)try{const n=e[t];r[t]=this._sanitizeAndValidateOption(t,n)}catch(i){}this.rawOptions=r,this.options=Object.assign({},r),this._setupOptions()}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{-1!==e.indexOf(r)&&t()})}_setupOptions(){const e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},r=(e,r)=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);r=this._sanitizeAndValidateOption(e,r),this.rawOptions[e]!==r&&(this.rawOptions[e]=r,this._onOptionChange.fire(e))};for(const t in this.rawOptions){const n={get:e.bind(this,t),set:r.bind(this,t)};Object.defineProperty(this.options,t,n)}}_sanitizeAndValidateOption(e,r){switch(e){case"cursorStyle":if(r||(r=t.DEFAULT_OPTIONS[e]),!function(e){return"block"===e||"underline"===e||"bar"===e}(r))throw new Error(`"${r}" is not a valid value for ${e}`);break;case"wordSeparator":r||(r=t.DEFAULT_OPTIONS[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof r&&1<=r&&r<=1e3)break;r=a.includes(r)?r:t.DEFAULT_OPTIONS[e];break;case"cursorWidth":r=Math.floor(r);case"lineHeight":case"tabStopWidth":if(r<1)throw new Error(`${e} cannot be less than 1, value: ${r}`);break;case"minimumContrastRatio":r=Math.max(1,Math.min(21,Math.round(10*r)/10));break;case"scrollback":if((r=Math.min(r,4294967295))<0)throw new Error(`${e} cannot be less than 0, value: ${r}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(r<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${r}`);break;case"rows":case"cols":if(!r&&0!==r)throw new Error(`${e} must be numeric, value: ${r}`);break;case"windowsPty":r=null!=r?r:{}}return r}}t.OptionsService=s},2660:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const o=r(2585);let a=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){const t=this._bufferService.buffer;if(void 0===e.id){const r=t.addMarker(t.ybase+t.y),n={data:e,id:this._nextId++,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(n,r)),this._dataByLinkId.set(n.id,n),n.id}const r=e,n=this._getEntryIdKey(r),i=this._entriesWithId.get(n);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;const o=t.addMarker(t.ybase+t.y),a={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(a,o)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(e,t){const r=this._dataByLinkId.get(e);if(r&&r.lines.every(e=>e.line!==t)){const e=this._bufferService.buffer.addMarker(t);r.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(r,e))}}getLinkData(e){var t;return null===(t=this._dataByLinkId.get(e))||void 0===t?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){const r=e.lines.indexOf(t);-1!==r&&(e.lines.splice(r,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=a=n([i(0,o.IBufferService)],a)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const r="di$target",n="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[n]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);const i=function(e,t,o){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");var a,s,l;a=i,l=o,(s=e)[r]===s?s[n].push({id:a,index:l}):(s[n]=[{id:a,index:l}],s[r]=s)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const n=r(8343);var i,o;t.IBufferService=(0,n.createDecorator)("BufferService"),t.ICoreMouseService=(0,n.createDecorator)("CoreMouseService"),t.ICoreService=(0,n.createDecorator)("CoreService"),t.ICharsetService=(0,n.createDecorator)("CharsetService"),t.IInstantiationService=(0,n.createDecorator)("InstantiationService"),(o=i||(t.LogLevelEnum=i={}))[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.OFF=5]="OFF",t.ILogService=(0,n.createDecorator)("LogService"),t.IOptionsService=(0,n.createDecorator)("OptionsService"),t.IOscLinkService=(0,n.createDecorator)("OscLinkService"),t.IUnicodeService=(0,n.createDecorator)("UnicodeService"),t.IDecorationService=(0,n.createDecorator)("DecorationService")},1480:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const n=r(8460),i=r(225);t.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new n.EventEmitter,this.onChange=this._onChange.event;const e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0;const r=e.length;for(let n=0;n<r;++n){let i=e.charCodeAt(n);if(55296<=i&&i<=56319){if(++n>=r)return t+this.wcwidth(i);const o=e.charCodeAt(n);56320<=o&&o<=57343?i=1024*(i-55296)+o-56320+65536:t+=this.wcwidth(o)}t+=this.wcwidth(i)}return t}}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;const t=r(9042),i=r(3236),o=r(844),a=r(5741),s=r(8285),l=r(7975),c=r(7090),u=["cols","rows"];class d extends o.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new a.AddonManager),this._publicOptions=Object.assign({},this._core.options);const t=e=>this._core.options[e],r=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(const n in this._core.options){const e={get:t.bind(this,n),set:r.bind(this,n)};Object.defineProperty(this._publicOptions,n,e)}}_checkReadonlyOptions(e){if(u.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 l.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new c.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new s.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const e=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(const t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(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){var t,r,n;return this._checkProposedApi(),this._verifyPositiveIntegers(null!==(t=e.x)&&void 0!==t?t:0,null!==(r=e.width)&&void 0!==r?r:0,null!==(n=e.height)&&void 0!==n?n:0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}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\n",t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(const t of e)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(const t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error("This API only accepts positive integers")}}e.Terminal=d})(),n})(),e.exports=r()}(xterm);var xtermExports=xterm.exports,xtermAddonAttach={exports:{}};!function(e,t){self,e.exports=(()=>{var e={};return(()=>{var t=e;function r(e,t,r){return e.addEventListener(t,r),{dispose:()=>{r&&e.removeEventListener(t,r)}}}Object.defineProperty(t,"__esModule",{value:!0}),t.AttachAddon=void 0,t.AttachAddon=class{constructor(e,t){this._disposables=[],this._socket=e,this._socket.binaryType="arraybuffer",this._bidirectional=!(t&&!1===t.bidirectional)}activate(e){this._disposables.push(r(this._socket,"message",t=>{const r=t.data;e.write("string"==typeof r?r:new Uint8Array(r))})),this._bidirectional&&(this._disposables.push(e.onData(e=>this._sendData(e))),this._disposables.push(e.onBinary(e=>this._sendBinary(e)))),this._disposables.push(r(this._socket,"close",()=>this.dispose())),this._disposables.push(r(this._socket,"error",()=>this.dispose()))}dispose(){for(const e of this._disposables)e.dispose()}_sendData(e){this._checkOpenSocket()&&this._socket.send(e)}_sendBinary(e){if(!this._checkOpenSocket())return;const t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);this._socket.send(t)}_checkOpenSocket(){switch(this._socket.readyState){case WebSocket.OPEN:return!0;case WebSocket.CONNECTING:throw new Error("Attach addon was loaded before socket was open");case WebSocket.CLOSING:return!1;case WebSocket.CLOSED:throw new Error("Attach addon socket is closed");default:throw new Error("Unexpected socket state")}}}})(),e})()}(xtermAddonAttach);var xtermAddonAttachExports=xtermAddonAttach.exports,xtermAddonFit={exports:{}};!function(e,t){self,e.exports=(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{constructor(){}activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const 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)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const r=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,n=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(n.getPropertyValue("height")),o=Math.max(0,parseInt(n.getPropertyValue("width"))),a=window.getComputedStyle(this._terminal.element),s=i-(parseInt(a.getPropertyValue("padding-top"))+parseInt(a.getPropertyValue("padding-bottom"))),l=o-(parseInt(a.getPropertyValue("padding-right"))+parseInt(a.getPropertyValue("padding-left")))-r;return{cols:Math.max(2,Math.floor(l/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()}(xtermAddonFit);var xtermAddonFitExports=xtermAddonFit.exports,xtermAddonWebLinks={exports:{}};!function(e,t){self,e.exports=(()=>{var e={6:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(e,t,r,n={}){this._terminal=e,this._regex=t,this._handler=r,this._options=n}provideLinks(e,t){const n=r.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,r)=>{if(this._options.hover){const{range:n}=e;this._options.hover(t,r,n)}},e))}};class r{static computeLink(e,t,n,i){const o=new RegExp(t.source,(t.flags||"")+"g"),[a,s]=r._getWindowedLineStrings(e-1,n),l=a.join("");let c;const u=[];for(;c=o.exec(l);){const e=c[0];try{const t=new URL(e),r=decodeURI(t.toString());if(e!==r&&e+"/"!==r)continue}catch(d){continue}const[t,o]=r._mapStrIdx(n,s,0,c.index),[a,l]=r._mapStrIdx(n,t,o,e.length);if(-1===t||-1===o||-1===a||-1===l)continue;const p={start:{x:o+1,y:t+1},end:{x:l,y:a+1}};u.push({range:p,text:e,activate:i})}return u}static _getWindowedLineStrings(e,t){let r,n=e,i=e,o=0,a="";const s=[];if(r=t.buffer.active.getLine(e)){const e=r.translateToString(!0);if(r.isWrapped&&" "!==e[0]){for(o=0;(r=t.buffer.active.getLine(--n))&&o<2048&&(a=r.translateToString(!0),o+=a.length,s.push(a),r.isWrapped&&-1===a.indexOf(" ")););s.reverse()}for(s.push(e),o=0;(r=t.buffer.active.getLine(++i))&&r.isWrapped&&o<2048&&(a=r.translateToString(!0),o+=a.length,s.push(a),-1===a.indexOf(" ")););}return[s,n]}static _mapStrIdx(e,t,r,n){const i=e.buffer.active,o=i.getNullCell();let a=r;for(;n;){const e=i.getLine(t);if(!e)return[-1,-1];for(let r=a;r<e.length;++r){e.getCell(r,o);const a=o.getChars();if(o.getWidth()&&(n-=a.length||1,r===e.length-1&&""===a)){const e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,o),2===o.getWidth()&&(n+=1))}if(n<0)return[t,r]}t++,a=0}return[t,a]}}t.LinkComputer=r}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.WebLinksAddon=void 0;const t=r(6),i=/https?:[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function o(e,t){const r=window.open();if(r){try{r.opener=null}catch(n){}r.location.href=t}}e.WebLinksAddon=class{constructor(e=o,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;const r=this._options,n=r.urlRegex||i;this._linkProvider=this._terminal.registerLinkProvider(new t.WebLinkProvider(this._terminal,n,this._handler,r))}dispose(){var e;null===(e=this._linkProvider)||void 0===e||e.dispose()}}})(),n})()}(xtermAddonWebLinks);var xtermAddonWebLinksExports=xtermAddonWebLinks.exports,MapShim=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var r=-1;return e.some(function(e,n){return e[0]===t&&(r=n,!0)}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var r=e(this.__entries__,t),n=this.__entries__[r];return n&&n[1]},t.prototype.set=function(t,r){var n=e(this.__entries__,t);~n?this.__entries__[n][1]=r:this.__entries__.push([t,r])},t.prototype.delete=function(t){var r=this.__entries__,n=e(r,t);~n&&r.splice(n,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var r=0,n=this.__entries__;r<n.length;r++){var i=n[r];e.call(t,i[1],i[0])}},t}()}(),isBrowser="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,global$1="undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),requestAnimationFrame$1="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(global$1):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)},trailingTimeout=2;function throttle(e,t){var r=!1,n=!1,i=0;function o(){r&&(r=!1,e()),n&&s()}function a(){requestAnimationFrame$1(o)}function s(){var e=Date.now();if(r){if(e-i<trailingTimeout)return;n=!0}else r=!0,n=!1,setTimeout(a,t);i=e}return s}var REFRESH_DELAY=20,transitionKeys=["top","right","bottom","left","width","height","size","weight"],mutationObserverSupported="undefined"!=typeof MutationObserver,ResizeObserverController=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=throttle(this.refresh.bind(this),REFRESH_DELAY)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,r=t.indexOf(e);~r&&t.splice(r,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter(function(e){return e.gatherActive(),e.hasActive()});return e.forEach(function(e){return e.broadcastActive()}),e.length>0},e.prototype.connect_=function(){isBrowser&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mutationObserverSupported?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){isBrowser&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,r=void 0===t?"":t;transitionKeys.some(function(e){return!!~r.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),defineConfigurable=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];Object.defineProperty(e,i,{value:t[i],enumerable:!1,writable:!1,configurable:!0})}return e},getWindowOf=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||global$1},emptyRect=createRectInit(0,0,0,0);function toFloat(e){return parseFloat(e)||0}function getBordersSize(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce(function(t,r){return t+toFloat(e["border-"+r+"-width"])},0)}function getPaddings(e){for(var t={},r=0,n=["top","right","bottom","left"];r<n.length;r++){var i=n[r],o=e["padding-"+i];t[i]=toFloat(o)}return t}function getSVGContentRect(e){var t=e.getBBox();return createRectInit(0,0,t.width,t.height)}function getHTMLElementContentRect(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return emptyRect;var n=getWindowOf(e).getComputedStyle(e),i=getPaddings(n),o=i.left+i.right,a=i.top+i.bottom,s=toFloat(n.width),l=toFloat(n.height);if("border-box"===n.boxSizing&&(Math.round(s+o)!==t&&(s-=getBordersSize(n,"left","right")+o),Math.round(l+a)!==r&&(l-=getBordersSize(n,"top","bottom")+a)),!isDocumentElement(e)){var c=Math.round(s+o)-t,u=Math.round(l+a)-r;1!==Math.abs(c)&&(s-=c),1!==Math.abs(u)&&(l-=u)}return createRectInit(i.left,i.top,s,l)}var isSVGGraphicsElement="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof getWindowOf(e).SVGGraphicsElement}:function(e){return e instanceof getWindowOf(e).SVGElement&&"function"==typeof e.getBBox};function isDocumentElement(e){return e===getWindowOf(e).document.documentElement}function getContentRect(e){return isBrowser?isSVGGraphicsElement(e)?getSVGContentRect(e):getHTMLElementContentRect(e):emptyRect}function createReadOnlyRect(e){var t=e.x,r=e.y,n=e.width,i=e.height,o="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,a=Object.create(o.prototype);return defineConfigurable(a,{x:t,y:r,width:n,height:i,top:r,right:t+n,bottom:i+r,left:t}),a}function createRectInit(e,t,r,n){return{x:e,y:t,width:r,height:n}}var ResizeObservation=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=createRectInit(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=getContentRect(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),ResizeObserverEntry=function(){return function(e,t){var r=createReadOnlyRect(t);defineConfigurable(this,{target:e,contentRect:r})}}(),ResizeObserverSPI=function(){function e(e,t,r){if(this.activeObservations_=[],this.observations_=new MapShim,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=r}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof getWindowOf(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new ResizeObservation(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof getWindowOf(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(e){return new ResizeObserverEntry(e.target,e.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),observers="undefined"!=typeof WeakMap?new WeakMap:new MapShim,ResizeObserver$1=function(){return function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=ResizeObserverController.getInstance(),n=new ResizeObserverSPI(t,r,this);observers.set(this,n)}}();["observe","unobserve","disconnect"].forEach(function(e){ResizeObserver$1.prototype[e]=function(){var t;return(t=observers.get(this))[e].apply(t,arguments)}});var index=void 0!==global$1.ResizeObserver?global$1.ResizeObserver:ResizeObserver$1;const ANSI_COLORS={reset:"",green:"",yellow:"",gray:"",cyan:""};function parseCommandString(e,t={}){const{preserveEmptyLines:r=!1,includeLineBreaks:n=!1}=t,i=e.split("\n"),o=[];let a="",s=0;for(let l=0;l<i.length;l++){s=l+1;const e=i[l].trim();e?e.startsWith("#!")||(e.startsWith("#")?a+=(a?" ":"")+e:(o.push({raw:e,command:extractCommand(e),comment:a,lineNumber:s,isGitCommand:e.startsWith("git"),hasRedirect:e.includes(">")||e.includes("|")||e.includes("<"),hasArguments:e.includes(" ")}),a="")):r&&n&&o.push({raw:"",command:"",comment:"",lineNumber:s,isGitCommand:!1,hasRedirect:!1,hasArguments:!1})}return o}function extractCommand(e){const t=e.trim();let r=!1,n="";for(let i=0;i<t.length;i++){const e=t[i];if('"'!==e&&"'"!==e||r){if(e===n&&r)r=!1;else if(" "===e&&!r)return t.substring(0,i)}else r=!0,n=e}return t}async function parseAndExecuteCommands(e,t,r={}){const n=parseCommandString(e).filter(e=>{const t=e.raw.trim();return t&&!t.startsWith("#!")});return await executeCommands(n,t,r),n}async function executeCommands(e,t,r={}){const{delay:n=200,showPrompt:i=!0,showComments:o=!0,simulateOutput:a=!0,abortSignal:s,onCommandStart:l,onCommandComplete:c}=r;for(let u=0;u<e.length;u++){const r=e[u];if(null==s?void 0:s.aborted)throw new Error("Command execution aborted");if(!r.raw.trim()||r.raw.trim().startsWith("#"))continue;null==l||l(r,u),o&&r.comment&&(t(`${ANSI_COLORS.gray}${r.comment}${ANSI_COLORS.reset}\r\n`),await sleep(n/2,s));t(`${i?`${ANSI_COLORS.green}$${ANSI_COLORS.reset} `:""}${r.raw}\r\n`),await sleep(n,s),a&&await simulateCommandOutput(r,t,n,s),null==c||c(r,u),u<e.length-1&&await sleep(n/2,s)}i&&t(`\r\n${ANSI_COLORS.green}$${ANSI_COLORS.reset} `)}async function simulateCommandOutput(e,t,r,n){const{raw:i,command:o}=e;"git"===o?await simulateGitCommand(i,t,r,n):"echo"===o?await simulateEchoCommand(i,t,r,n):i.includes("> /dev/null")?(t(`${ANSI_COLORS.gray}(输出已重定向到 /dev/null)${ANSI_COLORS.reset}\r\n`),await sleep(r,n)):await simulateGenericCommand(i,t,r,n)}async function simulateGitCommand(e,t,r,n){if(e.includes("git config user.email"))t(`${ANSI_COLORS.yellow}✓ 已设置用户邮箱${ANSI_COLORS.reset}\r\n`),await sleep(r,n);else if(e.includes("git config user.name"))t(`${ANSI_COLORS.yellow}✓ 已设置用户名${ANSI_COLORS.reset}\r\n`),await sleep(r,n);else if(e.includes("git init"))t(`${ANSI_COLORS.yellow}已初始化空的 Git 仓库于当前目录${ANSI_COLORS.reset}\r\n`),await sleep(r,n);else if(e.includes("git add")){const i=e.match(/git add\s+(.+)/);i&&(t(`${ANSI_COLORS.yellow}添加了文件: ${i[1]}${ANSI_COLORS.reset}\r\n`),await sleep(r,n))}else e.includes("git commit")?await simulateGitCommit(e,t,r,n):e.includes("git log")&&await simulateGitLog(e,t,r,n)}async function simulateGitCommit(e,t,r,n){const i=e.match(/-m\s+["']([^"']+)["']/),o=i?i[1]:"提交",a=Math.random().toString(36).substring(2,9);t(`${ANSI_COLORS.yellow}[main (root-commit) ${a}] ${o}${ANSI_COLORS.reset}\r\n`),t(`${ANSI_COLORS.yellow} 1 file changed, 0 insertions(+), 0 deletions(-)${ANSI_COLORS.reset}\r\n`),t(`${ANSI_COLORS.yellow} create mode 100644 file1.txt${ANSI_COLORS.reset}\r\n`),await sleep(r,n)}async function simulateGitLog(e,t,r,n){const i=Math.random().toString(36).substring(2,9);t(`${ANSI_COLORS.yellow}${i} 初始化提交,添加 file1.txt${ANSI_COLORS.reset}\r\n`),e.includes("--oneline")||(t(`${ANSI_COLORS.yellow}Author: Your Name <you@example.com>${ANSI_COLORS.reset}\r\n`),t(`${ANSI_COLORS.yellow}Date: ${(new Date).toLocaleString()}${ANSI_COLORS.reset}\r\n`),t(`${ANSI_COLORS.yellow}${ANSI_COLORS.reset}\r\n`),t(`${ANSI_COLORS.yellow} 初始化提交,添加 file1.txt${ANSI_COLORS.reset}\r\n`)),await sleep(r,n)}async function simulateEchoCommand(e,t,r,n){if(e.includes(">")){const r=e.match(/>\s*(.+)$/);r&&t(`${ANSI_COLORS.yellow}已创建文件: ${r[1].trim()}${ANSI_COLORS.reset}\r\n`)}else{const r=e.match(/echo\s+["']([^"']+)["']/);r&&t(`${ANSI_COLORS.yellow}${r[1]}${ANSI_COLORS.reset}\r\n`)}await sleep(r,n)}async function simulateGenericCommand(e,t,r,n){const i=["命令执行成功","操作完成","已处理","✓ 完成","执行完毕"],o=i[Math.floor(Math.random()*i.length)];t(`${ANSI_COLORS.cyan}${o}${ANSI_COLORS.reset}\r\n`),await sleep(r,n)}function sleep(e,t){return new Promise((r,n)=>{if(null==t?void 0:t.aborted)return void n(new Error("Sleep aborted"));const i=setTimeout(r,e);if(t){const e=()=>{clearTimeout(i),n(new Error("Sleep aborted"))};t.addEventListener("abort",e,{once:!0})}})}const Xterm=React.forwardRef((e,t)=>{const{id:r,conn:n,path:i,returnMessage:o,runWeb:a,valiateReturn:s,nextReturn:l,initExec:c,containers:u,initCode:d}=e,{shellData:p,podData:h,ptyWsUrl:f}=React.useContext(KnowledgeCardContext),g=React.useRef(null),[m,v]=React.useState(null),[y,b]=React.useState(null),[q,V]=React.useState(null),[S,E]=React.useState(!1),[x,C]=React.useState(""),[w,R]=React.useState(!1),[A,T]=React.useState(!1),[k,N]=React.useState(!1),[P,O]=React.useState(!0),[F,_]=React.useState(""),[D,I]=React.useState(null==u?void 0:u[0]),[U,L]=React.useState(""),[B,W]=React.useState(!1),[M,j]=React.useState(!1),K=React.useRef(null),H=new index(e=>{Array.isArray(e)&&e.length&&(K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{null==q||q.fit()},60))});React.useEffect(()=>{(null==p?void 0:p.defaultShellContainer)&&I(null==p?void 0:p.defaultShellContainer)},[p]);const z=React.useRef(null);React.useEffect(()=>{var e,t;null==(e=z.current)||e.abort(),z.current=new AbortController,y&&m&&!M&&S&&d&&parseAndExecuteCommands(d,e=>{},{delay:200,showPrompt:!1,showComments:!1,simulateOutput:!1,onCommandStart:e=>{null==m||m.send(e.raw+"\r")},abortSignal:null==(t=z.current)?void 0:t.signal}).then(()=>{j(!0)})},[d,y,m,S]);const X=React.useRef(null),G=e=>{const t=new Uint8Array(e).buffer;return(new TextDecoder).decode(t)};React.useEffect(()=>{y&&m&&!k&&y.onKey(e=>{const t=e.key;""!==t?""===t&&y.hasSelection()&&navigator.clipboard.writeText(y.getSelection()):navigator.clipboard.readText().then(e=>{try{null==m||m.send(e)}catch(t){}})})},[y,m,k]);const Z=React.useRef(null);React.useEffect(()=>()=>{clearInterval(Z.current)},[]);const Y=React.useRef(null),Q=React.useRef(null),J=React.useRef(null),$=e=>{"disconnectWebSocket"===e.data.type?null==m||m.close(4999):"connectWebSocket"===e.data.type&&ee()},ee=e=>{if(!x)return;m&&1===(null==m?void 0:m.readyState)&&(null==m||m.close(4999));const t=new WebSocket(x);v(t),N(!1),t.onopen=()=>{var e;w&&F===i&&(null==y||y.write("\r\n")),P||null==y||y.write(""),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{E(!0),O(!0)},100),null==y||y.loadAddon(new xtermAddonAttachExports.AttachAddon(t)),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>{null==q||q.fit()},60),e=t,Z.current=setInterval(()=>{null==e||e.send("#ping#")},3e4)},t.onmessage=e=>{var t,r,n,i;if("#run#"!==G(e.data)&&"#run#"!==e.data||a&&a(x),"string"!=typeof e.data)return;const o=(null==(r=null==(t=null==e?void 0:e.data)?void 0:t.trim())?void 0:r.split("\n"))??(null==(i=null==(n=G(null==e?void 0:e.data))?void 0:n.trim())?void 0:i.split("\n"));1===o.length?"success"==e.data.split("\n")[0].trim()&&s?s(!0):"failure"==e.data.split("\n")[0].trim()&&s&&s(!1):2===o.length?"success"!=e.data.split("\n")[0].trim()&&"success"!=e.data.split("\n")[1].trim()||!s?"failure"!=e.data.split("\n")[0].trim()&&"failure"!=e.data.split("\n")[1].trim()||!s||s(!1):s(!0):3===o.length&&("success"!=e.data.split("\n")[0].trim()&&"success"!=e.data.split("\n")[1].trim()&&"success"!=e.data.split("\n")[2].trim()||!s?"failure"!=e.data.split("\n")[0].trim()&&"failure"!=e.data.split("\n")[1].trim()&&"failure"!=e.data.split("\n")[2].trim()||!s||s(!1):s(!0)),1===o.length?"nextYes"==e.data.split("\n")[0].trim()&&l?l(!0):"nextNo"==e.data.split("\n")[0].trim()&&l&&l(!1):2===o.length?"nextYes"!=e.data.split("\n")[0].trim()&&"nextYes"!=e.data.split("\n")[1].trim()||!l?"nextNo"!=e.data.split("\n")[0].trim()&&"nextNo"!=e.data.split("\n")[1].trim()||!l||l(!1):l(!0):3===o.length&&("nextYes"!=e.data.split("\n")[0].trim()&&"nextYes"!=e.data.split("\n")[1].trim()&&"nextYes"!=e.data.split("\n")[2].trim()||!l?"nextNo"!=e.data.split("\n")[0].trim()&&"nextNo"!=e.data.split("\n")[1].trim()&&"nextNo"!=e.data.split("\n")[2].trim()||!l||l(!1):l(!0))},t.onclose=e=>{C(""),E(!1),clearInterval(Z.current),e.code<3e3?1005===e.code||1011===e.code||4999===e.code||B||(J.current&&clearTimeout(J.current),J.current=setTimeout(()=>{N(!0)},1e3)):o&&o(JSON.parse(e.reason).message)}};React.useEffect(()=>(null==c||c(),window.addEventListener("message",$),()=>{K.current&&clearTimeout(K.current),X.current&&clearTimeout(X.current),Y.current&&clearTimeout(Y.current),Q.current&&clearTimeout(Q.current),J.current&&clearTimeout(J.current),te.current&&clearTimeout(te.current),re.current&&clearTimeout(re.current),ne.current&&clearTimeout(ne.current),ie.current&&clearTimeout(ie.current),oe.current&&clearTimeout(oe.current),ae.current&&clearTimeout(ae.current),le.current&&clearTimeout(le.current),window.removeEventListener("message",$)}),[]);const te=React.useRef(null);React.useEffect(()=>{if(S){T(!1);let e=document.getElementById(r);(null==e?void 0:e.style)&&(e.style.display="block")}else{T(!1);let e=document.getElementById(r);(null==e?void 0:e.style)&&!B&&(e.style.display="none"),te.current&&clearTimeout(te.current),te.current=setTimeout(()=>{T(!0)},5e3)}if(S)U&&m&&(null==m||m.send(U+"\r"),L(""));else{let e;x&&(e=new URL(x)),null==e||e.searchParams.get("tool")}},[S]),React.useEffect(()=>{x&&y&&P&&ee()},[y,x]),React.useEffect(()=>{},[x]);const re=React.useRef(null);React.useEffect(()=>{i&&F!==i&&(null==y||y.write(""),R(!0),re.current&&clearTimeout(re.current),re.current=setTimeout(()=>{_(i)},2e3))},[i]),React.useEffect(()=>{C(n),E(!1)},[n]);const ne=React.useRef(null);React.useEffect(()=>{const e=document.getElementById(r);if(null===y&&e)if(e.innerHTML="",(e=>{const t=new xtermExports.Terminal({cursorStyle:"underline",cursorBlink:!0}),r=new xtermAddonFitExports.FitAddon;t.loadAddon(r),t.loadAddon(new xtermAddonWebLinksExports.WebLinksAddon),t.onResize(()=>{}),t.onLineFeed((e,t)=>{}),t.onData((e,t)=>{}),t.open(e),null==t||t.focus(),X.current&&clearTimeout(X.current),X.current=setTimeout(()=>{r.fit()},60),b(t),V(r)})(e),S){T(!1);let e=document.getElementById(r);(null==e?void 0:e.style)&&(e.style.display="block")}else{T(!1);let e=document.getElementById(r);(null==e?void 0:e.style)&&(e.style.display="none"),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>{T(!0)},5e3)}return g.current&&H.observe(g.current),()=>{H.disconnect()}},[]),React.useEffect(()=>{k&&x&&ee()},[k,x]),React.useEffect(()=>()=>{1===(null==m?void 0:m.readyState)&&(null==m||m.close(4999))},[m]);const ie=React.useRef(null),oe=React.useRef(null);React.useEffect(()=>{const e=e=>{var t,r,n,i,o,a;"reconnent"===(null==(t=null==e?void 0:e.data)?void 0:t.type)&&((null==(n=null==(r=null==e?void 0:e.data)?void 0:r.value)?void 0:n.reCon)?(null==y||y.write(""),ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{var t,r;C(null==(r=null==(t=null==e?void 0:e.data)?void 0:t.value)?void 0:r.url),N(!0)},1e3)):(O(!1),C(""),N(!1),null==m||m.close(4999))),"envinfoHave"===(null==(i=null==e?void 0:e.data)?void 0:i.type)&&(S||((null==(a=null==(o=null==e?void 0:e.data)?void 0:o.value)?void 0:a.reconent)?(N(!0),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{null==y||y.write("")},100)):N(!1)))};if(m&&y)return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[m,x,y,S]);const ae=React.useRef(null);React.useImperativeHandle(t,()=>({changeShellType:e=>{W(e)},execCode:e=>(S?null==m||m.send(e.trim()+"\r"):L(e),!0),changeConn:e=>{m&&e!==x&&(null==m||m.close(4999)),e&&C(e)},reconnent:(e,t)=>{e?(null==y||y.write(""),ae.current&&clearTimeout(ae.current),ae.current=setTimeout(()=>{C(t)},1e3)):(O(!1),C(""),N(!1),null==m||m.close(4999))},sendValiate:(e,t)=>{if(S){let r=t.trim()+" && echo 'success' || echo 'failure'\r",n=t.trim()+" && echo 'nextYes' || echo 'nextNo'\r";1===e?null==m||m.send(n):null==m||m.send(r)}},updateContainer:se}));const se=e=>{I(e);const t=`${f||"wss://pty.cloudlab.top"}/api/terminal?pod=${null==h?void 0:h.pod}&container=${(null==e?void 0:e.container)||""}`;m&&t!==x&&(null==m||m.close(4999)),t&&C(t)},le=React.useRef(null);React.useEffect(()=>{if(!y)return;const e=new MutationObserver(e=>{e.forEach(()=>{le.current&&clearTimeout(le.current),le.current=setTimeout(()=>{null==q||q.fit()},0)})}),t=document.querySelector(".xterm-screen");return t&&e.observe(t,{attributes:!0,childList:!0,subtree:!0}),()=>e.disconnect()},[y,q]);const ce=React.useRef(null);return jsxRuntimeExports.jsxs("div",{className:"xtermContainer",children:[u&&(null==u?void 0:u.length)>0&&jsxRuntimeExports.jsxs("div",{className:"containerMsg",children:[jsxRuntimeExports.jsx(Popover,{placement:"rightBottom",arrow:!1,content:jsxRuntimeExports.jsx(Menu,{rootClassName:"containerMenu",selectedKeys:[],items:u.map(e=>({key:e.container,label:e.container,onClick:()=>{I(e);const t=`${f||"wss://pty.cloudlab.top"}/api/terminal?pod=${null==h?void 0:h.pod}&container=${(null==e?void 0:e.container)||""}`;m&&t!==x&&(null==m||m.close(4999)),t&&C(t)}}))}),children:jsxRuntimeExports.jsx("div",{className:"containerChangeBtn",children:"容器切换"})}),jsxRuntimeExports.jsxs("div",{className:"currentContainer",children:["当前容器:",D.container]})]}),jsxRuntimeExports.jsx("div",{ref:g,id:r,className:"xterms terminal"}),!B&&!S&&jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:"43%",transform:"translate(-50%)",left:"50%",color:"white"},children:jsxRuntimeExports.jsxs("div",{className:"loading",children:[jsxRuntimeExports.jsxs("div",{className:"loading-line",style:{top:"-60px"},children:[jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{})]}),jsxRuntimeExports.jsx("div",{className:"loading-text",children:A?D?jsxRuntimeExports.jsx(Button$1,{onClick:()=>{const e=`${f||"wss://pty.cloudlab.top"}/api/terminal?pod=${null==h?void 0:h.pod}&container=${(null==D?void 0:D.container)||""}`;null==m||m.close(4999),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>{e&&C(e)},1e3)},children:"刷新"}):"环境已重置,建议关闭shell,重新打开~":"环境载入中……"})]})})]})}),ExShell=e=>{const{container:t,initCode:r}=e,{envStatus:n,shellData:i,podData:o}=React.useContext(KnowledgeCardContext),[a,s]=React.useState(!1),l=React.useRef(null);return React.useEffect(()=>{var e;if(n===EnvStatus.Running&&null!==i){if(s(!1),!t)return;const r=i.containers.find(e=>e.name===t);return void(r&&(null==(e=l.current)?void 0:e.updateContainer)&&l.current.updateContainer(r))}""===n?Modal.confirm({title:"温馨提示",content:"该示例需要启动环境,请先启动环境后再使用。",cancelText:"我知道了",okText:"启动环境",centered:!0,width:400,onOk(e){e(),s(!0),window.postMessage({type:"startupEnv"})}}):n===EnvStatus.Startuping?s(!0):i&&s(!1)},[i,n]),i&&o&&n===EnvStatus.Running?jsxRuntimeExports.jsx(Xterm,{ref:l,id:"shellView",conn:i.conn,path:i.path,containers:i.containers,initCode:r}):jsxRuntimeExports.jsx(Spin,{spinning:a,fullscreen:!0,tip:"环境启动中..."})};var ToolType=(e=>(e.Runner="runner",e.Shell="shell",e))(ToolType||{});const ExampleTools=React.memo(e=>{const{tool:t,CodePlayerProps:r,container:n,initCode:i}=e;return React.useMemo(()=>({runner:jsxRuntimeExports.jsx(ExCodePlayer,{codePlayerData:null==r?void 0:r.codePlayerData,codePlayerRef:null==r?void 0:r.codePlayerRef}),shell:jsxRuntimeExports.jsx(ExShell,{container:n,initCode:i})}),[r,n])[t]},(e,t)=>{var r,n;return JSON.stringify(null==(r=e.CodePlayerProps)?void 0:r.codePlayerData)===JSON.stringify(null==(n=t.CodePlayerProps)?void 0:n.codePlayerData)&&e.tool===t.tool&&e.container===t.container}),ExampleCard=React.memo(e=>{const{title:t,code:r,execTool:n,lang:i,content:o,saveCode:a,container:s}=e;return jsxRuntimeExports.jsx("div",{className:"exampleContainer",children:jsxRuntimeExports.jsxs(Card,{className:"card",children:[t&&jsxRuntimeExports.jsx("div",{className:"header",children:jsxRuntimeExports.jsx("div",{className:"titleSection",children:jsxRuntimeExports.jsx("h1",{className:"title",children:t})})}),jsxRuntimeExports.jsx("div",{className:"codeTool",children:jsxRuntimeExports.jsx(ExampleTools,{CodePlayerProps:"runner"!==n&&n?null:{codePlayerData:{lang:i||"python",code:r||"",topic:t||"",content:o||""}},tool:n||ToolType.Runner,container:s,initCode:r||""})})]})})});var __assign=function(){return __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},__assign.apply(this,arguments)};function __spreadArray(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function memoize(e){var t=Object.create(null);return function(r){return void 0===t[r]&&(t[r]=e(r)),t[r]}}"function"==typeof SuppressedError&&SuppressedError;var reactPropsRegex=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,isPropValid=memoize(function(e){return reactPropsRegex.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}),unitlessKeys={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},a="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",c$2="active",u="data-styled-version",l="6.3.6",d$2="/*!sc*/\n",p="undefined"!=typeof window&&"undefined"!=typeof document,h$1=void 0===React.createContext,f=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),y=/invalid hook call/i,v$2=new Set,g=function(e,t){if("production"!==process.env.NODE_ENV){if(h$1)return;var r=t?' with the id of "'.concat(t,'"'):"",n="The component ".concat(e).concat(r," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.\nSee https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.\n",i=console.error;try{var o=!0;console.error=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];y.test(e)?(o=!1,v$2.delete(n)):i.apply(void 0,__spreadArray([e],t,!1))},"function"==typeof React.useState&&React.useState(null),o&&!v$2.has(n)&&v$2.add(n)}catch(e10){y.test(e10.message)&&v$2.delete(n)}finally{console.error=i}}},S=Object.freeze([]),w=Object.freeze({});function b(e,t,r){return void 0===r&&(r=w),e.theme!==r.theme&&e.theme||t||r.theme}var C=new Set(["a","abbr","address","area","article","aside","audio","b","bdi","bdo","blockquote","body","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","slot","small","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tspan","use"]),E=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,N=/(^-|-$)/g;function A(e){return e.replace(E,"-").replace(N,"")}var P=/(a)(d)/gi,_=function(e){return String.fromCharCode(e+(e>25?39:97))};function I(e){var t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=_(t%52)+r;return(_(t%52)+r).replace(P,"$1-$2")}var O,D=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},T=function(e){return D(5381,e)};function x(e){return I(T(e)>>>0)}function R(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function j$2(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var k="function"==typeof Symbol&&Symbol.for,M=k?Symbol.for("react.memo"):60115,V=k?Symbol.for("react.forward_ref"):60112,F={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},L={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},B={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},G=((O={})[V]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},O[M]=B,O);function z(e){return("type"in(t=e)&&t.type.$$typeof)===M?B:"$$typeof"in e?G[e.$$typeof]:F;var t}var $$1=Object.defineProperty,Y=Object.getOwnPropertyNames,W=Object.getOwnPropertySymbols,q$2=Object.getOwnPropertyDescriptor,H=Object.getPrototypeOf,U=Object.prototype;function J(e,t,r){if("string"!=typeof t){if(U){var n=H(t);n&&n!==U&&J(e,n,r)}var i=Y(t);W&&(i=i.concat(W(t)));for(var o=z(e),a=z(t),s=0;s<i.length;++s){var l=i[s];if(!(l in L||r&&r[l]||a&&l in a||o&&l in o)){var c=q$2(t,l);try{$$1(e,l,c)}catch(u){}}}}return e}function X(e){return"function"==typeof e}function Z(e){return"object"==typeof e&&"styledComponentId"in e}function K(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Q(e,t){if(0===e.length)return"";for(var r=e[0],n=1;n<e.length;n++)r+=e[n];return r}function ee(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function te(e,t,r){if(void 0===r&&(r=!1),!r&&!ee(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var n=0;n<t.length;n++)e[n]=te(e[n],t[n]);else if(ee(t))for(var n in t)e[n]=te(e[n],t[n]);return e}function ne(e,t){Object.defineProperty(e,"toString",{value:t})}var oe="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function re(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=e[0],n=[],i=1,o=e.length;i<o;i+=1)n.push(e[i]);return n.forEach(function(e){r=r.replace(/%[a-z]/,e)}),r}function se(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return"production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):"")):new Error(re.apply(void 0,__spreadArray([oe[e]],t,!1)).trim())}var ie=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,r=0;r<e;r++)t+=this.groupSizes[r];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var r=this.groupSizes,n=r.length,i=n;e>=i;)if((i<<=1)<0)throw se(16,"".concat(e));this.groupSizes=new Uint32Array(i),this.groupSizes.set(r),this.length=i;for(var o=n;o<i;o++)this.groupSizes[o]=0}for(var a=this.indexOfGroup(e+1),s=(o=0,t.length);o<s;o++)this.tag.insertRule(a,t[o])&&(this.groupSizes[e]++,a++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],r=this.indexOfGroup(e),n=r+t;this.groupSizes[e]=0;for(var i=r;i<n;i++)this.tag.deleteRule(r)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var r=this.groupSizes[e],n=this.indexOfGroup(e),i=n+r,o=n;o<i;o++)t+="".concat(this.tag.getRule(o)).concat(d$2);return t},e}(),ae=1<<30,ce=new Map,ue=new Map,le=1,de=function(e){if(ce.has(e))return ce.get(e);for(;ue.has(le);)le++;var t=le++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>ae))throw se(16,"".concat(t));return ce.set(e,t),ue.set(t,e),t},pe=function(e,t){le=t+1,ce.set(e,t),ue.set(t,e)},he="style[".concat(a,"][").concat(u,'="').concat(l,'"]'),fe=new RegExp("^".concat(a,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),me=function(e,t,r){for(var n,i=r.split(","),o=0,a=i.length;o<a;o++)(n=i[o])&&e.registerName(t,n)},ye=function(e,t){for(var r,n=(null!==(r=t.textContent)&&void 0!==r?r:"").split(d$2),i=[],o=0,a=n.length;o<a;o++){var s=n[o].trim();if(s){var l=s.match(fe);if(l){var c=0|parseInt(l[1],10),u=l[2];0!==c&&(pe(u,c),me(e,u,l[3]),e.getTag().insertRules(c,i)),i.length=0}else i.push(s)}}},ve=function(e){for(var t=document.querySelectorAll(he),r=0,n=t.length;r<n;r++){var i=t[r];i&&i.getAttribute(a)!==c$2&&(ye(e,i),i.parentNode&&i.parentNode.removeChild(i))}};function ge(){return"undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var Se=function(e){var t,r,n=document.head,i=e||n,o=document.createElement("style"),s=(t=i,(r=Array.from(t.querySelectorAll("style[".concat(a,"]"))))[r.length-1]),c=void 0!==s?s.nextSibling:null;o.setAttribute(a,c$2),o.setAttribute(u,l);var d=ge();return d&&o.setAttribute("nonce",d),i.insertBefore(o,c),o},we=function(){function e(e){this.element=Se(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,r=0,n=t.length;r<n;r++){var i=t[r];if(i.ownerNode===e)return i}throw se(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(r){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),be=function(){function e(e){this.element=Se(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var r=document.createTextNode(t);return this.element.insertBefore(r,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),Ce=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),Ee=p,Ne={isServer:!p,useCSSOMInjection:!f},Ae=function(){function e(e,t,r){void 0===e&&(e=w),void 0===t&&(t={});var n=this;this.options=__assign(__assign({},Ne),e),this.gs=t,this.names=new Map(r),this.server=!!e.isServer,!this.server&&p&&Ee&&(Ee=!1,ve(this)),ne(this,function(){return function(e){for(var t=e.getTag(),r=t.length,n="",i=function(r){var i,o=(i=r,ue.get(i));if(void 0===o)return"continue";var s=e.names.get(o),l=t.getGroup(r);if(void 0===s||!s.size||0===l.length)return"continue";var c="".concat(a,".g").concat(r,'[id="').concat(o,'"]'),u="";void 0!==s&&s.forEach(function(e){e.length>0&&(u+="".concat(e,","))}),n+="".concat(l).concat(c,'{content:"').concat(u,'"}').concat(d$2)},o=0;o<r;o++)i(o);return n}(n)})}return e.registerId=function(e){return de(e)},e.prototype.rehydrate=function(){!this.server&&p&&ve(this)},e.prototype.reconstructWithOptions=function(t,r){return void 0===r&&(r=!0),new e(__assign(__assign({},this.options),t),this.gs,r&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,r=e.target;return e.isServer?new Ce(r):t?new we(r):new be(r)}(this.options),new ie(e)));var e},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(de(e),this.names.has(e))this.names.get(e).add(t);else{var r=new Set;r.add(t),this.names.set(e,r)}},e.prototype.insertRules=function(e,t,r){this.registerName(e,t),this.getTag().insertRules(de(e),r)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(de(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),Pe=/&/g,_e=47;function Ie(e){if(-1===e.indexOf("}"))return!1;for(var t=e.length,r=0,n=0,i=!1,o=0;o<t;o++){var a=e.charCodeAt(o);if(0!==n||i||a!==_e||42!==e.charCodeAt(o+1))if(i)42===a&&e.charCodeAt(o+1)===_e&&(i=!1,o++);else if(34!==a&&39!==a||0!==o&&92===e.charCodeAt(o-1)){if(0===n)if(123===a)r++;else if(125===a&&--r<0)return!0}else 0===n?n=a:n===a&&(n=0);else i=!0,o++}return 0!==r||0!==n}function Oe(e,t){return e.map(function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return"".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=Oe(e.children,t)),e})}function De(e){var t,r,n,i=w,o=i.options,a=void 0===o?w:o,s=i.plugins,l=void 0===s?S:s,c=function(e,n,i){return i.startsWith(r)&&i.endsWith(r)&&i.replaceAll(r,"").length>0?".".concat(t):e},u=l.slice();u.push(function(e){e.type===RULESET&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(Pe,r).replace(n,c))}),a.prefix&&u.push(prefixer),u.push(stringify$7);var d=function(e,i,o,s){void 0===i&&(i=""),void 0===o&&(o=""),void 0===s&&(s="&"),t=s,r=i,n=new RegExp("\\".concat(r,"\\b"),"g");var l=function(e){if(!Ie(e))return e;for(var t=e.length,r="",n=0,i=0,o=0,a=!1,s=0;s<t;s++){var l=e.charCodeAt(s);if(0!==o||a||l!==_e||42!==e.charCodeAt(s+1))if(a)42===l&&e.charCodeAt(s+1)===_e&&(a=!1,s++);else if(34!==l&&39!==l||0!==s&&92===e.charCodeAt(s-1)){if(0===o)if(123===l)i++;else if(125===l){if(--i<0){for(var c=s+1;c<t;){var u=e.charCodeAt(c);if(59===u||10===u)break;c++}c<t&&59===e.charCodeAt(c)&&c++,i=0,s=c-1,n=c;continue}0===i&&(r+=e.substring(n,s+1),n=s+1)}else 59===l&&0===i&&(r+=e.substring(n,s+1),n=s+1)}else 0===o?o=l:o===l&&(o=0);else a=!0,s++}if(n<t){var d=e.substring(n);Ie(d)||(r+=d)}return r}(function(e){if(-1===e.indexOf("//"))return e;for(var t=e.length,r=[],n=0,i=0,o=0,a=0;i<t;){var s=e.charCodeAt(i);if(34!==s&&39!==s||0!==i&&92===e.charCodeAt(i-1))if(0===o)if(40===s&&i>=3&&108==(32|e.charCodeAt(i-1))&&114==(32|e.charCodeAt(i-2))&&117==(32|e.charCodeAt(i-3)))a=1,i++;else if(a>0)41===s?a--:40===s&&a++,i++;else if(s===_e&&i+1<t&&e.charCodeAt(i+1)===_e){for(i>n&&r.push(e.substring(n,i));i<t&&10!==e.charCodeAt(i);)i++;n=i}else i++;else i++;else 0===o?o=s:o===s&&(o=0),i++}return 0===n?e:(n<t&&r.push(e.substring(n)),r.join(""))}(e)),c=compile(o||i?"".concat(o," ").concat(i," { ").concat(l," }"):l);a.namespace&&(c=Oe(c,a.namespace));var d=[];return serialize$1(c,middleware(u.concat(rulesheet(function(e){return d.push(e)})))),d};return d.hash=l.length?l.reduce(function(e,t){return t.name||se(15),D(e,t.name)},5381).toString():"",d}var Te=new Ae,xe=De(),Re={shouldForwardProp:void 0,styleSheet:Te,stylis:xe},je=h$1?{Provider:function(e){return e.children},Consumer:function(e){return(0,e.children)(Re)}}:React.createContext(Re);function Ve(){return!h$1&&React.useContext?React.useContext(je):Re}je.Consumer,h$1||React.createContext(void 0);var Le=function(){function e(e,t){var r=this;this.inject=function(e,t){void 0===t&&(t=xe);var n=r.name+t.hash;e.hasNameForId(r.id,n)||e.insertRules(r.id,n,t(r.rules,n,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,ne(this,function(){throw se(12,String(r.name))})}return e.prototype.getName=function(e){return void 0===e&&(e=xe),this.name+e.hash},e}();function Be(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||e in unitlessKeys||e.startsWith("--")?String(t).trim():"".concat(t,"px")}var Ge=function(e){return e>="A"&&e<="Z"};function ze(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(1===r&&"-"===n&&"-"===e[0])return e;Ge(n)?t+="-"+n.toLowerCase():t+=n}return t.startsWith("ms-")?"-"+t:t}var $e=function(e){return null==e||!1===e||""===e},Ye=function(e){var t=[];for(var r in e){var n=e[r];e.hasOwnProperty(r)&&!$e(n)&&(Array.isArray(n)&&n.isCss||X(n)?t.push("".concat(ze(r),":"),n,";"):ee(n)?t.push.apply(t,__spreadArray(__spreadArray(["".concat(r," {")],Ye(n),!1),["}"],!1)):t.push("".concat(ze(r),": ").concat(Be(r,n),";")))}return t};function We(e,t,r,n){if($e(e))return[];if(Z(e))return[".".concat(e.styledComponentId)];if(X(e)){if(!X(o=e)||o.prototype&&o.prototype.isReactComponent||!t)return[e];var i=e(t);return"production"===process.env.NODE_ENV||"object"!=typeof i||Array.isArray(i)||i instanceof Le||ee(i),We(i,t,r,n)}var o;return e instanceof Le?r?(e.inject(r,n),[e.getName(n)]):[e]:ee(e)?Ye(e):Array.isArray(e)?Array.prototype.concat.apply(S,e.map(function(e){return We(e,t,r,n)})):[e.toString()]}function qe(e){for(var t=0;t<e.length;t+=1){var r=e[t];if(X(r)&&!Z(r))return!1}return!0}var He=T(l),Ue=function(){function e(e,t,r){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===r||r.isStatic)&&qe(e),this.componentId=t,this.baseHash=D(He,t),this.baseStyle=r,Ae.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,r){var n=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,r).className:"";if(this.isStatic&&!r.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))n=K(n,this.staticRulesId);else{var i=Q(We(this.rules,e,t,r)),o=I(D(this.baseHash,i)>>>0);if(!t.hasNameForId(this.componentId,o)){var a=r(i,".".concat(o),void 0,this.componentId);t.insertRules(this.componentId,o,a)}n=K(n,o),this.staticRulesId=o}else{for(var s=D(this.baseHash,r.hash),l="",c=0;c<this.rules.length;c++){var u=this.rules[c];if("string"==typeof u)l+=u,"production"!==process.env.NODE_ENV&&(s=D(s,u));else if(u){var d=Q(We(u,e,t,r));s=D(s,d+c),l+=d}}if(l){var p=I(s>>>0);if(!t.hasNameForId(this.componentId,p)){var h=r(l,".".concat(p),void 0,this.componentId);t.insertRules(this.componentId,p,h)}n=K(n,p)}}return{className:n,css:"undefined"==typeof window?t.getTag().getGroup(de(this.componentId)):""}},e}(),Je=h$1?{Provider:function(e){return e.children},Consumer:function(e){return(0,e.children)(void 0)}}:React.createContext(void 0);Je.Consumer;var Qe={},et=new Set;function tt(e,t,r){var n,i=Z(e),o=e,a=!j$2(e),s=t.attrs,c=void 0===s?S:s,u=t.componentId,d=void 0===u?function(e,t){var r="string"!=typeof e?"sc":A(e);Qe[r]=(Qe[r]||0)+1;var n="".concat(r,"-").concat(x(l+r+Qe[r]));return t?"".concat(t,"-").concat(n):n}(t.displayName,t.parentComponentId):u,p=t.displayName,h=void 0===p?j$2(n=e)?"styled.".concat(n):"Styled(".concat(R(n),")"):p,f=t.displayName&&t.componentId?"".concat(A(t.displayName),"-").concat(t.componentId):t.componentId||d,m=i&&o.attrs?o.attrs.concat(c).filter(Boolean):c,v=t.shouldForwardProp;if(i&&o.shouldForwardProp){var y=o.shouldForwardProp;if(t.shouldForwardProp){var q=t.shouldForwardProp;v=function(e,t){return y(e,t)&&q(e,t)}}else v=y}var V=new Ue(r,f,i?o.componentStyle:void 0);function E(e,t){return function(e,t,r){var n=e.attrs,i=e.componentStyle,o=e.defaultProps,a=e.foldedComponentIds,s=e.styledComponentId,l=e.target,c=React.useContext?React.useContext(Je):void 0,u=Ve(),d=e.shouldForwardProp||u.shouldForwardProp;"production"!==process.env.NODE_ENV&&React.useDebugValue&&React.useDebugValue(s);var p=b(t,c,o)||w,h=function(e,t,r){for(var n,i=__assign(__assign({},t),{className:void 0,theme:r}),o=0;o<e.length;o+=1){var a=X(n=e[o])?n(i):n;for(var s in a)"className"===s?i.className=K(i.className,a[s]):"style"===s?i.style=__assign(__assign({},i.style),a[s]):i[s]=a[s]}return"className"in t&&"string"==typeof t.className&&(i.className=K(i.className,t.className)),i}(n,t,p),f=h.as||l,g={};for(var m in h)void 0===h[m]||"$"===m[0]||"as"===m||"theme"===m&&h.theme===p||("forwardedAs"===m?g.as=h.forwardedAs:d&&!d(m,f)||(g[m]=h[m],d||"development"!==process.env.NODE_ENV||isPropValid(m)||et.has(m)||!C.has(f)||et.add(m)));var v=function(e,t){var r=Ve(),n=e.generateAndInjectStyles(t,r.styleSheet,r.stylis);return"production"!==process.env.NODE_ENV&&React.useDebugValue&&React.useDebugValue(n.className),n}(i,h),y=v.className,q=v.css;"production"!==process.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(y);var V=K(a,s);y&&(V+=" "+y),h.className&&(V+=" "+h.className),g[j$2(f)&&!C.has(f)?"class":"className"]=V,r&&(g.ref=r);var S=React.createElement(f,g);return h$1&&q?React.createElement(React.Fragment,null,React.createElement("style",{precedence:"styled-components",href:"sc-".concat(s,"-").concat(y),children:q}),S):S}(T,e,t)}E.displayName=h;var T=React.forwardRef(E);return T.attrs=m,T.componentStyle=V,T.displayName=h,T.shouldForwardProp=v,T.foldedComponentIds=i?K(o.foldedComponentIds,o.styledComponentId):"",T.styledComponentId=f,T.target=i?o.target:e,Object.defineProperty(T,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=i?function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var n=0,i=t;n<i.length;n++)te(e,i[n],!0);return e}({},o.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(g(h,f),T.warnTooManyClasses=function(e,t){var r={},n=!1;return function(e){if(!n&&(r[e]=!0,Object.keys(r).length>=200)){t&&' with the id of "'.concat(t,'"');n=!0,r={}}}}(0,f)),ne(T,function(){return".".concat(T.styledComponentId)}),a&&J(T,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),T}function nt(e,t){for(var r=[e[0]],n=0,i=t.length;n<i;n+=1)r.push(t[n],e[n+1]);return r}var ot=function(e){return Object.assign(e,{isCss:!0})};function rt(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(X(e)||ee(e))return ot(We(nt(S,__spreadArray([e],t,!0))));var n=e;return 0===t.length&&1===n.length&&"string"==typeof n[0]?We(n):ot(We(nt(n,t)))}function st(e,t,r){if(void 0===r&&(r=w),!t)throw se(1,t);var n=function(n){for(var i=[],o=1;o<arguments.length;o++)i[o-1]=arguments[o];return e(t,r,rt.apply(void 0,__spreadArray([n],i,!1)))};return n.attrs=function(n){return st(e,t,__assign(__assign({},r),{attrs:Array.prototype.concat(r.attrs,n).filter(Boolean)}))},n.withConfig=function(n){return st(e,t,__assign(__assign({},r),n))},n}var it=function(e){return st(tt,e)},at=it;function dt(e){var t=React.forwardRef(function(t,r){var n=b(t,React.useContext?React.useContext(Je):void 0,e.defaultProps);return process.env.NODE_ENV,React.createElement(e,__assign(__assign({},t),{theme:n,ref:r}))});return t.displayName="WithTheme(".concat(R(e),")"),J(t,e)}C.forEach(function(e){at[e]=it(e)}),"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&navigator.product;var ft="__sc-".concat(a,"__");function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _objectSpread$1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(r),!0).forEach(function(t){_defineProperty$1(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$1(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function powerSetPermutations(e){var t=e.length;return 0===t||1===t?e:2===t?[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])]:3===t?[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])]:t>=4?[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]:void 0}"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window[ft]||(window[ft]=0),window[ft],window[ft]+=1);var classNameCombinations={};function getClassNameCombinations(e){if(0===e.length||1===e.length)return e;var t=e.join(".");return classNameCombinations[t]||(classNameCombinations[t]=powerSetPermutations(e)),classNameCombinations[t]}function createStyleObject(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return getClassNameCombinations(e.filter(function(e){return"token"!==e})).reduce(function(e,t){return _objectSpread$1(_objectSpread$1({},e),r[t])},t)}function createClassNameString(e){return e.join(" ")}function createChildren(e,t){var r=0;return function(n){return r+=1,n.map(function(n,i){return createElement({node:n,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(r,"-").concat(i)})})}}function createElement(e){var t=e.node,r=e.stylesheet,n=e.style,i=void 0===n?{}:n,o=e.useInlineStyles,a=e.key,s=t.properties,l=t.type,c=t.tagName,u=t.value;if("text"===l)return u;if(c){var d,p=createChildren(r,o);if(o){var h=Object.keys(r).reduce(function(e,t){return t.split(".").forEach(function(t){e.includes(t)||e.push(t)}),e},[]),f=s.className&&s.className.includes("token")?["token"]:[],g=s.className&&f.concat(s.className.filter(function(e){return!h.includes(e)}));d=_objectSpread$1(_objectSpread$1({},s),{},{className:createClassNameString(g)||void 0,style:createStyleObject(s.className,Object.assign({},s.style,i),r)})}else d=_objectSpread$1(_objectSpread$1({},s),{},{className:createClassNameString(s.className)});var m=p(t.children);return React.createElement(c,_extends$Z({key:a},d),m)}}const checkForListedLanguage=function(e,t){return-1!==e.listLanguages().indexOf(t)};var _excluded=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty$1(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var newLineRegex=/\n/g;function getNewLines(e){return e.match(newLineRegex)}function getAllLineNumbers(e){var t=e.lines,r=e.startingLineNumber,n=e.style;return t.map(function(e,t){var i=t+r;return React.createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"==typeof n?n(i):n},"".concat(i,"\n"))})}function AllLineNumbers(e){var t=e.codeString,r=e.codeStyle,n=e.containerStyle,i=void 0===n?{float:"left",paddingRight:"10px"}:n,o=e.numberStyle,a=void 0===o?{}:o,s=e.startingLineNumber;return React.createElement("code",{style:Object.assign({},r,i)},getAllLineNumbers({lines:t.replace(/\n$/,"").split("\n"),style:a,startingLineNumber:s}))}function getEmWidthOfNumber(e){return"".concat(e.toString().length,".25em")}function getInlineLineNumber(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function assembleLineNumberStyles(e,t,r){var n={display:"inline-block",minWidth:getEmWidthOfNumber(r),paddingRight:"1em",textAlign:"right",userSelect:"none"},i="function"==typeof e?e(t):e;return _objectSpread(_objectSpread({},n),i)}function createLineElement(e){var t=e.children,r=e.lineNumber,n=e.lineNumberStyle,i=e.largestLineNumber,o=e.showInlineLineNumbers,a=e.lineProps,s=void 0===a?{}:a,l=e.className,c=void 0===l?[]:l,u=e.showLineNumbers,d=e.wrapLongLines,p=e.wrapLines,h=void 0!==p&&p?_objectSpread({},"function"==typeof s?s(r):s):{};if(h.className=h.className?[].concat(_toConsumableArray(h.className.trim().split(/\s+/)),_toConsumableArray(c)):c,r&&o){var f=assembleLineNumberStyles(n,r,i);t.unshift(getInlineLineNumber(r,f))}return d&u&&(h.style=_objectSpread({display:"flex"},h.style)),{type:"element",tagName:"span",properties:h,children:t}}function flattenCodeTree(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=0;n<e.length;n++){var i=e[n];if("text"===i.type)r.push(createLineElement({children:[i],className:_toConsumableArray(new Set(t))}));else if(i.children){var o=t.concat(i.properties.className);flattenCodeTree(i.children,o).forEach(function(e){return r.push(e)})}}return r}function processLines(e,t,r,n,i,o,a,s,l){var c,u=flattenCodeTree(e.value),d=[],p=-1,h=0;function f(e,o){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t||c.length>0?function(e,o){return createLineElement({children:e,lineNumber:o,lineNumberStyle:s,largestLineNumber:a,showInlineLineNumbers:i,lineProps:r,className:arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],showLineNumbers:n,wrapLongLines:l,wrapLines:t})}(e,o,c):function(e,t){if(n&&t&&i){var r=assembleLineNumberStyles(s,t,a);e.unshift(getInlineLineNumber(t,r))}return e}(e,o)}for(var g=function(){var e=u[h],t=e.children[0].value;if(getNewLines(t)){var r=t.split("\n");r.forEach(function(t,i){var a=n&&d.length+o,s={type:"text",value:"".concat(t,"\n")};if(0===i){var l=f(u.slice(p+1,h).concat(createLineElement({children:[s],className:e.properties.className})),a);d.push(l)}else if(i===r.length-1){var c=u[h+1]&&u[h+1].children&&u[h+1].children[0],g={type:"text",value:"".concat(t)};if(c){var m=createLineElement({children:[g],className:e.properties.className});u.splice(h+1,0,m)}else{var v=f([g],a,e.properties.className);d.push(v)}}else{var y=f([s],a,e.properties.className);d.push(y)}}),p=h}h++};h<u.length;)g();if(p!==u.length-1){var m=u.slice(p+1,u.length);if(m&&m.length){var v=f(m,n&&d.length+o);d.push(v)}}return t?d:(c=[]).concat.apply(c,d)}function defaultRenderer(e){var t=e.rows,r=e.stylesheet,n=e.useInlineStyles;return t.map(function(e,t){return createElement({node:e,stylesheet:r,useInlineStyles:n,key:"code-segment-".concat(t)})})}function isHighlightJs(e){return e&&void 0!==e.highlightAuto}function getCodeTree(e){var t=e.astGenerator,r=e.language,n=e.code,i=e.defaultCodeValue;if(isHighlightJs(t)){var o=checkForListedLanguage(t,r);return"text"===r?{value:i,language:"text"}:o?t.highlight(r,n):t.highlightAuto(n)}try{return r&&"text"!==r?{value:t.highlight(n,r)}:{value:i}}catch(e10){return{value:i}}}function highlight$1(e,t){return function(r){var n,i,o=r.language,a=r.children,s=r.style,l=void 0===s?t:s,c=r.customStyle,u=void 0===c?{}:c,d=r.codeTagProps,p=void 0===d?{className:o?"language-".concat(o):void 0,style:_objectSpread(_objectSpread({},l['code[class*="language-"]']),l['code[class*="language-'.concat(o,'"]')])}:d,h=r.useInlineStyles,f=void 0===h||h,g=r.showLineNumbers,m=void 0!==g&&g,v=r.showInlineLineNumbers,y=void 0===v||v,b=r.startingLineNumber,q=void 0===b?1:b,V=r.lineNumberContainerStyle,S=r.lineNumberStyle,E=void 0===S?{}:S,x=r.wrapLines,C=r.wrapLongLines,w=void 0!==C&&C,R=r.lineProps,A=void 0===R?{}:R,T=r.renderer,k=r.PreTag,N=void 0===k?"pre":k,P=r.CodeTag,O=void 0===P?"code":P,F=r.code,_=void 0===F?(Array.isArray(a)?a[0]:a)||"":F,D=r.astGenerator,I=_objectWithoutProperties(r,_excluded);D=D||e;var U=m?React.createElement(AllLineNumbers,{containerStyle:V,codeStyle:p.style||{},numberStyle:E,startingLineNumber:q,codeString:_}):null,L=l.hljs||l['pre[class*="language-"]']||{backgroundColor:"#fff"},B=isHighlightJs(D)?"hljs":"prismjs",W=f?Object.assign({},I,{style:Object.assign({},L,u)}):Object.assign({},I,{className:I.className?"".concat(B," ").concat(I.className):B,style:Object.assign({},u)});if(p.style=_objectSpread(w?{whiteSpace:"pre-wrap"}:{whiteSpace:"pre"},p.style),!D)return React.createElement(N,W,U,React.createElement(O,p,_));(void 0===x&&T||w)&&(x=!0),T=T||defaultRenderer;var M=[{type:"text",value:_}],j=getCodeTree({astGenerator:D,language:o,code:_,defaultCodeValue:M});null===j.language&&(j.value=M);var K=processLines(j,x,A,m,y,q,q+(null!==(n=null===(i=_.match(/\n/g))||void 0===i?void 0:i.length)&&void 0!==n?n:0),E,w);return React.createElement(N,W,React.createElement(O,p,!y&&U,T({rows:K,stylesheet:l,useInlineStyles:f})))}}function asyncGeneratorStep(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(c){return void r(c)}s.done?t(l):Promise.resolve(l).then(n,i)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){asyncGeneratorStep(o,n,i,a,s,"next",e)}function s(e){asyncGeneratorStep(o,n,i,a,s,"throw",e)}a(void 0)})}}function _regeneratorRuntime$1(){
228
+ */!function(e){!function(){var t={}.hasOwnProperty;function r(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=i(e,n(r)))}return e}function n(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var n="";for(var o in e)t.call(e,o)&&e[o]&&(n=i(n,o));return n}function i(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):window.classNames=r}()}(classnames);var classnamesExports=classnames.exports;const classNames=getDefaultExportFromCjs(classnamesExports),Show=e=>{const{height:t="300px",value:r,maskTip:n=!1,maskClick:i}=e,o=React.useRef(null),a=React.useRef(null);React.useEffect(()=>(o.current&&l(o.current),()=>{var e;null==(e=a.current)||e.dispose()}),[]);const s=React.useRef(null);React.useEffect(()=>{var e,t;return(null==r?void 0:r.cells)&&(null==(e=a.current)||e.fromJSON(r.cells),null==(t=a.current)||t.centerContent(),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{var e;null==(e=a.current)||e.zoomToFit({maxScale:1,padding:20})},500)),()=>{s.current&&clearTimeout(s.current)}},[r]);const l=e=>{a.current=new Graph({container:e,autoResize:!0,background:{color:"#ffffff"},grid:{visible:!0,size:10,type:"dot",args:{color:"#a0a0a0",thickness:1}},panning:{enabled:!0,modifiers:["ctrl","meta"]},mousewheel:{enabled:!0,zoomAtMousePosition:!0,modifiers:["ctrl","meta"],minScale:.5,maxScale:3},interacting:!1})};return jsxRuntimeExports.jsxs("div",{className:classNames("drawx6","drawx6-show"),style:{height:t},children:[jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%"},children:jsxRuntimeExports.jsx("div",{ref:o,className:"drawx6-container"})}),!!n&&jsxRuntimeExports.jsx("div",{className:"drawx6-show-mask",onClick:i,children:"string"==typeof n&&jsxRuntimeExports.jsxs("div",{className:"drawx6-center drawx6-show-mask-tip",children:[n,jsxRuntimeExports.jsxs("svg",{width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{d:"M2.00477 7.0309L2.00977 7.0949L2.02377 7.2249C2.12977 7.9959 2.61077 8.2449 4.92477 8.9539L6.42377 9.4079L6.59977 9.4679C6.6472 9.48276 6.69282 9.50289 6.73577 9.5279L6.75177 9.5419L6.77077 9.5659C6.79377 9.6029 6.82377 9.6759 6.87377 9.8329L6.96077 10.1149L7.39277 11.5389L7.55677 12.0599C8.12777 13.8389 8.39877 14.1999 9.13677 14.2799L9.19777 14.2849C10.1658 14.3669 10.4048 13.9549 11.3768 11.2969L13.4548 5.5859L13.6278 5.0929C14.1158 3.6729 14.1238 3.2479 13.6518 2.7489L13.5998 2.6949C13.0028 2.0989 12.5648 2.1669 10.5338 2.9019L4.64877 5.0459L3.98577 5.2959C2.27677 5.9549 1.95477 6.2519 2.00477 7.0309ZM5.11877 6.1719L11.0628 4.0079C12.3268 3.5549 12.6708 3.4909 12.7368 3.5569L12.7488 3.5769L12.7568 3.6069C12.7768 3.7509 12.6618 4.1899 12.2348 5.3749L10.1218 11.1749L9.86377 11.8509C9.49577 12.7919 9.33777 13.0729 9.30177 13.0709L9.28477 13.0509L9.25677 13.0109C9.19758 12.9171 9.14511 12.8192 9.09977 12.7179L9.01777 12.5329L8.96177 12.3959C8.81703 12.0073 8.68595 11.6137 8.56877 11.2159L8.08877 9.6349C7.92877 9.1119 7.83877 8.9049 7.61377 8.6799C7.58752 8.65373 7.56016 8.62871 7.53177 8.6049L7.43677 8.5299C7.28077 8.4159 7.12077 8.3499 6.76877 8.2399L4.72477 7.6159L4.34077 7.4909C4.133 7.42316 3.92815 7.34676 3.72677 7.2619L3.65577 7.2319C3.31577 7.0799 3.22377 6.9949 3.22377 6.9919L3.22877 6.9809L3.24777 6.9639C3.35177 6.8809 3.83277 6.6509 5.11977 6.1719H5.11877Z"}),jsxRuntimeExports.jsx("path",{d:"M7.24609 9.07483L9.69727 6.8866",strokeLinecap:"round"})]})]})})]})},content$4=".x6-widget-dnd {\n position: absolute;\n top: -10000px;\n left: -10000px;\n z-index: 999999;\n display: none;\n cursor: move;\n opacity: 0.7;\n pointer-events: 'cursor';\n}\n.x6-widget-dnd.dragging {\n display: inline-block;\n}\n.x6-widget-dnd.dragging * {\n pointer-events: none !important;\n}\n.x6-widget-dnd .x6-graph {\n background: transparent;\n box-shadow: none;\n}\n";var __decorate$b=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Dnd2;class Dnd extends View{get targetScroller(){return this.options.target.getPlugin("scroller")}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}get snapline(){return this.options.target.getPlugin("snapline")}constructor(e){super(),this.name="dnd",this.options=Object.assign(Object.assign({},Dnd.defaults),e),this.init()}init(){ensure(this.name,content$4),this.container=document.createElement("div"),addClass(this.container,this.prefixClassName("widget-dnd")),this.draggingGraph=new Graph(Object.assign(Object.assign({},this.options.delegateGraphOptions),{container:document.createElement("div"),width:1,height:1,async:!1})),append(this.container,this.draggingGraph.container)}start(e,t){const r=t;r.preventDefault(),this.targetModel.startBatch("dnd"),addClass(this.container,"dragging"),appendTo(this.container,this.options.draggingContainer||document.body),this.sourceNode=e,this.prepareDragging(e,r.clientX,r.clientY);const n=this.updateNodePosition(r.clientX,r.clientY);this.isSnaplineEnabled()&&(this.snapline.captureCursorOffset({e:r,node:e,cell:e,view:this.draggingView,x:n.x,y:n.y}),this.draggingNode.on("change:position",this.snap,this)),this.delegateDocumentEvents(Dnd.documentEvents,r.data)}isSnaplineEnabled(){return this.snapline&&this.snapline.isEnabled()}prepareDragging(e,t,r){const n=this.draggingGraph,i=n.model,o=this.options.getDragNode(e,{sourceNode:e,draggingGraph:n,targetGraph:this.targetGraph});o.position(0,0);let a=5;if(this.isSnaplineEnabled()&&(a+=this.snapline.options.tolerance||0),this.isSnaplineEnabled()||this.options.scaled){const e=this.targetGraph.transform.getScale();n.scale(e.sx,e.sy),a*=Math.max(e.sx,e.sy)}else n.scale(1,1);this.clearDragging(),i.resetCells([o]);const s=n.findViewByCell(o);s.undelegateEvents(),s.cell.off("changed"),n.fitToContent({padding:a,allowNewOrigin:"any",useCellGeometry:!1});const l=s.getBBox();this.geometryBBox=s.getBBox({useCellGeometry:!0}),this.delta=this.geometryBBox.getTopLeft().diff(l.getTopLeft()),this.draggingNode=o,this.draggingView=s,this.draggingBBox=o.getBBox(),this.padding=a,this.originOffset=this.updateGraphPosition(t,r)}updateGraphPosition(e,t){const r=document.body.scrollTop||document.documentElement.scrollTop,n=document.body.scrollLeft||document.documentElement.scrollLeft,i=this.delta,o=this.geometryBBox,a=this.padding||5,s={left:e-i.x-o.width/2-a+n,top:t-i.y-o.height/2-a+r};return this.draggingGraph&&css$3(this.container,{left:`${s.left}px`,top:`${s.top}px`}),s}updateNodePosition(e,t){const r=this.targetGraph.clientToLocal(e,t),n=this.draggingBBox;return r.x-=n.width/2,r.y-=n.height/2,this.draggingNode.position(r.x,r.y),r}snap({cell:e,current:t,options:r}){const n=e;if(r.snapped){const e=this.draggingBBox;n.position(e.x+r.tx,e.y+r.ty,{silent:!0}),this.draggingView.translate(),n.position(t.x,t.y,{silent:!0}),this.snapOffset={x:r.tx,y:r.ty}}else this.snapOffset=null}onDragging(e){const t=this.draggingView;if(t){e.preventDefault();const r=this.normalizeEvent(e),n=r.clientX,i=r.clientY;this.updateGraphPosition(n,i);const o=this.updateNodePosition(n,i),a=this.targetGraph.options.embedding.enabled,s=(a||this.isSnaplineEnabled())&&this.isInsideValidArea({x:n,y:i});if(a){t.setEventData(r,{graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView});const e=t.getEventData(r);s?t.processEmbedding(r,e):t.clearEmbedding(e),this.candidateEmbedView=e.candidateEmbedView}this.isSnaplineEnabled()&&(s?this.snapline.snapOnMoving({e:r,view:t,x:o.x,y:o.y}):this.snapline.hide())}}onDragEnd(e){const t=this.draggingNode;if(t){const r=this.normalizeEvent(e),n=this.draggingView,i=this.draggingBBox,o=this.snapOffset;let a=i.x,s=i.y;o&&(a+=o.x,s+=o.y),t.position(a,s,{silent:!0});const l=this.drop(t,{x:r.clientX,y:r.clientY}),c=e=>{e?(this.onDropped(t),this.targetGraph.options.embedding.enabled&&n&&(n.setEventData(r,{cell:e,graph:this.targetGraph,candidateEmbedView:this.candidateEmbedView}),n.finalizeEmbedding(r,n.getEventData(r)))):this.onDropInvalid(),this.candidateEmbedView=null,this.targetModel.stopBatch("dnd")};isAsync(l)?(this.undelegateDocumentEvents(),l.then(c)):c(l)}}clearDragging(){this.draggingNode&&(this.sourceNode=null,this.draggingNode.remove(),this.draggingNode=null,this.draggingView=null,this.delta=null,this.padding=null,this.snapOffset=null,this.originOffset=null,this.undelegateDocumentEvents())}onDropped(e){this.draggingNode===e&&(this.clearDragging(),removeClass(this.container,"dragging"),remove(this.container))}onDropInvalid(){const e=this.draggingNode;e&&this.onDropped(e)}isInsideValidArea(e){let t,r=null;const n=this.targetGraph,i=this.targetScroller;this.options.dndContainer&&(r=this.getDropArea(this.options.dndContainer));const o=r&&r.containsPoint(e);if(i)if(i.options.autoResize)t=this.getDropArea(i.container);else{const e=this.getDropArea(i.container);t=this.getDropArea(n.container).intersectsWithRect(e)}else t=this.getDropArea(n.container);return!o&&t&&t.containsPoint(e)}getDropArea(e){const t=offset$1(e),r=document.body.scrollTop||document.documentElement.scrollTop,n=document.body.scrollLeft||document.documentElement.scrollLeft;return Rectangle.create({x:t.left+parseInt(css$3(e,"border-left-width"),10)-n,y:t.top+parseInt(css$3(e,"border-top-width"),10)-r,width:e.clientWidth,height:e.clientHeight})}drop(e,t){if(this.isInsideValidArea(t)){const r=this.targetGraph,n=r.model,i=r.clientToLocal(t),o=this.sourceNode,a=this.options.getDropNode(e,{sourceNode:o,draggingNode:e,targetGraph:this.targetGraph,draggingGraph:this.draggingGraph}),s=a.getBBox();i.x+=s.x-s.width/2,i.y+=s.y-s.height/2;const l=this.snapOffset?1:r.getGridSize();a.position(GeometryUtil.snapToGrid(i.x,l),GeometryUtil.snapToGrid(i.y,l)),a.removeZIndex();const c=this.options.validateNode,u=!c||c(a,{sourceNode:o,draggingNode:e,droppingNode:a,targetGraph:r,draggingGraph:this.draggingGraph});return"boolean"==typeof u?u?(n.addCell(a,{stencil:this.cid}),a):null:toDeferredBoolean(u).then(e=>e?(n.addCell(a,{stencil:this.cid}),a):null)}return null}onRemove(){this.draggingGraph&&(this.draggingGraph.view.remove(),this.draggingGraph.dispose())}dispose(){this.remove(),clean(this.name)}}__decorate$b([View.dispose()],Dnd.prototype,"dispose",null),Dnd2=Dnd||(Dnd={}),Dnd2.defaults={getDragNode:e=>e.clone(),getDropNode:e=>e.clone()},Dnd2.documentEvents={mousemove:"onDragging",touchmove:"onDragging",mouseup:"onDragEnd",touchend:"onDragEnd",touchcancel:"onDragEnd"},Graph.prototype.toSVG=function(e,t){const r=this.getPlugin("export");r&&r.toSVG(e,t)},Graph.prototype.toPNG=function(e,t){const r=this.getPlugin("export");r&&r.toPNG(e,t)},Graph.prototype.toJPEG=function(e,t){const r=this.getPlugin("export");r&&r.toJPEG(e,t)},Graph.prototype.exportPNG=function(e,t){const r=this.getPlugin("export");r&&r.exportPNG(e,t)},Graph.prototype.exportJPEG=function(e,t){const r=this.getPlugin("export");r&&r.exportJPEG(e,t)},Graph.prototype.exportSVG=function(e,t){const r=this.getPlugin("export");r&&r.exportSVG(e,t)};var __decorate$a=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class Export extends Basecoat{constructor(){super(),this.name="export"}get view(){return this.graph.view}init(e){this.graph=e}exportPNG(e="chart",t={}){this.toPNG(t=>{DataUri.downloadDataUri(t,e)},t)}exportJPEG(e="chart",t={}){this.toPNG(t=>{DataUri.downloadDataUri(t,e)},t)}exportSVG(e="chart",t={}){this.toSVG(t=>{DataUri.downloadDataUri(DataUri.svgToDataUrl(t),e)},t)}toSVG(e,t={}){this.notify("before:export",t);const r=this.view.svg,n=Vector.create(r).clone();let i=n.node;const o=n.findOne(`.${this.view.prefixClassName("graph-svg-stage")}`),a=t.viewBox||this.graph.graphToLocal(this.graph.getContentBBox()),s=t.preserveDimensions;if(s){const e="boolean"==typeof s?a:s;n.attr({width:e.width,height:e.height})}if(n.removeAttribute("style").attr("viewBox",[a.x,a.y,a.width,a.height].join(" ")),o.removeAttribute("transform"),!1!==t.copyStyles){const e=r.ownerDocument,t=Array.from(r.querySelectorAll("*")),n=Array.from(i.querySelectorAll("*")),o=e.styleSheets.length,a=[];for(let r=o-1;r>=0;r-=1)a[r]=e.styleSheets[r],e.styleSheets[r].disabled=!0;const s={};t.forEach((e,t)=>{const r=window.getComputedStyle(e,null),n={};Object.keys(r).forEach(e=>{n[e]=r.getPropertyValue(e)}),s[t]=n}),o!==e.styleSheets.length&&a.forEach((t,r)=>{e.styleSheets[r]=t});for(let r=0;r<o;r+=1)e.styleSheets[r].disabled=!1;const l={};t.forEach((e,t)=>{const r=window.getComputedStyle(e,null),n=s[t],i={};Object.keys(r).forEach(e=>{isNumber(e)||r.getPropertyValue(e)===n[e]||(i[e]=r.getPropertyValue(e))}),l[t]=i}),n.forEach((e,t)=>{css$3(e,l[t])})}const l=t.stylesheet;if("string"==typeof l){const e=r.ownerDocument.implementation.createDocument(null,"xml",null).createCDATASection(l);n.prepend(Vector.create("style",{type:"text/css"},[e]))}const c=()=>{const r=t.beforeSerialize;if("function"==typeof r){const e=call$1(r,this.graph,i);e instanceof SVGSVGElement&&(i=e)}const n=(new XMLSerializer).serializeToString(i).replace(/&nbsp;/g," ");this.notify("after:export",t),e(n)};if(t.serializeImages){const e=n.find("image").map(e=>new Promise(t=>{const r=e.attr("xlink:href")||e.attr("href");DataUri.imageToDataUri(r,(r,n)=>{!r&&n&&e.attr("xlink:href",n),t()})}));Promise.all(e).then(c)}else c()}toDataURL(e,t){let r=t.viewBox||this.graph.getContentBBox();const n=normalizeSides(t.padding);t.width&&t.height&&(n.left+n.right>=t.width&&(n.left=n.right=0),n.top+n.bottom>=t.height&&(n.top=n.bottom=0));const i=new Rectangle(-n.left,-n.top,n.left+n.right,n.top+n.bottom);if(t.width&&t.height){const e=r.width+n.left+n.right,o=r.height+n.top+n.bottom;i.scale(e/t.width,o/t.height)}r=Rectangle.create(r).moveAndExpand(i);const o="number"==typeof t.width&&"number"==typeof t.height?{width:t.width,height:t.height}:r;let a=t.ratio?parseFloat(t.ratio):1;Number.isFinite(a)&&0!==a||(a=1);const s={width:Math.max(Math.round(o.width*a),1),height:Math.max(Math.round(o.height*a),1)};{const e=document.createElement("canvas"),t=e.getContext("2d");e.width=s.width,e.height=s.height;const r=s.width-1,n=s.height-1;t.fillStyle="rgb(1,1,1)",t.fillRect(r,n,1,1);const i=t.getImageData(r,n,1,1).data;if(1!==i[0]||1!==i[1]||1!==i[2])throw new Error("size exceeded")}const l=new Image;l.onload=()=>{const r=document.createElement("canvas");r.width=s.width,r.height=s.height;const n=r.getContext("2d");n.fillStyle=t.backgroundColor||"white",n.fillRect(0,0,s.width,s.height);try{n.drawImage(l,0,0,s.width,s.height);const i=r.toDataURL(t.type,t.quality);e(i)}catch(i){}},this.toSVG(e=>{l.src=`data:image/svg+xml,${encodeURIComponent(e)}`},Object.assign(Object.assign({},t),{viewBox:r,serializeImages:!0,preserveDimensions:Object.assign({},s)}))}toPNG(e,t={}){this.toDataURL(e,Object.assign(Object.assign({},t),{type:"image/png"}))}toJPEG(e,t={}){this.toDataURL(e,Object.assign(Object.assign({},t),{type:"image/jpeg"}))}notify(e,t){this.trigger(e,t),this.graph.trigger(e,t)}dispose(){this.off()}}__decorate$a([Basecoat.dispose()],Export.prototype,"dispose",null);var __decorate$9=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Private$1;class TransformImpl extends View{get model(){return this.graph.model}get view(){return this.graph.renderer.findViewByCell(this.node)}get containerClassName(){return this.prefixClassName("widget-transform")}get resizeClassName(){return`${this.containerClassName}-resize`}get rotateClassName(){return`${this.containerClassName}-rotate`}constructor(e,t,r){super(),this.node=t,this.graph=r,this.options=Object.assign(Object.assign({},Private$1.defaultOptions),e),this.render(),this.startListening()}startListening(){this.delegateEvents({[`mousedown .${this.resizeClassName}`]:"startResizing",[`touchstart .${this.resizeClassName}`]:"startResizing",[`mousedown .${this.rotateClassName}`]:"startRotating",[`touchstart .${this.rotateClassName}`]:"startRotating"}),this.model.on("*",this.update,this),this.graph.on("scale",this.update,this),this.graph.on("translate",this.update,this),this.node.on("removed",this.remove,this),this.model.on("reseted",this.remove,this),this.view.on("cell:knob:mousedown",this.onKnobMouseDown,this),this.view.on("cell:knob:mouseup",this.onKnobMouseUp,this)}stopListening(){this.undelegateEvents(),this.model.off("*",this.update,this),this.graph.off("scale",this.update,this),this.graph.off("translate",this.update,this),this.node.off("removed",this.remove,this),this.model.off("reseted",this.remove,this),this.view.off("cell:knob:mousedown",this.onKnobMouseDown,this),this.view.off("cell:knob:mouseup",this.onKnobMouseUp,this)}renderHandles(){this.container=document.createElement("div");const e=document.createElement("div");attr(e,"draggable","false");const t=e.cloneNode(!0);addClass(t,this.rotateClassName);const r=Private$1.POSITIONS.map(t=>{const r=e.cloneNode(!0);return addClass(r,this.resizeClassName),attr(r,"data-position",t),r});this.empty(),append(this.container,[...r,t])}render(){return this.renderHandles(),this.view&&this.view.addClass(Private$1.NODE_CLS),addClass(this.container,this.containerClassName),toggleClass(this.container,"no-orth-resize",this.options.preserveAspectRatio||!this.options.orthogonalResizing),toggleClass(this.container,"no-resize",!this.options.resizable),toggleClass(this.container,"no-rotate",!this.options.rotatable),this.options.className&&addClass(this.container,this.options.className),this.graph.container.appendChild(this.container),this.update()}update(){const e=this.graph.matrix(),t=this.node.getBBox();t.x*=e.a,t.x+=e.e,t.y*=e.d,t.y+=e.f,t.width*=e.a,t.height*=e.d;const r=Angle.normalize(this.node.getAngle()),n=0!==r?`rotate(${r}deg)`:"";return css$3(this.container,{transform:n,width:t.width,height:t.height,left:t.x,top:t.y}),this.updateResizerDirections(),this}remove(){return this.view&&this.view.removeClass(Private$1.NODE_CLS),super.remove()}onKnobMouseDown(){this.startHandle()}onKnobMouseUp(){this.stopHandle()}updateResizerDirections(){const e=Angle.normalize(this.node.getAngle()),t=Math.floor(e*(Private$1.DIRECTIONS.length/360));if(t!==this.prevShift){const e=Private$1.DIRECTIONS.slice(t).concat(Private$1.DIRECTIONS.slice(0,t)),r=e=>`${this.containerClassName}-cursor-${e}`;this.container.querySelectorAll(`.${this.resizeClassName}`).forEach((t,n)=>{removeClass(t,Private$1.DIRECTIONS.map(e=>r(e)).join(" ")),addClass(t,r(e[n]))}),this.prevShift=t}}getTrueDirection(e){const t=Angle.normalize(this.node.getAngle());let r=Private$1.POSITIONS.indexOf(e);return r+=Math.floor(t*(Private$1.POSITIONS.length/360)),r%=Private$1.POSITIONS.length,Private$1.POSITIONS[r]}toValidResizeDirection(e){return{top:"top-left",bottom:"bottom-right",left:"bottom-left",right:"top-right"}[e]||e}startResizing(e){e.stopPropagation(),this.model.startBatch("resize",{cid:this.cid});const t=attr(e.target,"data-position");this.prepareResizing(e,t),this.startAction(e)}prepareResizing(e,t){const r=this.getTrueDirection(t);let n=0,i=0;t.split("-").forEach(e=>{n={left:-1,right:1}[e]||n,i={top:-1,bottom:1}[e]||i});const o=this.toValidResizeDirection(t),a={"top-right":"bottomLeft","top-left":"bottomRight","bottom-left":"topRight","bottom-right":"topLeft"}[o],s=Angle.normalize(this.node.getAngle());this.setEventData(e,{selector:a,direction:o,trueDirection:r,relativeDirection:t,angle:s,resizeX:n,resizeY:i,action:"resizing"})}startRotating(e){e.stopPropagation(),this.model.startBatch("rotate",{cid:this.cid});const t=this.node.getBBox().getCenter(),r=this.normalizeEvent(e),n=this.graph.snapToGrid(r.clientX,r.clientY);this.setEventData(e,{center:t,action:"rotating",angle:Angle.normalize(this.node.getAngle()),start:Point.create(n).theta(t)}),this.startAction(e)}onMouseMove(e){const t=this.graph.findViewByCell(this.node);let r=this.getEventData(e);if(r.action){const n=this.normalizeEvent(e);let i=n.clientX,o=n.clientY;const a=this.graph.getPlugin("scroller"),s=this.options.restrictedResizing;if(!0===s||"number"==typeof s){const e=!0===s?0:s,t=a?Math.max(e,8):e,r=this.graph.container.getBoundingClientRect();i=clamp(i,r.left+t,r.right-t),o=clamp(o,r.top+t,r.bottom-t)}else this.options.autoScrollOnResizing&&a&&a.autoScroll(i,o);const l=this.graph.snapToGrid(i,o),c=this.graph.getGridSize(),u=this.node,d=this.options;if("resizing"===r.action){r.resized||(t&&(t.addClass("node-resizing"),this.notify("node:resize",e,t)),r.resized=!0);const n=u.getBBox(),i=Point.create(l).rotate(r.angle,n.getCenter()).diff(n[r.selector]);let o=r.resizeX?i.x*r.resizeX:n.width,a=r.resizeY?i.y*r.resizeY:n.height;const s=o,p=a;if(o=GeometryUtil.snapToGrid(o,c),a=GeometryUtil.snapToGrid(a,c),o=Math.max(o,d.minWidth||c),a=Math.max(a,d.minHeight||c),o=Math.min(o,d.maxWidth||1/0),a=Math.min(a,d.maxHeight||1/0),d.preserveAspectRatio){const e=n.width*a/n.height,t=n.height*o/n.width;o<e?a=t:o=e}const h=r.relativeDirection;if(d.allowReverse&&(s<=-o||p<=-a)){let t;"left"===h?s<=-o&&(t="right"):"right"===h?s<=-o&&(t="left"):"top"===h?p<=-a&&(t="bottom"):"bottom"===h?p<=-a&&(t="top"):"top-left"===h?s<=-o&&p<=-a?t="bottom-right":s<=-o?t="top-right":p<=-a&&(t="bottom-left"):"top-right"===h?s<=-o&&p<=-a?t="bottom-left":s<=-o?t="top-left":p<=-a&&(t="bottom-right"):"bottom-left"===h?s<=-o&&p<=-a?t="top-right":s<=-o?t="bottom-right":p<=-a&&(t="top-left"):"bottom-right"===h&&(s<=-o&&p<=-a?t="top-left":s<=-o?t="bottom-left":p<=-a&&(t="top-right"));const r=t;this.stopHandle();const n=this.container.querySelector(`.${this.resizeClassName}[data-position="${r}"]`);this.startHandle(n),this.prepareResizing(e,r),this.onMouseMove(e)}if(n.width!==o||n.height!==a){const n={ui:!0,direction:r.direction,relativeDirection:r.relativeDirection,trueDirection:r.trueDirection,minWidth:d.minWidth,minHeight:d.minHeight,maxWidth:d.maxWidth,maxHeight:d.maxHeight,preserveAspectRatio:!0===d.preserveAspectRatio};u.resize(o,a,n),this.notify("node:resizing",e,t)}}else if("rotating"===r.action){r.rotated||(t&&(t.addClass("node-rotating"),this.notify("node:rotate",e,t)),r.rotated=!0);const n=u.getAngle(),i=r.start-Point.create(l).theta(r.center);let o=r.angle+i;d.rotateGrid&&(o=GeometryUtil.snapToGrid(o,d.rotateGrid)),o=Angle.normalize(o),n!==o&&(u.rotate(o,{absolute:!0}),this.notify("node:rotating",e,t))}}}onMouseUp(e){const t=this.getEventData(e);t.action&&(this.stopAction(e),this.model.stopBatch("resizing"===t.action?"resize":"rotate",{cid:this.cid}))}startHandle(e){if(this.handle=e||null,addClass(this.container,`${this.containerClassName}-active`),e){addClass(e,`${this.containerClassName}-active-handle`);const t=e.getAttribute("data-position");if(t){const e=Private$1.DIRECTIONS[Private$1.POSITIONS.indexOf(t)];addClass(this.container,`${this.containerClassName}-cursor-${e}`)}}}stopHandle(){if(removeClass(this.container,`${this.containerClassName}-active`),this.handle){removeClass(this.handle,`${this.containerClassName}-active-handle`);const e=this.handle.getAttribute("data-position");if(e){const t=Private$1.DIRECTIONS[Private$1.POSITIONS.indexOf(e)];removeClass(this.container,`${this.containerClassName}-cursor-${t}`)}this.handle=null}}startAction(e){this.startHandle(e.target),this.graph.view.undelegateEvents(),this.delegateDocumentEvents(Private$1.documentEvents,e.data)}stopAction(e){this.stopHandle(),this.undelegateDocumentEvents(),this.graph.view.delegateEvents();const t=this.graph.findViewByCell(this.node),r=this.getEventData(e);t&&(t.removeClass(`node-${r.action}`),"resizing"===r.action&&r.resized?this.notify("node:resized",e,t):"rotating"===r.action&&r.rotated&&this.notify("node:rotated",e,t))}notify(e,t,r,n={}){if(r){const i=r.graph,o=i.view.normalizeEvent(t),a=i.snapToGrid(o.clientX,o.clientY);this.trigger(e,Object.assign({e:o,view:r,node:r.cell,cell:r.cell,x:a.x,y:a.y},n))}}dispose(){this.stopListening(),this.remove(),this.off()}}__decorate$9([View.dispose()],TransformImpl.prototype,"dispose",null),function(e){e.NODE_CLS="has-widget-transform",e.DIRECTIONS=["nw","n","ne","e","se","s","sw","w"],e.POSITIONS=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],e.documentEvents={mousemove:"onMouseMove",touchmove:"onMouseMove",mouseup:"onMouseUp",touchend:"onMouseUp"},e.defaultOptions={minWidth:0,minHeight:0,maxWidth:1/0,maxHeight:1/0,rotateGrid:15,rotatable:!0,preserveAspectRatio:!1,orthogonalResizing:!0,restrictedResizing:!1,autoScrollOnResizing:!0,allowReverse:!0}}(Private$1||(Private$1={}));const content$3=".x6-widget-transform {\n position: absolute;\n box-sizing: content-box !important;\n margin: -5px 0 0 -5px;\n padding: 4px;\n border: 1px dashed #000;\n border-radius: 5px;\n user-select: none;\n pointer-events: none;\n}\n.x6-widget-transform > div {\n position: absolute;\n box-sizing: border-box;\n background-color: #fff;\n border: 1px solid #000;\n transition: background-color 0.2s;\n pointer-events: auto;\n -webkit-user-drag: none;\n user-drag: none;\n /* stylelint-disable-line */\n}\n.x6-widget-transform > div:hover {\n background-color: #d3d3d3;\n}\n.x6-widget-transform-cursor-n {\n cursor: n-resize;\n}\n.x6-widget-transform-cursor-s {\n cursor: s-resize;\n}\n.x6-widget-transform-cursor-e {\n cursor: e-resize;\n}\n.x6-widget-transform-cursor-w {\n cursor: w-resize;\n}\n.x6-widget-transform-cursor-ne {\n cursor: ne-resize;\n}\n.x6-widget-transform-cursor-nw {\n cursor: nw-resize;\n}\n.x6-widget-transform-cursor-se {\n cursor: se-resize;\n}\n.x6-widget-transform-cursor-sw {\n cursor: sw-resize;\n}\n.x6-widget-transform-resize {\n width: 10px;\n height: 10px;\n border-radius: 6px;\n}\n.x6-widget-transform-resize[data-position='top-left'] {\n top: -5px;\n left: -5px;\n}\n.x6-widget-transform-resize[data-position='top-right'] {\n top: -5px;\n right: -5px;\n}\n.x6-widget-transform-resize[data-position='bottom-left'] {\n bottom: -5px;\n left: -5px;\n}\n.x6-widget-transform-resize[data-position='bottom-right'] {\n right: -5px;\n bottom: -5px;\n}\n.x6-widget-transform-resize[data-position='top'] {\n top: -5px;\n left: 50%;\n margin-left: -5px;\n}\n.x6-widget-transform-resize[data-position='bottom'] {\n bottom: -5px;\n left: 50%;\n margin-left: -5px;\n}\n.x6-widget-transform-resize[data-position='left'] {\n top: 50%;\n left: -5px;\n margin-top: -5px;\n}\n.x6-widget-transform-resize[data-position='right'] {\n top: 50%;\n right: -5px;\n margin-top: -5px;\n}\n.x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='top'],\n.x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='bottom'],\n.x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='left'],\n.x6-widget-transform.prevent-aspect-ratio .x6-widget-transform-resize[data-position='right'] {\n display: none;\n}\n.x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='bottom'],\n.x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='left'],\n.x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='right'],\n.x6-widget-transform.no-orth-resize .x6-widget-transform-resize[data-position='top'] {\n display: none;\n}\n.x6-widget-transform.no-resize .x6-widget-transform-resize {\n display: none;\n}\n.x6-widget-transform-rotate {\n top: -20px;\n left: -20px;\n width: 12px;\n height: 12px;\n border-radius: 6px;\n cursor: crosshair;\n}\n.x6-widget-transform.no-rotate .x6-widget-transform-rotate {\n display: none;\n}\n.x6-widget-transform-active {\n border-color: transparent;\n pointer-events: all;\n}\n.x6-widget-transform-active > div {\n display: none;\n}\n.x6-widget-transform-active > .x6-widget-transform-active-handle {\n display: block;\n background-color: #808080;\n}\n";Graph.prototype.createTransformWidget=function(e){const t=this.getPlugin("transform");return t&&t.createWidget(e),this},Graph.prototype.clearTransformWidgets=function(){const e=this.getPlugin("transform");return e&&e.clearWidgets(),this};var __decorate$8=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Transform2;class Transform extends Basecoat{constructor(e={}){super(),this.name="transform",this.widgets=new Map,this.disabled=!1,this.options=e,ensure(this.name,content$3)}init(e){this.graph=e,this.disabled||this.startListening()}startListening(){this.graph.on("node:click",this.onNodeClick,this),this.graph.on("blank:mousedown",this.onBlankMouseDown,this)}stopListening(){this.graph.off("node:click",this.onNodeClick,this),this.graph.off("blank:mousedown",this.onBlankMouseDown,this)}enable(){this.disabled&&(this.disabled=!1,this.startListening())}disable(){this.disabled||(this.disabled=!0,this.stopListening())}isEnabled(){return!this.disabled}createWidget(e){this.clearWidgets();const t=this.createTransform(e);t&&(this.widgets.set(e,t),t.on("*",(e,t)=>{this.trigger(e,t),this.graph.trigger(e,t)}))}onNodeClick({node:e}){this.createWidget(e)}onBlankMouseDown(){this.clearWidgets()}createTransform(e){const t=this.getTransformOptions(e);return t.resizable||t.rotatable?new TransformImpl(t,e,this.graph):null}getTransformOptions(e){this.options.resizing||(this.options.resizing={enabled:!1}),this.options.rotating||(this.options.rotating={enabled:!1}),"boolean"==typeof this.options.resizing&&(this.options.resizing={enabled:this.options.resizing}),"boolean"==typeof this.options.rotating&&(this.options.rotating={enabled:this.options.rotating});const t=Transform.parseOptionGroup(this.graph,e,this.options.resizing),r=Transform.parseOptionGroup(this.graph,e,this.options.rotating);return{resizable:!!t.enabled,minWidth:t.minWidth||0,maxWidth:t.maxWidth||Number.MAX_SAFE_INTEGER,minHeight:t.minHeight||0,maxHeight:t.maxHeight||Number.MAX_SAFE_INTEGER,orthogonalResizing:"boolean"!=typeof t.orthogonal||t.orthogonal,restrictedResizing:!!t.restrict,autoScrollOnResizing:"boolean"!=typeof t.autoScroll||t.autoScroll,preserveAspectRatio:!!t.preserveAspectRatio,allowReverse:"boolean"!=typeof t.allowReverse||t.allowReverse,rotatable:!!r.enabled,rotateGrid:r.grid||15}}clearWidgets(){this.widgets.forEach((e,t)=>{this.graph.getCellById(t.id)&&e.dispose()}),this.widgets.clear()}dispose(){this.clearWidgets(),this.stopListening(),this.off(),clean(this.name)}}__decorate$8([Basecoat.dispose()],Transform.prototype,"dispose",null),Transform2=Transform||(Transform={}),Transform2.parseOptionGroup=function(e,t,r){const n={};return Object.keys(r||{}).forEach(i=>{const o=r[i];n[i]="function"==typeof o?o.call(e,t):o}),n};var mousetrap={exports:{}};!function(e){!function(t,r){if(t){for(var n,i={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},o={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},a={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},s={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},l=1;l<20;++l)i[111+l]="f"+l;for(l=0;l<=9;++l)i[l+96]=l.toString();m.prototype.bind=function(e,t,r){var n=this;return e=e instanceof Array?e:[e],n._bindMultiple.call(n,e,t,r),n},m.prototype.unbind=function(e,t){return this.bind.call(this,e,function(){},t)},m.prototype.trigger=function(e,t){var r=this;return r._directMap[e+":"+t]&&r._directMap[e+":"+t]({},e),r},m.prototype.reset=function(){var e=this;return e._callbacks={},e._directMap={},e},m.prototype.stopCallback=function(e,t){if((" "+t.className+" ").indexOf(" mousetrap ")>-1)return!1;if(g(t,this.target))return!1;if("composedPath"in e&&"function"==typeof e.composedPath){var r=e.composedPath()[0];r!==e.target&&(t=r)}return"INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable},m.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},m.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);n=null},m.init=function(){var e=m(r);for(var t in e)"_"!==t.charAt(0)&&(m[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},m.init(),t.Mousetrap=m,e.exports&&(e.exports=m)}function c(e,t,r){e.addEventListener?e.addEventListener(t,r,!1):e.attachEvent("on"+t,r)}function u(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return i[e.which]?i[e.which]:o[e.which]?o[e.which]:String.fromCharCode(e.which).toLowerCase()}function d(e,t){return e.sort().join(",")===t.sort().join(",")}function p(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function h(e,t,r){return r||(r=function(){if(!n)for(var e in n={},i)e>95&&e<112||i.hasOwnProperty(e)&&(n[i[e]]=e);return n}()[e]?"keydown":"keypress"),"keypress"==r&&t.length&&(r="keydown"),r}function f(e,t){var r,n,i,o=[];for(r=function(e){return"+"===e?["+"]:(e=e.replace(/\+{2}/g,"+plus")).split("+")}(e),i=0;i<r.length;++i)n=r[i],s[n]&&(n=s[n]),t&&"keypress"!=t&&a[n]&&(n=a[n],o.push("shift")),p(n)&&o.push(n);return{key:n,modifiers:o,action:t=h(n,o,t)}}function g(e,t){return null!==e&&e!==r&&(e===t||g(e.parentNode,t))}function m(e){var t=this;if(e=e||r,!(t instanceof m))return new m(e);t.target=e,t._callbacks={},t._directMap={};var n,i={},o=!1,a=!1,s=!1;function l(e){e=e||{};var t,r=!1;for(t in i)e[t]?r=!0:i[t]=0;r||(s=!1)}function h(e,r,n,o,a,s){var l,c,u=[],h=n.type;if(!t._callbacks[e])return[];for("keyup"==h&&p(e)&&(r=[e]),l=0;l<t._callbacks[e].length;++l)if(c=t._callbacks[e][l],(o||!c.seq||i[c.seq]==c.level)&&h==c.action&&("keypress"==h&&!n.metaKey&&!n.ctrlKey||d(r,c.modifiers))){var f=!o&&c.combo==a,g=o&&c.seq==o&&c.level==s;(f||g)&&t._callbacks[e].splice(l,1),u.push(c)}return u}function g(e,r,n,i){t.stopCallback(r,r.target||r.srcElement,n,i)||!1===e(r,n)&&(function(e){e.preventDefault?e.preventDefault():e.returnValue=!1}(r),function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}(r))}function v(e){"number"!=typeof e.which&&(e.which=e.keyCode);var r=u(e);r&&("keyup"!=e.type||o!==r?t.handleKey(r,function(e){var t=[];return e.shiftKey&&t.push("shift"),e.altKey&&t.push("alt"),e.ctrlKey&&t.push("ctrl"),e.metaKey&&t.push("meta"),t}(e),e):o=!1)}function y(e,t,r,a){function c(t){return function(){s=t,++i[e],clearTimeout(n),n=setTimeout(l,1e3)}}function d(t){g(r,t,e),"keyup"!==a&&(o=u(t)),setTimeout(l,10)}i[e]=0;for(var p=0;p<t.length;++p){var h=p+1===t.length?d:c(a||f(t[p+1]).action);b(t[p],h,a,e,p)}}function b(e,r,n,i,o){t._directMap[e+":"+n]=r;var a,s=(e=e.replace(/\s+/g," ")).split(" ");s.length>1?y(e,s,r,n):(a=f(e,n),t._callbacks[a.key]=t._callbacks[a.key]||[],h(a.key,a.modifiers,{type:a.action},i,e,o),t._callbacks[a.key][i?"unshift":"push"]({callback:r,modifiers:a.modifiers,action:a.action,seq:i,level:o,combo:e}))}t._handleKey=function(e,t,r){var n,i=h(e,t,r),o={},c=0,u=!1;for(n=0;n<i.length;++n)i[n].seq&&(c=Math.max(c,i[n].level));for(n=0;n<i.length;++n)if(i[n].seq){if(i[n].level!=c)continue;u=!0,o[i[n].seq]=1,g(i[n].callback,r,i[n].combo,i[n].seq)}else u||g(i[n].callback,r,i[n].combo);var d="keypress"==r.type&&a;r.type!=s||p(e)||d||l(o),a=u&&"keydown"==r.type},t._bindMultiple=function(e,t,r){for(var n=0;n<e.length;++n)b(e[n],t,r)},c(e,"keypress",v),c(e,"keydown",v),c(e,"keyup",v)}}("undefined"!=typeof window?window:null,"undefined"!=typeof window?document:null)}(mousetrap);var mousetrapExports=mousetrap.exports;const Mousetrap=getDefaultExportFromCjs(mousetrapExports);var __decorate$7=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},KeyboardImpl2;class KeyboardImpl extends Disposable{get graph(){return this.options.graph}constructor(e){super(),this.options=e;const t=this.graph.getPlugin("scroller");this.container=t?t.container:this.graph.container,e.global?this.target=document:(this.target=this.container,this.disabled||this.target.setAttribute("tabindex","-1"),this.graph.on("cell:mouseup",this.focus,this),this.graph.on("blank:mouseup",this.focus,this)),this.mousetrap=KeyboardImpl.createMousetrap(this)}get disabled(){return!0!==this.options.enabled}enable(){this.disabled&&(this.options.enabled=!0,this.target instanceof HTMLElement&&this.target.setAttribute("tabindex","-1"))}disable(){this.disabled||(this.options.enabled=!1,this.target instanceof HTMLElement&&this.target.removeAttribute("tabindex"))}on(e,t,r){this.mousetrap.bind(this.getKeys(e),t,r)}off(e,t){this.mousetrap.unbind(this.getKeys(e),t)}clear(){this.mousetrap.reset()}trigger(e,t){this.mousetrap.trigger(e,t)}focus(e){if(this.isInputEvent(e.e))return;this.target.focus({preventScroll:!0})}getKeys(e){return(Array.isArray(e)?e:[e]).map(e=>this.formatkey(e))}formatkey(e){const t=e.toLocaleLowerCase().replace(/\s/g,"").replace("delete","del").replace("cmd","command").replace("arrowup","up").replace("arrowright","right").replace("arrowdown","down").replace("arrowleft","left"),r=this.options.format;return r?call$1(r,this.graph,t):t}isGraphEvent(e){const t=e.target,r=e.currentTarget;return!!t&&(t===this.target||r===this.target||t===document.body||contains(this.container,t))}isInputEvent(e){var t;const r=e.target,n=null===(t=null==r?void 0:r.tagName)||void 0===t?void 0:t.toLowerCase();let i=["input","textarea"].includes(n);return"true"===attr(r,"contenteditable")&&(i=!0),i}isEnabledForEvent(e){const t=!this.disabled&&this.isGraphEvent(e),r=this.isInputEvent(e);if(t){if(r&&("Backspace"===e.key||"Delete"===e.key))return!1;if(this.options.guard)return call$1(this.options.guard,this.graph,e)}return t}dispose(){this.mousetrap.reset()}}__decorate$7([Disposable.dispose()],KeyboardImpl.prototype,"dispose",null),KeyboardImpl2=KeyboardImpl||(KeyboardImpl={}),KeyboardImpl2.createMousetrap=function(e){const t=new Mousetrap(e.target),r=t.stopCallback;return t.stopCallback=(n,i,o)=>!e.isEnabledForEvent(n)||!!r&&r.call(t,n,i,o),t},Graph.prototype.isKeyboardEnabled=function(){const e=this.getPlugin("keyboard");return!!e&&e.isEnabled()},Graph.prototype.enableKeyboard=function(){const e=this.getPlugin("keyboard");return e&&e.enable(),this},Graph.prototype.disableKeyboard=function(){const e=this.getPlugin("keyboard");return e&&e.disable(),this},Graph.prototype.toggleKeyboard=function(e){const t=this.getPlugin("keyboard");return t&&t.toggleEnabled(e),this},Graph.prototype.bindKey=function(e,t,r){const n=this.getPlugin("keyboard");return n&&n.bindKey(e,t,r),this},Graph.prototype.unbindKey=function(e,t){const r=this.getPlugin("keyboard");return r&&r.unbindKey(e,t),this},Graph.prototype.clearKeys=function(){const e=this.getPlugin("keyboard");return e&&e.clear(),this},Graph.prototype.triggerKey=function(e,t){const r=this.getPlugin("keyboard");return r&&r.trigger(e,t),this};var __decorate$6=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Storage;class Keyboard extends Disposable{constructor(e={}){super(),this.name="keyboard",this.options=Object.assign({enabled:!0},e)}init(e){this.keyboardImpl=new KeyboardImpl(Object.assign(Object.assign({},this.options),{graph:e}))}isEnabled(){return!this.keyboardImpl.disabled}enable(){this.keyboardImpl.enable()}disable(){this.keyboardImpl.disable()}toggleEnabled(e){return null!=e?e!==this.isEnabled()&&(e?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}bindKey(e,t,r){return this.keyboardImpl.on(e,t,r),this}trigger(e,t){return this.keyboardImpl.trigger(e,t),this}clear(){return this.keyboardImpl.clear(),this}unbindKey(e,t){return this.keyboardImpl.off(e,t),this}dispose(){this.keyboardImpl.dispose()}}__decorate$6([Disposable.dispose()],Keyboard.prototype,"dispose",null);class ClipboardImpl{constructor(){this.cells=[]}copy(e,t,r={}){this.options=Object.assign({},r);const n=(Model.isModel(t)?t:t.model).cloneSubGraph(e,r);this.cells=sortBy(Object.keys(n).map(e=>n[e]),e=>e.isEdge()?2:1),this.serialize(r)}cut(e,t,r={}){this.copy(e,t,r);(Graph.isGraph(t)?t.model:t).batchUpdate("cut",()=>{e.forEach(e=>e.remove())})}paste(e,t={}){const r=Object.assign(Object.assign({},this.options),t),{offset:n,edgeProps:i,nodeProps:o}=r;let a=20,s=20;n&&(a="number"==typeof n?n:n.dx,s="number"==typeof n?n:n.dy),this.deserialize(r);const l=this.cells;l.forEach(e=>{e.model=null,e.removeProp("zIndex"),(a||s)&&e.translate(a,s),o&&e.isNode()&&e.prop(o),i&&e.isEdge()&&e.prop(i)});const c=Graph.isGraph(e)?e.model:e;return c.batchUpdate("paste",()=>{c.addCells(this.cells)}),this.copy(l,e,t),l}serialize(e){!1!==e.useLocalStorage&&Storage.save(this.cells)}deserialize(e){if(e.useLocalStorage){const e=Storage.fetch();e&&(this.cells=e)}}isEmpty(e={}){return e.useLocalStorage&&this.deserialize(e),this.cells.length<=0}clean(){this.options={},this.cells=[],Storage.clean()}}!function(e){const t=`${Config.prefixCls}.clipboard.cells`;e.save=function(e){if(window.localStorage){const r=e.map(e=>e.toJSON());localStorage.setItem(t,JSON.stringify(r))}},e.fetch=function(){if(window.localStorage){const e=localStorage.getItem(t),r=e?JSON.parse(e):[];if(r)return Model.fromJSON(r)}},e.clean=function(){window.localStorage&&localStorage.removeItem(t)}}(Storage||(Storage={})),Graph.prototype.isClipboardEnabled=function(){const e=this.getPlugin("clipboard");return!!e&&e.isEnabled()},Graph.prototype.enableClipboard=function(){const e=this.getPlugin("clipboard");return e&&e.enable(),this},Graph.prototype.disableClipboard=function(){const e=this.getPlugin("clipboard");return e&&e.disable(),this},Graph.prototype.toggleClipboard=function(e){const t=this.getPlugin("clipboard");return t&&t.toggleEnabled(e),this},Graph.prototype.isClipboardEmpty=function(e){const t=this.getPlugin("clipboard");return!t||t.isEmpty(e)},Graph.prototype.getCellsInClipboard=function(){const e=this.getPlugin("clipboard");return e?e.getCellsInClipboard():[]},Graph.prototype.cleanClipboard=function(){const e=this.getPlugin("clipboard");return e&&e.clean(),this},Graph.prototype.copy=function(e,t){const r=this.getPlugin("clipboard");return r&&r.copy(e,t),this},Graph.prototype.cut=function(e,t){const r=this.getPlugin("clipboard");return r&&r.cut(e,t),this},Graph.prototype.paste=function(e,t){const r=this.getPlugin("clipboard");return r?r.paste(e,t):[]};var __decorate$5=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},__rest$1=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};class Clipboard extends Basecoat{get disabled(){return!0!==this.options.enabled}get cells(){return this.clipboardImpl.cells}constructor(e={}){super(),this.name="clipboard",this.options=Object.assign({enabled:!0},e)}init(e){this.graph=e,this.clipboardImpl=new ClipboardImpl,this.clipboardImpl.deserialize(this.options)}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(e){return null!=e?e!==this.isEnabled()&&(e?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}isEmpty(e={}){return this.clipboardImpl.isEmpty(e)}getCellsInClipboard(){return this.cells}clean(e){return this.disabled&&!e||(this.clipboardImpl.clean(),this.notify("clipboard:changed",{cells:[]})),this}copy(e,t={}){return this.disabled||(this.clipboardImpl.copy(e,this.graph,Object.assign(Object.assign({},this.commonOptions),t)),this.notify("clipboard:changed",{cells:e})),this}cut(e,t={}){return this.disabled||(this.clipboardImpl.cut(e,this.graph,Object.assign(Object.assign({},this.commonOptions),t)),this.notify("clipboard:changed",{cells:e})),this}paste(e={},t=this.graph){return this.disabled?[]:this.clipboardImpl.paste(t,Object.assign(Object.assign({},this.commonOptions),e))}get commonOptions(){const e=this.options,{enabled:t}=e;return __rest$1(e,["enabled"])}notify(e,t){this.trigger(e,t),this.graph.trigger(e,t)}dispose(){this.clean(!0),this.off()}}__decorate$5([Basecoat.dispose()],Clipboard.prototype,"dispose",null),Graph.prototype.isHistoryEnabled=function(){const e=this.getPlugin("history");return!!e&&e.isEnabled()},Graph.prototype.enableHistory=function(){const e=this.getPlugin("history");return e&&e.enable(),this},Graph.prototype.disableHistory=function(){const e=this.getPlugin("history");return e&&e.disable(),this},Graph.prototype.toggleHistory=function(e){const t=this.getPlugin("history");return t&&t.toggleEnabled(e),this},Graph.prototype.undo=function(e){const t=this.getPlugin("history");return t&&t.undo(e),this},Graph.prototype.redo=function(e){const t=this.getPlugin("history");return t&&t.redo(e),this},Graph.prototype.undoAndCancel=function(e){const t=this.getPlugin("history");return t&&t.cancel(e),this},Graph.prototype.canUndo=function(){const e=this.getPlugin("history");return!!e&&e.canUndo()},Graph.prototype.canRedo=function(){const e=this.getPlugin("history");return!!e&&e.canRedo()},Graph.prototype.cleanHistory=function(e){const t=this.getPlugin("history");return t&&t.clean(e),this},Graph.prototype.getHistoryStackSize=function(){return this.getPlugin("history").getSize()},Graph.prototype.getUndoStackSize=function(){return this.getPlugin("history").getUndoSize()},Graph.prototype.getRedoStackSize=function(){return this.getPlugin("history").getRedoSize()},Graph.prototype.getUndoRemainSize=function(){return this.getPlugin("history").getUndoRemainSize()};var __decorate$4=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Util;class History extends Basecoat{constructor(e={}){super(),this.name="history",this.batchCommands=null,this.batchLevel=0,this.lastBatchIndex=-1,this.freezed=!1,this.stackSize=0,this.handlers=[];const{stackSize:t=0}=e;this.stackSize=t,this.options=Util.getOptions(e),this.validator=new History.Validator({history:this,cancelInvalid:this.options.cancelInvalid})}init(e){this.graph=e,this.model=this.graph.model,this.clean(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(e){return null!=e?e!==this.isEnabled()&&(e?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}undo(e={}){if(!this.disabled){const t=this.undoStack.pop();t&&(this.revertCommand(t,e),this.redoStack.push(t),this.notify("undo",t,e))}return this}redo(e={}){if(!this.disabled){const t=this.redoStack.pop();t&&(this.applyCommand(t,e),this.undoStackPush(t),this.notify("redo",t,e))}return this}cancel(e={}){if(!this.disabled){const t=this.undoStack.pop();t&&(this.revertCommand(t,e),this.redoStack=[],this.notify("cancel",t,e))}return this}getSize(){return this.stackSize}getUndoRemainSize(){const e=this.undoStack.length;return this.stackSize-e}getUndoSize(){return this.undoStack.length}getRedoSize(){return this.redoStack.length}canUndo(){return!this.disabled&&this.undoStack.length>0}canRedo(){return!this.disabled&&this.redoStack.length>0}clean(e={}){return this.undoStack=[],this.redoStack=[],this.notify("clean",null,e),this}get disabled(){return!0!==this.options.enabled}validate(e,...t){return this.validator.validate(e,...t),this}startListening(){this.model.on("batch:start",this.initBatchCommand,this),this.model.on("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&this.options.eventNames.forEach((e,t)=>{this.handlers[t]=this.addCommand.bind(this,e),this.model.on(e,this.handlers[t])}),this.validator.on("invalid",e=>this.trigger("invalid",e))}stopListening(){this.model.off("batch:start",this.initBatchCommand,this),this.model.off("batch:stop",this.storeBatchCommand,this),this.options.eventNames&&(this.options.eventNames.forEach((e,t)=>{this.model.off(e,this.handlers[t])}),this.handlers.length=0),this.validator.off("invalid")}createCommand(e){return{batch:!!e&&e.batch,data:{}}}revertCommand(e,t){this.freezed=!0;const r=Array.isArray(e)?Util.sortBatchCommands(e):[e];for(let n=r.length-1;n>=0;n-=1){const e=r[n],i=Object.assign(Object.assign({},t),pick(e.options,this.options.revertOptionsList||[]));this.executeCommand(e,!0,i)}this.freezed=!1}applyCommand(e,t){this.freezed=!0;const r=Array.isArray(e)?Util.sortBatchCommands(e):[e];for(let n=0;n<r.length;n+=1){const e=r[n],i=Object.assign(Object.assign({},t),pick(e.options,this.options.applyOptionsList||[]));this.executeCommand(e,!1,i)}this.freezed=!1}executeCommand(e,t,r){const n=this.model,i=n.getCell(e.data.id),o=e.event;if(Util.isAddEvent(o)&&t||Util.isRemoveEvent(o)&&!t)i&&i.remove(r);else if(Util.isAddEvent(o)&&!t||Util.isRemoveEvent(o)&&t){const t=e.data;t.node?n.addNode(t.props,r):t.edge&&n.addEdge(t.props,r)}else if(Util.isChangeEvent(o)){const n=e.data,o=n.key;if(o&&i){const e=t?n.prev[o]:n.next[o];if("attrs"===n.key){this.ensureUndefinedAttrs(e,t?n.next[o]:n.prev[o])&&(r.dirty=!0)}i.prop(o,e,r)}}else{const n=this.options.executeCommand;n&&call$1(n,this,e,t,r)}}addCommand(e,t){if(this.freezed||this.disabled)return;const r=t,n=r.options||{};if(n.dryrun)return;if(Util.isAddEvent(e)&&this.options.ignoreAdd||Util.isRemoveEvent(e)&&this.options.ignoreRemove||Util.isChangeEvent(e)&&this.options.ignoreChange)return;const i=this.options.beforeAddCommand;if(null!=i&&!1===call$1(i,this,e,t))return;"cell:change:*"===e&&(e=`cell:change:${r.key}`);const o=r.cell,a=Model.isModel(o);let s;if(this.batchCommands){s=this.batchCommands[Math.max(this.lastBatchIndex,0)];const t=a&&!s.modelChange||s.data.id!==o.id,r=s.event!==e;if(this.lastBatchIndex>=0&&(t||r)){const t=this.batchCommands.findIndex(t=>(a&&t.modelChange||t.data.id===o.id)&&t.event===e);t<0||Util.isAddEvent(e)||Util.isRemoveEvent(e)?s=this.createCommand({batch:!0}):(s=this.batchCommands[t],this.batchCommands.splice(t,1)),this.batchCommands.push(s),this.lastBatchIndex=this.batchCommands.length-1}}else s=this.createCommand({batch:!1});if(Util.isAddEvent(e)||Util.isRemoveEvent(e)){const t=s.data;return s.event=e,s.options=n,t.id=o.id,t.props=cloneDeep(o.toJSON()),o.isEdge()?t.edge=!0:o.isNode()&&(t.node=!0),this.push(s,n)}if(Util.isChangeEvent(e)){const r=t.key,i=s.data;return s.batch&&s.event||(s.event=e,s.options=n,i.key=r,null==i.prev&&(i.prev={}),i.prev[r]=cloneDeep(o.previous(r)),a?s.modelChange=!0:i.id=o.id),null==i.next&&(i.next={}),i.next[r]=cloneDeep(o.prop(r)),this.push(s,n)}const l=this.options.afterAddCommand;l&&call$1(l,this,e,t,s),this.push(s,n)}initBatchCommand(e){this.freezed||(this.batchCommands?this.batchLevel+=1:(this.batchCommands=[this.createCommand({batch:!0})],this.batchLevel=0,this.lastBatchIndex=-1))}storeBatchCommand(e){if(!this.freezed)if(this.batchCommands&&this.batchLevel<=0){const t=this.filterBatchCommand(this.batchCommands);t.length>0&&(this.redoStack=[],this.undoStackPush(t),this.consolidateCommands(),this.notify("add",t,e)),this.batchCommands=null,this.lastBatchIndex=-1,this.batchLevel=0}else this.batchCommands&&this.batchLevel>0&&(this.batchLevel-=1)}filterBatchCommand(e){let t=e.slice();const r=[];for(;t.length>0;){const e=t.shift(),n=e.event,i=e.data.id;if(null!=n&&(null!=i||e.modelChange)){if(Util.isAddEvent(n)){const e=t.findIndex(e=>Util.isRemoveEvent(e.event)&&e.data.id===i);if(e>=0){t=t.filter((t,r)=>e<r||t.data.id!==i);continue}}else if(Util.isRemoveEvent(n)){const e=t.findIndex(e=>Util.isAddEvent(e.event)&&e.data.id===i);if(e>=0){t.splice(e,1);continue}}else if(Util.isChangeEvent(n)){const t=e.data;if(isEqual(t.prev,t.next))continue}r.push(e)}}return r}notify(e,t,r){const n=null==t?null:Array.isArray(t)?t:[t];this.emit(e,{cmds:n,options:r}),this.graph.trigger(`history:${e}`,{cmds:n,options:r}),this.emit("change",{cmds:n,options:r}),this.graph.trigger("history:change",{cmds:n,options:r})}push(e,t){this.redoStack=[],e.batch?(this.lastBatchIndex=Math.max(this.lastBatchIndex,0),this.emit("batch",{cmd:e,options:t})):(this.undoStackPush(e),this.consolidateCommands(),this.notify("add",e,t))}consolidateCommands(){var e;const t=this.undoStack[this.undoStack.length-1],r=this.undoStack[this.undoStack.length-2];if(!Array.isArray(t))return;const n=new Set(t.map(e=>e.event));if(2!==n.size||!n.has("cell:change:parent")||!n.has("cell:change:children"))return;if(!t.every(e=>{var t;return e.batch&&(null===(t=e.options)||void 0===t?void 0:t.ui)}))return;if(!Array.isArray(r)||1!==r.length)return;const i=r[0];"cell:change:position"===i.event&&(null===(e=i.options)||void 0===e?void 0:e.ui)&&(r.push(...t),this.undoStack.pop())}undoStackPush(e){0!==this.stackSize?(this.undoStack.length>=this.stackSize&&this.undoStack.shift(),this.undoStack.push(e)):this.undoStack.push(e)}ensureUndefinedAttrs(e,t){let r=!1;return null!==e&&null!==t&&"object"==typeof e&&"object"==typeof t&&Object.keys(t).forEach(n=>{void 0===e[n]&&void 0!==t[n]?(e[n]=void 0,r=!0):"object"==typeof e[n]&&"object"==typeof t[n]&&(r=this.ensureUndefinedAttrs(e[n],t[n]))}),r}dispose(){this.validator.dispose(),this.clean(),this.stopListening(),this.off()}}__decorate$4([Basecoat.dispose()],History.prototype,"dispose",null),function(e){class t extends Basecoat{constructor(e){super(),this.map={},this.command=e.history,this.cancelInvalid=!1!==e.cancelInvalid,this.command.on("add",this.onCommandAdded,this)}onCommandAdded({cmds:e}){return Array.isArray(e)?e.every(e=>this.isValidCommand(e)):this.isValidCommand(e)}isValidCommand(e){if(e.options&&!1===e.options.validation)return!0;const t=e.event&&this.map[e.event]||[];let r=null;return t.forEach(t=>{let n=0;const i=o=>{const a=t[n];n+=1;try{if(!a)return void(r=o);a(o,e,i)}catch(s){i(s)}};i(r)}),!r||(this.cancelInvalid&&this.command.cancel(),this.emit("invalid",{err:r}),!1)}validate(e,...t){const r=Array.isArray(e)?e:e.split(/\s+/);return t.forEach(e=>{if("function"!=typeof e)throw new Error(`${r.join(" ")} requires callback functions.`)}),r.forEach(e=>{null==this.map[e]&&(this.map[e]=[]),this.map[e].push(t)}),this}dispose(){this.command.off("add",this.onCommandAdded,this)}}__decorate$4([Basecoat.dispose()],t.prototype,"dispose",null),e.Validator=t}(History||(History={})),function(e){e.isAddEvent=function(e){return"cell:added"===e},e.isRemoveEvent=function(e){return"cell:removed"===e},e.isChangeEvent=function(e){return null!=e&&e.startsWith("cell:change:")},e.getOptions=function(t){const r=["cell:added","cell:removed","cell:change:*"],n=["batch:start","batch:stop"],i=t.eventNames?t.eventNames.filter(t=>!(e.isChangeEvent(t)||r.includes(t)||n.includes(t))):r;return Object.assign(Object.assign({enabled:!0},t),{eventNames:i,applyOptionsList:t.applyOptionsList||["propertyPath"],revertOptionsList:t.revertOptionsList||["propertyPath"]})},e.sortBatchCommands=function(t){const r=[];for(let n=0,i=t.length;n<i;n+=1){const i=t[n];let o=null;if(e.isAddEvent(i.event)){const e=i.data.id;for(let r=0;r<n;r+=1)if(t[r].data.id===e){o=r;break}}null!==o?r.splice(o,0,i):r.push(i)}return r}}(Util||(Util={}));var __decorate$3=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Private;class SelectionImpl extends View{get graph(){return this.options.graph}get boxClassName(){return this.prefixClassName(Private.classNames.box)}get $boxes(){return children(this.container,this.boxClassName)}get handleOptions(){return this.options}constructor(e){super(),this.options=e,this.options.model&&(this.options.collection=this.options.model.collection),this.options.collection?this.collection=this.options.collection:(this.collection=new Collection([],{comparator:Private.depthComparator}),this.options.collection=this.collection),this.boxCount=0,this.createContainer(),this.startListening()}startListening(){const e=this.graph,t=this.collection;this.delegateEvents({[`mousedown .${this.boxClassName}`]:"onSelectionBoxMouseDown",[`touchstart .${this.boxClassName}`]:"onSelectionBoxMouseDown"},!0),e.on("scale",this.onGraphTransformed,this),e.on("translate",this.onGraphTransformed,this),e.model.on("updated",this.onModelUpdated,this),t.on("added",this.onCellAdded,this),t.on("removed",this.onCellRemoved,this),t.on("reseted",this.onReseted,this),t.on("updated",this.onCollectionUpdated,this),t.on("node:change:position",this.onNodePositionChanged,this),t.on("cell:changed",this.onCellChanged,this)}stopListening(){const e=this.graph,t=this.collection;this.undelegateEvents(),e.off("scale",this.onGraphTransformed,this),e.off("translate",this.onGraphTransformed,this),e.model.off("updated",this.onModelUpdated,this),t.off("added",this.onCellAdded,this),t.off("removed",this.onCellRemoved,this),t.off("reseted",this.onReseted,this),t.off("updated",this.onCollectionUpdated,this),t.off("node:change:position",this.onNodePositionChanged,this),t.off("cell:changed",this.onCellChanged,this)}onRemove(){this.stopListening()}onGraphTransformed(){this.updateSelectionBoxes()}onCellChanged(){this.updateSelectionBoxes()}onNodePositionChanged({node:e,options:t}){const{showNodeSelectionBox:r,pointerEvents:n}=this.options,{ui:i,selection:o,translateBy:a,snapped:s}=t,l=(!0!==r||n&&"none"===this.getPointerEventsValue(n))&&!this.translating&&!o,c=i&&a&&e.id===a;if(l&&(c||s)){this.translating=!0;const r=e.position(),n=e.previous("position"),i=r.x-n.x,o=r.y-n.y;0===i&&0===o||this.translateSelectedNodes(i,o,e,t),this.translating=!1}}onModelUpdated({removed:e}){e&&e.length&&this.unselect(e)}isEmpty(){return this.length<=0}isSelected(e){return this.collection.has(e)}get length(){return this.collection.length}get cells(){return this.collection.toArray()}select(e,t={}){t.dryrun=!0;const r=this.filter(Array.isArray(e)?e:[e]);return this.collection.add(r,t),this}unselect(e,t={}){return t.dryrun=!0,this.collection.remove(Array.isArray(e)?e:[e],t),this}reset(e,t={}){if(e){if(t.batch){const r=this.filter(Array.isArray(e)?e:[e]);return this.collection.reset(r,Object.assign(Object.assign({},t),{ui:!0})),this}const r=this.cells,n=this.filter(Array.isArray(e)?e:[e]),i={},o={};r.forEach(e=>i[e.id]=e),n.forEach(e=>o[e.id]=e);const a=[],s=[];return n.forEach(e=>{i[e.id]||a.push(e)}),r.forEach(e=>{o[e.id]||s.push(e)}),s.length&&this.unselect(s,Object.assign(Object.assign({},t),{ui:!0})),a.length&&this.select(a,Object.assign(Object.assign({},t),{ui:!0})),0===s.length&&0===a.length&&this.updateContainer(),this}return this.clean(t)}clean(e={}){return this.length&&(!1===e.batch?this.unselect(this.cells,e):this.collection.reset([],Object.assign(Object.assign({},e),{ui:!0}))),this}setFilter(e){this.options.filter=e}setContent(e){this.options.content=e}startSelecting(e){let t,r;e=this.normalizeEvent(e),this.clean();const n=this.graph.container;if(null!=e.offsetX&&null!=e.offsetY&&n.contains(e.target))t=e.offsetX,r=e.offsetY;else{const i=offset$1(n),o=n.scrollLeft,a=n.scrollTop;t=e.clientX-i.left+window.pageXOffset+o,r=e.clientY-i.top+window.pageYOffset+a}css$3(this.container,{top:r,left:t,width:1,height:1}),this.setEventData(e,{action:"selecting",clientX:e.clientX,clientY:e.clientY,offsetX:t,offsetY:r,scrollerX:0,scrollerY:0,moving:!1}),this.delegateDocumentEvents(Private.documentEvents,e.data)}filter(e){const t=this.options.filter;return e.filter(e=>Array.isArray(t)?t.some(t=>"string"==typeof t?e.shape===t:e.id===t.id):"function"!=typeof t||call$1(t,this.graph,e))}stopSelecting(e){const t=this.graph,r=this.getEventData(e);switch(r.action){case"selecting":{let e=width$1(this.container),r=height$1(this.container);const n=offset$1(this.container),i=t.pageToLocal(n.left,n.top),o=t.transform.getScale();e/=o.sx,r/=o.sy;const a=new Rectangle(i.x,i.y,e,r),s=this.getCellViewsInArea(a).map(e=>e.cell);this.reset(s,{batch:!0}),this.hideRubberband();break}case"translating":{const n=t.snapToGrid(e.clientX,e.clientY);if(!this.options.following){const e=r;this.updateSelectedNodesPosition({dx:e.clientX-e.originX,dy:e.clientY-e.originY})}this.graph.model.stopBatch("move-selection"),this.notifyBoxEvent("box:mouseup",e,n.x,n.y);break}default:this.clean()}}onMouseUp(e){this.getEventData(e).action&&(this.stopSelecting(e),this.undelegateDocumentEvents())}onSelectionBoxMouseDown(e){this.options.following||e.stopPropagation();const t=this.normalizeEvent(e);this.options.movable&&this.startTranslating(t);const r=this.getCellViewFromElem(t.target);this.setEventData(t,{activeView:r});const n=this.graph.snapToGrid(t.clientX,t.clientY);this.notifyBoxEvent("box:mousedown",t,n.x,n.y),this.delegateDocumentEvents(Private.documentEvents,t.data)}startTranslating(e){this.graph.model.startBatch("move-selection");const t=this.graph.snapToGrid(e.clientX,e.clientY);this.setEventData(e,{action:"translating",clientX:t.x,clientY:t.y,originX:t.x,originY:t.y})}getRestrictArea(){const e=this.graph.options.translating.restrict,t="function"==typeof e?call$1(e,this.graph,null):e;return"number"==typeof t?this.graph.transform.getGraphArea().inflate(t):!0===t?this.graph.transform.getGraphArea():t||null}getSelectionOffset(e,t){let r=e.x-t.clientX,n=e.y-t.clientY;const i=this.getRestrictArea();if(i){const o=this.collection.toArray(),a=Cell.getCellsBBox(o,{deep:!0})||Rectangle.create(),s=i.x-a.x,l=i.y-a.y,c=i.x+i.width-(a.x+a.width),u=i.y+i.height-(a.y+a.height);if(r<s&&(r=s),n<l&&(n=l),c<r&&(r=c),u<n&&(n=u),!this.options.following){const i=e.x-t.originX,o=e.y-t.originY;r=i<=s||i>=c?0:r,n=o<=l||o>=u?0:n}}return{dx:r,dy:n}}updateElementPosition(e,t,r){const n=css$3(e,"left"),i=css$3(e,"top"),o=n?parseFloat(n):0,a=i?parseFloat(i):0;css$3(e,"left",o+t),css$3(e,"top",a+r)}updateSelectedNodesPosition(e){const{dx:t,dy:r}=e;if(t||r)if(this.translateSelectedNodes(t,r),this.boxesUpdated)this.collection.length>1&&this.updateSelectionBoxes();else{const e=this.graph.transform.getScale();for(let n=0,i=this.$boxes,o=i.length;n<o;n+=1)this.updateElementPosition(i[n],t*e.sx,r*e.sy);this.updateElementPosition(this.selectionContainer,t*e.sx,r*e.sy)}}autoScrollGraph(e,t){const r=this.graph.getPlugin("scroller");return r?r.autoScroll(e,t):{scrollerX:0,scrollerY:0}}adjustSelection(e){const t=this.normalizeEvent(e),r=this.getEventData(t);switch(r.action){case"selecting":{const e=r;!0!==e.moving&&(appendTo(this.container,this.graph.container),this.showRubberband(),e.moving=!0);const{scrollerX:n,scrollerY:i}=this.autoScrollGraph(t.clientX,t.clientY);e.scrollerX+=n,e.scrollerY+=i;const o=t.clientX-e.clientX+e.scrollerX,a=t.clientY-e.clientY+e.scrollerY,s=parseInt(css$3(this.container,"left")||"0",10),l=parseInt(css$3(this.container,"top")||"0",10);css$3(this.container,{left:o<0?e.offsetX+o:s,top:a<0?e.offsetY+a:l,width:Math.abs(o),height:Math.abs(a)});break}case"translating":{const n=this.graph.snapToGrid(t.clientX,t.clientY),i=r,o=this.getSelectionOffset(n,i);this.options.following?this.updateSelectedNodesPosition(o):this.updateContainerPosition(o),o.dx&&(i.clientX=n.x),o.dy&&(i.clientY=n.y),this.notifyBoxEvent("box:mousemove",e,n.x,n.y);break}}this.boxesUpdated=!1}translateSelectedNodes(e,t,r,n){const i={},o=[];if(r&&(i[r.id]=!0),this.collection.toArray().forEach(e=>{e.getDescendants({deep:!0}).forEach(e=>{i[e.id]=!0})}),n&&n.translateBy){const e=this.graph.getCellById(n.translateBy);e&&(i[e.id]=!0,e.getDescendants({deep:!0}).forEach(e=>{i[e.id]=!0}),o.push(e))}this.collection.toArray().forEach(r=>{if(!i[r.id]){const a=Object.assign(Object.assign({},n),{selection:this.cid,exclude:o});r.translate(e,t,a),this.graph.model.getConnectedEdges(r).forEach(r=>{i[r.id]||(r.translate(e,t,a),i[r.id]=!0)})}})}getCellViewsInArea(e){const t=this.graph,r={strict:this.options.strict};let n=[];return this.options.rubberNode&&(n=n.concat(t.model.getNodesInArea(e,r).map(e=>t.renderer.findViewByCell(e)).filter(e=>null!=e))),this.options.rubberEdge&&(n=n.concat(t.model.getEdgesInArea(e,r).map(e=>t.renderer.findViewByCell(e)).filter(e=>null!=e))),n}notifyBoxEvent(e,t,r,n){const i=this.getEventData(t).activeView;this.trigger(e,{e:t,view:i,x:r,y:n,cell:i.cell})}getSelectedClassName(e){return this.prefixClassName((e.isNode()?"node":"edge")+"-selected")}addCellSelectedClassName(e){const t=this.graph.renderer.findViewByCell(e);t&&t.addClass(this.getSelectedClassName(e))}removeCellUnSelectedClassName(e){const t=this.graph.renderer.findViewByCell(e);t&&t.removeClass(this.getSelectedClassName(e))}destroySelectionBox(e){this.removeCellUnSelectedClassName(e),this.canShowSelectionBox(e)&&(remove(this.container.querySelector(`[data-cell-id="${e.id}"]`)),0===this.$boxes.length&&this.hide(),this.boxCount=Math.max(0,this.boxCount-1))}destroyAllSelectionBoxes(e){e.forEach(e=>this.removeCellUnSelectedClassName(e)),this.hide(),remove(this.$boxes),this.boxCount=0}hide(){removeClass(this.container,this.prefixClassName(Private.classNames.rubberband)),removeClass(this.container,this.prefixClassName(Private.classNames.selected))}showRubberband(){addClass(this.container,this.prefixClassName(Private.classNames.rubberband))}hideRubberband(){removeClass(this.container,this.prefixClassName(Private.classNames.rubberband))}showSelected(){removeAttribute(this.container,"style"),addClass(this.container,this.prefixClassName(Private.classNames.selected))}createContainer(){this.container=document.createElement("div"),addClass(this.container,this.prefixClassName(Private.classNames.root)),this.options.className&&addClass(this.container,this.options.className),this.selectionContainer=document.createElement("div"),addClass(this.selectionContainer,this.prefixClassName(Private.classNames.inner)),this.selectionContent=document.createElement("div"),addClass(this.selectionContent,this.prefixClassName(Private.classNames.content)),append(this.selectionContainer,this.selectionContent),attr(this.selectionContainer,"data-selection-length",this.collection.length),prepend(this.container,this.selectionContainer)}updateContainerPosition(e){(e.dx||e.dy)&&this.updateElementPosition(this.selectionContainer,e.dx,e.dy)}updateContainer(){const e={x:1/0,y:1/0},t={x:0,y:0};this.collection.toArray().filter(e=>this.canShowSelectionBox(e)).forEach(r=>{const n=this.graph.renderer.findViewByCell(r);if(n){const r=n.getBBox({useCellGeometry:!0});e.x=Math.min(e.x,r.x),e.y=Math.min(e.y,r.y),t.x=Math.max(t.x,r.x+r.width),t.y=Math.max(t.y,r.y+r.height)}}),css$3(this.selectionContainer,{position:"absolute",pointerEvents:"none",left:e.x,top:e.y,width:t.x-e.x,height:t.y-e.y}),attr(this.selectionContainer,"data-selection-length",this.collection.length);const r=this.options.content;if(r)if("function"==typeof r){const e=call$1(r,this.graph,this,this.selectionContent);e&&(this.selectionContent.innerHTML=e)}else this.selectionContent.innerHTML=r;this.collection.length>0&&!this.container.parentNode?appendTo(this.container,this.graph.container):this.collection.length<=0&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}canShowSelectionBox(e){return e.isNode()&&!0===this.options.showNodeSelectionBox||e.isEdge()&&!0===this.options.showEdgeSelectionBox}getPointerEventsValue(e){return"string"==typeof e?e:e(this.cells)}createSelectionBox(e){if(this.addCellSelectedClassName(e),this.canShowSelectionBox(e)){const t=this.graph.renderer.findViewByCell(e);if(t){const r=t.getBBox({useCellGeometry:!0}),n=this.boxClassName,i=document.createElement("div"),o=this.options.pointerEvents;addClass(i,n),addClass(i,`${n}-${e.isNode()?"node":"edge"}`),attr(i,"data-cell-id",e.id),css$3(i,{position:"absolute",left:r.x,top:r.y,width:r.width,height:r.height,pointerEvents:o?this.getPointerEventsValue(o):"auto"}),appendTo(i,this.container),this.showSelected(),this.boxCount+=1}}}updateSelectionBoxes(){this.collection.length>0&&(this.boxesUpdated=!0,this.confirmUpdate())}confirmUpdate(){if(this.boxCount){this.hide();for(let e=0,t=this.$boxes,r=t.length;e<r;e+=1){const r=t[e],n=attr(r,"data-cell-id");remove(r),this.boxCount-=1;const i=this.collection.get(n);i&&this.createSelectionBox(i)}this.updateContainer()}return 0}getCellViewFromElem(e){const t=e.getAttribute("data-cell-id");if(t){const e=this.collection.get(t);if(e)return this.graph.renderer.findViewByCell(e)}return null}onCellRemoved({cell:e}){this.destroySelectionBox(e),this.updateContainer()}onReseted({previous:e,current:t}){this.destroyAllSelectionBoxes(e),t.forEach(e=>{this.listenCellRemoveEvent(e),this.createSelectionBox(e)}),this.updateContainer()}onCellAdded({cell:e}){this.listenCellRemoveEvent(e),this.createSelectionBox(e),this.updateContainer()}listenCellRemoveEvent(e){e.off("removed",this.onCellRemoved,this),e.on("removed",this.onCellRemoved,this)}onCollectionUpdated({added:e,removed:t,options:r}){e.forEach(e=>{this.trigger("cell:selected",{cell:e,options:r}),e.isNode()?this.trigger("node:selected",{cell:e,options:r,node:e}):e.isEdge()&&this.trigger("edge:selected",{cell:e,options:r,edge:e})}),t.forEach(e=>{this.trigger("cell:unselected",{cell:e,options:r}),e.isNode()?this.trigger("node:unselected",{cell:e,options:r,node:e}):e.isEdge()&&this.trigger("edge:unselected",{cell:e,options:r,edge:e})});const n={added:e,removed:t,options:r,selected:this.cells.filter(e=>!!this.graph.getCellById(e.id))};this.trigger("selection:changed",n)}dispose(){this.clean(),this.remove(),this.off()}}__decorate$3([View.dispose()],SelectionImpl.prototype,"dispose",null),function(e){const t="widget-selection";e.classNames={root:t,inner:`${t}-inner`,box:`${t}-box`,content:`${t}-content`,rubberband:`${t}-rubberband`,selected:`${t}-selected`},e.documentEvents={mousemove:"adjustSelection",touchmove:"adjustSelection",mouseup:"onMouseUp",touchend:"onMouseUp",touchcancel:"onMouseUp"},e.depthComparator=function(e){return e.getAncestors().length}}(Private||(Private={}));const content$2=".x6-widget-selection {\n position: absolute;\n top: 0;\n left: 0;\n display: none;\n width: 0;\n height: 0;\n touch-action: none;\n}\n.x6-widget-selection-rubberband {\n display: block;\n overflow: visible;\n opacity: 0.3;\n}\n.x6-widget-selection-selected {\n display: block;\n}\n.x6-widget-selection-box {\n cursor: move;\n}\n.x6-widget-selection-inner[data-selection-length='0'],\n.x6-widget-selection-inner[data-selection-length='1'] {\n display: none;\n}\n.x6-widget-selection-content {\n position: absolute;\n top: 100%;\n right: -20px;\n left: -20px;\n margin-top: 30px;\n padding: 6px;\n line-height: 14px;\n text-align: center;\n border-radius: 6px;\n}\n.x6-widget-selection-content:empty {\n display: none;\n}\n.x6-widget-selection-rubberband {\n background-color: #3498db;\n border: 2px solid #2980b9;\n}\n.x6-widget-selection-box {\n box-sizing: content-box !important;\n margin-top: -4px;\n margin-left: -4px;\n padding-right: 4px;\n padding-bottom: 4px;\n border: 2px dashed #feb663;\n box-shadow: 2px 2px 5px #d3d3d3;\n}\n.x6-widget-selection-inner {\n box-sizing: content-box !important;\n margin-top: -8px;\n margin-left: -8px;\n padding-right: 12px;\n padding-bottom: 12px;\n border: 2px solid #feb663;\n box-shadow: 2px 2px 5px #d3d3d3;\n}\n.x6-widget-selection-content {\n color: #fff;\n font-size: 10px;\n background-color: #6a6b8a;\n}\n";Graph.prototype.isSelectionEnabled=function(){const e=this.getPlugin("selection");return!!e&&e.isEnabled()},Graph.prototype.enableSelection=function(){const e=this.getPlugin("selection");return e&&e.enable(),this},Graph.prototype.disableSelection=function(){const e=this.getPlugin("selection");return e&&e.disable(),this},Graph.prototype.toggleSelection=function(e){const t=this.getPlugin("selection");return t&&t.toggleEnabled(e),this},Graph.prototype.isMultipleSelection=function(){const e=this.getPlugin("selection");return!!e&&e.isMultipleSelection()},Graph.prototype.enableMultipleSelection=function(){const e=this.getPlugin("selection");return e&&e.enableMultipleSelection(),this},Graph.prototype.disableMultipleSelection=function(){const e=this.getPlugin("selection");return e&&e.disableMultipleSelection(),this},Graph.prototype.toggleMultipleSelection=function(e){const t=this.getPlugin("selection");return t&&t.toggleMultipleSelection(e),this},Graph.prototype.isSelectionMovable=function(){const e=this.getPlugin("selection");return!!e&&e.isSelectionMovable()},Graph.prototype.enableSelectionMovable=function(){const e=this.getPlugin("selection");return e&&e.enableSelectionMovable(),this},Graph.prototype.disableSelectionMovable=function(){const e=this.getPlugin("selection");return e&&e.disableSelectionMovable(),this},Graph.prototype.toggleSelectionMovable=function(e){const t=this.getPlugin("selection");return t&&t.toggleSelectionMovable(e),this},Graph.prototype.isRubberbandEnabled=function(){const e=this.getPlugin("selection");return!!e&&e.isRubberbandEnabled()},Graph.prototype.enableRubberband=function(){const e=this.getPlugin("selection");return e&&e.enableRubberband(),this},Graph.prototype.disableRubberband=function(){const e=this.getPlugin("selection");return e&&e.disableRubberband(),this},Graph.prototype.toggleRubberband=function(e){const t=this.getPlugin("selection");return t&&t.toggleRubberband(e),this},Graph.prototype.isStrictRubberband=function(){const e=this.getPlugin("selection");return!!e&&e.isStrictRubberband()},Graph.prototype.enableStrictRubberband=function(){const e=this.getPlugin("selection");return e&&e.enableStrictRubberband(),this},Graph.prototype.disableStrictRubberband=function(){const e=this.getPlugin("selection");return e&&e.disableStrictRubberband(),this},Graph.prototype.toggleStrictRubberband=function(e){const t=this.getPlugin("selection");return t&&t.toggleStrictRubberband(e),this},Graph.prototype.setRubberbandModifiers=function(e){const t=this.getPlugin("selection");return t&&t.setRubberbandModifiers(e),this},Graph.prototype.setSelectionFilter=function(e){const t=this.getPlugin("selection");return t&&t.setSelectionFilter(e),this},Graph.prototype.setSelectionDisplayContent=function(e){const t=this.getPlugin("selection");return t&&t.setSelectionDisplayContent(e),this},Graph.prototype.isSelectionEmpty=function(){const e=this.getPlugin("selection");return!e||e.isEmpty()},Graph.prototype.cleanSelection=function(e){const t=this.getPlugin("selection");return t&&t.clean(e),this},Graph.prototype.resetSelection=function(e,t){const r=this.getPlugin("selection");return r&&r.reset(e,t),this},Graph.prototype.getSelectedCells=function(){const e=this.getPlugin("selection");return e?e.getSelectedCells():[]},Graph.prototype.getSelectedCellCount=function(){const e=this.getPlugin("selection");return e?e.getSelectedCellCount():0},Graph.prototype.isSelected=function(e){const t=this.getPlugin("selection");return!!t&&t.isSelected(e)},Graph.prototype.select=function(e,t){const r=this.getPlugin("selection");return r&&r.select(e,t),this},Graph.prototype.unselect=function(e,t){const r=this.getPlugin("selection");return r&&r.unselect(e,t),this};var __decorate$2=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},Selection2;class Selection extends Basecoat{get rubberbandDisabled(){return!0!==this.options.enabled||!0!==this.options.rubberband}get disabled(){return!0!==this.options.enabled}get length(){return this.selectionImpl.length}get cells(){return this.selectionImpl.cells}constructor(e={}){super(),this.name="selection",this.movedMap=new WeakMap,this.unselectMap=new WeakMap,this.options=Object.assign(Object.assign({enabled:!0},Selection.defaultOptions),e),ensure(this.name,content$2)}init(e){this.graph=e,this.selectionImpl=new SelectionImpl(Object.assign(Object.assign({},this.options),{graph:e})),this.setup(),this.startListening()}isEnabled(){return!this.disabled}enable(){this.disabled&&(this.options.enabled=!0)}disable(){this.disabled||(this.options.enabled=!1)}toggleEnabled(e){return null!=e?e!==this.isEnabled()&&(e?this.enable():this.disable()):this.isEnabled()?this.disable():this.enable(),this}isMultipleSelection(){return this.isMultiple()}enableMultipleSelection(){return this.enableMultiple(),this}disableMultipleSelection(){return this.disableMultiple(),this}toggleMultipleSelection(e){return null!=e?e!==this.isMultipleSelection()&&(e?this.enableMultipleSelection():this.disableMultipleSelection()):this.isMultipleSelection()?this.disableMultipleSelection():this.enableMultipleSelection(),this}isSelectionMovable(){return!1!==this.options.movable}enableSelectionMovable(){return this.selectionImpl.options.movable=!0,this}disableSelectionMovable(){return this.selectionImpl.options.movable=!1,this}toggleSelectionMovable(e){return null!=e?e!==this.isSelectionMovable()&&(e?this.enableSelectionMovable():this.disableSelectionMovable()):this.isSelectionMovable()?this.disableSelectionMovable():this.enableSelectionMovable(),this}isRubberbandEnabled(){return!this.rubberbandDisabled}enableRubberband(){return this.rubberbandDisabled&&(this.options.rubberband=!0),this}disableRubberband(){return this.rubberbandDisabled||(this.options.rubberband=!1),this}toggleRubberband(e){return null!=e?e!==this.isRubberbandEnabled()&&(e?this.enableRubberband():this.disableRubberband()):this.isRubberbandEnabled()?this.disableRubberband():this.enableRubberband(),this}isStrictRubberband(){return!0===this.selectionImpl.options.strict}enableStrictRubberband(){return this.selectionImpl.options.strict=!0,this}disableStrictRubberband(){return this.selectionImpl.options.strict=!1,this}toggleStrictRubberband(e){return null!=e?e!==this.isStrictRubberband()&&(e?this.enableStrictRubberband():this.disableStrictRubberband()):this.isStrictRubberband()?this.disableStrictRubberband():this.enableStrictRubberband(),this}setRubberbandModifiers(e){this.setModifiers(e)}setSelectionFilter(e){return this.setFilter(e),this}setSelectionDisplayContent(e){return this.setContent(e),this}isEmpty(){return this.length<=0}clean(e={}){return this.selectionImpl.clean(e),this}reset(e,t={}){return this.selectionImpl.reset(e?this.getCells(e):[],t),this}getSelectedCells(){return this.cells}getSelectedCellCount(){return this.length}isSelected(e){return this.selectionImpl.isSelected(e)}select(e,t={}){const r=this.getCells(e);return r.length&&(this.isMultiple()?this.selectionImpl.select(r,t):this.reset(r.slice(0,1),t)),this}unselect(e,t={}){return this.selectionImpl.unselect(this.getCells(e),t),this}setup(){this.selectionImpl.on("*",(e,t)=>{this.trigger(e,t),this.graph.trigger(e,t)})}startListening(){this.graph.on("blank:mousedown",this.onBlankMouseDown,this),this.graph.on("blank:click",this.onBlankClick,this),this.graph.on("cell:mousemove",this.onCellMouseMove,this),this.graph.on("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.on("box:mousedown",this.onBoxMouseDown,this)}stopListening(){this.graph.off("blank:mousedown",this.onBlankMouseDown,this),this.graph.off("blank:click",this.onBlankClick,this),this.graph.off("cell:mousemove",this.onCellMouseMove,this),this.graph.off("cell:mouseup",this.onCellMouseUp,this),this.selectionImpl.off("box:mousedown",this.onBoxMouseDown,this)}onBlankMouseDown({e:e}){if(!this.allowBlankMouseDown(e))return;const t=this.graph.panning.allowPanning(e,!0),r=this.graph.getPlugin("scroller"),n=r&&r.allowPanning(e,!0);(this.allowRubberband(e,!0)||this.allowRubberband(e)&&!n&&!t)&&this.startRubberband(e)}allowBlankMouseDown(e){const t=this.options.eventTypes;return(null==t?void 0:t.includes("leftMouseDown"))&&0===e.button||(null==t?void 0:t.includes("mouseWheelDown"))&&1===e.button}onBlankClick(){this.clean()}allowRubberband(e,t){return!this.rubberbandDisabled&&ModifierKey.isMatch(e,this.options.modifiers,t)}allowMultipleSelection(e){return this.isMultiple()&&ModifierKey.isMatch(e,this.options.multipleSelectionModifiers)}onCellMouseMove({cell:e}){this.movedMap.set(e,!0)}onCellMouseUp({e:e,cell:t}){const r=this.options;let n=this.disabled;!n&&this.movedMap.has(t)&&(n=!1===r.selectCellOnMoved,n||(n=!1===r.selectNodeOnMoved&&t.isNode()),n||(n=!1===r.selectEdgeOnMoved&&t.isEdge())),n||(this.allowMultipleSelection(e)?this.unselectMap.has(t)?this.unselectMap.delete(t):this.isSelected(t)?this.unselect(t):this.select(t):this.reset(t)),this.movedMap.delete(t)}onBoxMouseDown({e:e,cell:t}){this.disabled||this.allowMultipleSelection(e)&&(this.unselect(t),this.unselectMap.set(t,!0))}getCells(e){return(Array.isArray(e)?e:[e]).map(e=>"string"==typeof e?this.graph.getCellById(e):e).filter(e=>null!=e)}startRubberband(e){return this.rubberbandDisabled||this.selectionImpl.startSelecting(e),this}isMultiple(){return!1!==this.options.multiple}enableMultiple(){return this.options.multiple=!0,this}disableMultiple(){return this.options.multiple=!1,this}setModifiers(e){return this.options.modifiers=e,this}setContent(e){return this.selectionImpl.setContent(e),this}setFilter(e){return this.selectionImpl.setFilter(e),this}dispose(){this.stopListening(),this.off(),this.selectionImpl.dispose(),clean(this.name)}}__decorate$2([Basecoat.dispose()],Selection.prototype,"dispose",null),Selection2=Selection||(Selection={}),Selection2.defaultOptions={rubberband:!1,rubberNode:!0,rubberEdge:!1,pointerEvents:"auto",multiple:!0,multipleSelectionModifiers:["ctrl","meta"],movable:!0,strict:!1,selectCellOnMoved:!1,selectNodeOnMoved:!1,selectEdgeOnMoved:!1,following:!0,content:null,eventTypes:["leftMouseDown","mouseWheelDown"]};var __decorate$1=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},__rest=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r};class SnaplineImpl extends View{get model(){return this.graph.model}get containerClassName(){return this.prefixClassName("widget-snapline")}get verticalClassName(){return`${this.containerClassName}-vertical`}get horizontalClassName(){return`${this.containerClassName}-horizontal`}constructor(e){super();const{graph:t}=e,r=__rest(e,["graph"]);this.graph=t,this.options=Object.assign({},r),this.offset={x:0,y:0},this.render(),this.disabled||this.startListening()}get disabled(){return!0!==this.options.enabled}enable(){this.disabled&&(this.options.enabled=!0,this.startListening())}disable(){this.disabled||(this.options.enabled=!1,this.stopListening())}setFilter(e){this.options.filter=e}render(){const e=this.containerWrapper=new Vector("svg"),t=this.horizontal=new Vector("line"),r=this.vertical=new Vector("line");e.addClass(this.containerClassName),t.addClass(this.horizontalClassName),r.addClass(this.verticalClassName),e.setAttribute("width","100%"),e.setAttribute("height","100%"),t.setAttribute("display","none"),r.setAttribute("display","none"),e.append([t,r]),this.options.className&&e.addClass(this.options.className),this.container=this.containerWrapper.node}startListening(){this.stopListening(),this.graph.on("node:mousedown",this.captureCursorOffset,this),this.graph.on("node:mousemove",this.snapOnMoving,this),this.model.on("batch:stop",this.onBatchStop,this),this.delegateDocumentEvents({mouseup:"hide",touchend:"hide"})}stopListening(){this.graph.off("node:mousedown",this.captureCursorOffset,this),this.graph.off("node:mousemove",this.snapOnMoving,this),this.model.off("batch:stop",this.onBatchStop,this),this.undelegateDocumentEvents()}onBatchStop({name:e,data:t}){"resize"===e&&this.snapOnResizing(t.cell,t)}captureCursorOffset({view:e,x:t,y:r}){const n=e.getDelegatedView();if(n&&this.isNodeMovable(n)){const n=e.cell.getPosition();this.offset={x:t-n.x,y:r-n.y}}}isNodeMovable(e){return e&&e.cell.isNode()&&e.can("nodeMovable")}getRestrictArea(e){const t=this.graph.options.translating.restrict,r="function"==typeof t?call$1(t,this.graph,e):t;return"number"==typeof r?this.graph.transform.getGraphArea().inflate(r):!0===r?this.graph.transform.getGraphArea():r||null}snapOnResizing(e,t){if(this.options.resizing&&!t.snapped&&t.ui&&t.direction&&t.trueDirection){const r=this.graph.renderer.findViewByCell(e);if(r&&r.cell.isNode()){const n=e.getBBox(),i=n.bbox(e.getAngle()),o=i.getTopLeft(),a=i.getBottomRight(),s=Angle.normalize(e.getAngle()),l=this.options.tolerance||0;let c,u,d,p,h,f;const g={vertical:0,horizontal:0},m=t.direction,v=t.trueDirection,y=t.relativeDirection;-1!==v.indexOf("right")?g.vertical=a.x:g.vertical=o.x,-1!==v.indexOf("bottom")?g.horizontal=a.y:g.horizontal=o.y,this.model.getNodes().some(t=>{if(this.isIgnored(e,t))return!1;const r=t.getBBox().bbox(t.getAngle()),n=r.getTopLeft(),o=r.getBottomRight(),s={vertical:[n.x,o.x],horizontal:[n.y,o.y]},m={};return Object.keys(s).forEach(e=>{const t=e,r=s[t].map(e=>({position:e,distance:Math.abs(e-g[t])})).filter(e=>e.distance<=l);m[t]=sortBy(r,e=>e.distance)}),null==c&&m.vertical.length>0&&(c=m.vertical[0].position,u=Math.min(i.y,r.y),d=Math.max(a.y,o.y)-u),null==p&&m.horizontal.length>0&&(p=m.horizontal[0].position,h=Math.min(i.x,r.x),f=Math.max(a.x,o.x)-h),null!=c&&null!=p}),this.hide();let b=0,q=0;null==p&&null==c||(null!=c&&(b=-1!==v.indexOf("right")?c-a.x:o.x-c),null!=p&&(q=-1!==v.indexOf("bottom")?p-a.y:o.y-p));let V=0,S=0;if(s%90==0)90===s||270===s?(V=q,S=b):(V=b,S=q);else{const e=s>=0&&s<90?1:s>=90&&s<180?4:s>=180&&s<270?3:2;null!=p&&null!=c&&(b<q?(q=0,p=void 0):(b=0,c=void 0));const t=Angle.toRad(s%90);b&&(V=3===e?b/Math.cos(t):b/Math.sin(t)),q&&(S=3===e?q/Math.cos(t):q/Math.sin(t));const r=1===e||3===e;switch(y){case"top":case"bottom":S=q?q/(r?Math.cos(t):Math.sin(t)):b/(r?Math.sin(t):Math.cos(t));break;case"left":case"right":V=b?b/(r?Math.cos(t):Math.sin(t)):q/(r?Math.sin(t):Math.cos(t))}}switch(y){case"top":case"bottom":V=0;break;case"left":case"right":S=0}const E=this.graph.getGridSize();let x=Math.max(n.width+V,E),C=Math.max(n.height+S,E);t.minWidth&&t.minWidth>E&&(x=Math.max(x,t.minWidth)),t.minHeight&&t.minHeight>E&&(C=Math.max(C,t.minHeight)),t.maxWidth&&(x=Math.min(x,t.maxWidth)),t.maxHeight&&(C=Math.min(C,t.maxHeight)),t.preserveAspectRatio&&(S<V?C=x*(n.height/n.width):x=C*(n.width/n.height)),x===n.width&&C===n.height||(e.resize(x,C,{direction:m,relativeDirection:y,trueDirection:v,snapped:!0,snaplines:this.cid,restrict:this.getRestrictArea(r)}),d&&(d+=C-n.height),f&&(f+=x-n.width));const w=e.getBBox().bbox(s);c&&Math.abs(w.x-c)>1&&Math.abs(w.width+w.x-c)>1&&(c=void 0),p&&Math.abs(w.y-p)>1&&Math.abs(w.height+w.y-p)>1&&(p=void 0),this.update({verticalLeft:c,verticalTop:u,verticalHeight:d,horizontalTop:p,horizontalLeft:h,horizontalWidth:f})}}}snapOnMoving({view:e,e:t,x:r,y:n}){const i=e.getEventData(t).delegatedView||e;if(!this.isNodeMovable(i))return;const o=i.cell,a=o.getSize(),s=o.getPosition(),l=new Rectangle(r-this.offset.x,n-this.offset.y,a.width,a.height),c=o.getAngle(),u=l.getCenter(),d=l.bbox(c),p=d.getTopLeft(),h=d.getBottomRight(),f=this.options.tolerance||0;let g,m,v,y,b,q,V=0,S=0;if(this.model.getNodes().some(e=>{if(this.isIgnored(o,e))return!1;const t=e.getBBox().bbox(e.getAngle()),r=t.getCenter(),n=t.getTopLeft(),i=t.getBottomRight();return null==g&&(Math.abs(r.x-u.x)<f?(g=r.x,V=.5):Math.abs(n.x-p.x)<f?(g=n.x,V=0):Math.abs(n.x-h.x)<f?(g=n.x,V=1):Math.abs(i.x-h.x)<f?(g=i.x,V=1):Math.abs(i.x-p.x)<f&&(g=i.x),null!=g&&(m=Math.min(d.y,t.y),v=Math.max(h.y,i.y)-m)),null==y&&(Math.abs(r.y-u.y)<f?(y=r.y,S=.5):Math.abs(n.y-p.y)<f?y=n.y:Math.abs(n.y-h.y)<f?(y=n.y,S=1):Math.abs(i.y-h.y)<f?(y=i.y,S=1):Math.abs(i.y-p.y)<f&&(y=i.y),null!=y&&(b=Math.min(d.x,t.x),q=Math.max(h.x,i.x)-b)),null!=g&&null!=y}),this.hide(),null!=y||null!=g){null!=y&&(d.y=y-S*d.height),null!=g&&(d.x=g-V*d.width);const e=d.getCenter(),t=e.x-l.width/2,r=e.y-l.height/2,n=t-s.x,a=r-s.y;0===n&&0===a||(o.translate(n,a,{snapped:!0,restrict:this.getRestrictArea(i)}),q&&(q+=n),v&&(v+=a)),this.update({verticalLeft:g,verticalTop:m,verticalHeight:v,horizontalTop:y,horizontalLeft:b,horizontalWidth:q})}}isIgnored(e,t){return t.id===e.id||t.isDescendantOf(e)||!this.filter(t)}filter(e){const t=this.options.filter;return Array.isArray(t)?t.some(t=>"string"==typeof t?e.shape===t:e.id===t.id):"function"!=typeof t||call$1(t,this.graph,e)}update(e){if(e.horizontalTop){const t=this.graph.localToGraph(new Point(e.horizontalLeft,e.horizontalTop)),r=this.graph.localToGraph(new Point(e.horizontalLeft+e.horizontalWidth,e.horizontalTop));this.horizontal.setAttributes({x1:this.options.sharp?`${t.x}`:"0",y1:`${t.y}`,x2:this.options.sharp?`${r.x}`:"100%",y2:`${r.y}`,display:"inherit"})}else this.horizontal.setAttribute("display","none");if(e.verticalLeft){const t=this.graph.localToGraph(new Point(e.verticalLeft,e.verticalTop)),r=this.graph.localToGraph(new Point(e.verticalLeft,e.verticalTop+e.verticalHeight));this.vertical.setAttributes({x1:`${t.x}`,y1:this.options.sharp?`${t.y}`:"0",x2:`${r.x}`,y2:this.options.sharp?`${r.y}`:"100%",display:"inherit"})}else this.vertical.setAttribute("display","none");this.show()}resetTimer(){this.timer&&(clearTimeout(this.timer),this.timer=null)}show(){return this.resetTimer(),null==this.container.parentNode&&this.graph.container.appendChild(this.container),this}hide(){this.resetTimer(),this.vertical.setAttribute("display","none"),this.horizontal.setAttribute("display","none");const e=this.options.clean,t="number"==typeof e?e:!1!==e?3e3:0;return t>0&&(this.timer=window.setTimeout(()=>{null!==this.container.parentNode&&this.unmount()},t)),this}onRemove(){this.stopListening(),this.hide()}dispose(){this.remove()}}__decorate$1([View.dispose()],SnaplineImpl.prototype,"dispose",null);const content$1=".x6-widget-snapline {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n pointer-events: none;\n}\n.x6-widget-snapline-vertical,\n.x6-widget-snapline-horizontal {\n stroke: #2ecc71;\n stroke-width: 1px;\n}\n";Graph.prototype.isSnaplineEnabled=function(){const e=this.getPlugin("snapline");return!!e&&e.isEnabled()},Graph.prototype.enableSnapline=function(){const e=this.getPlugin("snapline");return e&&e.enable(),this},Graph.prototype.disableSnapline=function(){const e=this.getPlugin("snapline");return e&&e.disable(),this},Graph.prototype.toggleSnapline=function(){const e=this.getPlugin("snapline");return e&&e.toggleEnabled(),this},Graph.prototype.hideSnapline=function(){const e=this.getPlugin("snapline");return e&&e.hide(),this},Graph.prototype.setSnaplineFilter=function(e){const t=this.getPlugin("snapline");return t&&t.setFilter(e),this},Graph.prototype.isSnaplineOnResizingEnabled=function(){const e=this.getPlugin("snapline");return!!e&&e.isOnResizingEnabled()},Graph.prototype.enableSnaplineOnResizing=function(){const e=this.getPlugin("snapline");return e&&e.enableOnResizing(),this},Graph.prototype.disableSnaplineOnResizing=function(){const e=this.getPlugin("snapline");return e&&e.disableOnResizing(),this},Graph.prototype.toggleSnaplineOnResizing=function(e){const t=this.getPlugin("snapline");return t&&t.toggleOnResizing(e),this},Graph.prototype.isSharpSnapline=function(){const e=this.getPlugin("snapline");return!!e&&e.isSharp()},Graph.prototype.enableSharpSnapline=function(){const e=this.getPlugin("snapline");return e&&e.enableSharp(),this},Graph.prototype.disableSharpSnapline=function(){const e=this.getPlugin("snapline");return e&&e.disableSharp(),this},Graph.prototype.toggleSharpSnapline=function(e){const t=this.getPlugin("snapline");return t&&t.toggleSharp(e),this},Graph.prototype.getSnaplineTolerance=function(){const e=this.getPlugin("snapline");if(e)return e.getTolerance()},Graph.prototype.setSnaplineTolerance=function(e){const t=this.getPlugin("snapline");return t&&t.setTolerance(e),this};var __decorate=function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a};class Snapline extends Disposable{constructor(e={}){super(),this.name="snapline",this.options=Object.assign({enabled:!0,tolerance:10},e),ensure(this.name,content$1)}init(e){this.snaplineImpl=new SnaplineImpl(Object.assign(Object.assign({},this.options),{graph:e}))}isEnabled(){return!this.snaplineImpl.disabled}enable(){this.snaplineImpl.enable()}disable(){this.snaplineImpl.disable()}toggleEnabled(e){if(null==e)return this.isEnabled()?this.disable():this.enable(),this;e!==this.isEnabled()&&(e?this.enable():this.disable())}hide(){return this.snaplineImpl.hide(),this}setFilter(e){return this.snaplineImpl.setFilter(e),this}isOnResizingEnabled(){return!0===this.snaplineImpl.options.resizing}enableOnResizing(){return this.snaplineImpl.options.resizing=!0,this}disableOnResizing(){return this.snaplineImpl.options.resizing=!1,this}toggleOnResizing(e){return null!=e?e!==this.isOnResizingEnabled()&&(e?this.enableOnResizing():this.disableOnResizing()):this.isOnResizingEnabled()?this.disableOnResizing():this.enableOnResizing(),this}isSharp(){return!0===this.snaplineImpl.options.sharp}enableSharp(){return this.snaplineImpl.options.sharp=!0,this}disableSharp(){return this.snaplineImpl.options.sharp=!1,this}toggleSharp(e){return null!=e?e!==this.isSharp()&&(e?this.enableSharp():this.disableSharp()):this.isSharp()?this.disableSharp():this.enableSharp(),this}getTolerance(){return this.snaplineImpl.options.tolerance}setTolerance(e){return this.snaplineImpl.options.tolerance=e,this}captureCursorOffset(e){this.snaplineImpl.captureCursorOffset(e)}snapOnMoving(e){this.snaplineImpl.snapOnMoving(e)}dispose(){this.snaplineImpl.dispose(),clean(this.name)}}__decorate([Disposable.dispose()],Snapline.prototype,"dispose",null);let nanoid=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_","");const CellPanel=e=>{var t,r,n,i,o,a,s,l,c,u,d;const{cell:p,graph:h}=e,[f,g]=React.useState(p.prop());React.useEffect(()=>{},[f]),React.useEffect(()=>{g(p.prop());const e=e=>{const t={...e.cell.prop()};g(t)};return p.on("changed",e),()=>{p.off("changed",e)}},[p]);const m=(e,t)=>{p.prop(e,t)};let v=0,y=0;"edge"===f.shape&&([v,y]=calculateDistanceAndAngle([f.source.x,f.source.y],[f.target.x,f.target.y]));let b="";b="edge"===f.shape?(null==(i=null==(n=null==(r=null==(t=f.labels)?void 0:t[0])?void 0:r.attrs)?void 0:n.label)?void 0:i.text)||"":(null==(a=null==(o=f.attrs)?void 0:o.text)?void 0:a.text)||"";let q=0;return q="edge"===f.shape?(null==(u=null==(c=null==(l=null==(s=f.labels)?void 0:s[0])?void 0:l.attrs)?void 0:c.text)?void 0:u.fontSize)||14:null==(d=f.attrs)?void 0:d.text.fontSize,jsxRuntimeExports.jsxs("div",{className:"cell-panel",children:[jsxRuntimeExports.jsx(PanelOne,{title:"大小"}),"rect"===f.shape||"text"===f.shape?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs(Space,{size:20,children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PanelTwo,{title:"宽"}),jsxRuntimeExports.jsx(TypedInputNumber,{style:{marginBottom:"24px"},min:0,max:360,value:f.size.width,onChange:e=>{m("size/width",e)}})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(PanelTwo,{title:"高"}),jsxRuntimeExports.jsx(TypedInputNumber,{style:{marginBottom:"24px"},min:0,max:360,value:f.size.height,onChange:e=>{m("size/height",e)}})]})]})}):"circle"===f.shape?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(PanelTwo,{title:"半径"}),jsxRuntimeExports.jsx(TypedInputNumber,{style:{marginBottom:"24px"},value:f.size.width,min:0,onChange:e=>{m("size",{width:e,height:e})}})]}):"edge"===f.shape?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(PanelTwo,{title:"长"}),jsxRuntimeExports.jsx(TypedInputNumber,{style:{marginBottom:"24px"},value:v,min:0,onChange:e=>{const[t,r]=calculateEndPoint([f.source.x,f.source.y],y,e);m("target",{x:t,y:r})}})]}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}),jsxRuntimeExports.jsx(PanelOne,{title:"旋转"}),jsxRuntimeExports.jsx(PanelTwo,{title:"角度"}),jsxRuntimeExports.jsx(TypedInputNumber,{style:{marginBottom:"24px"},min:0,max:360,value:"edge"===f.shape?y:f.angle,onChange:e=>{if("edge"===f.shape){const[t,r]=calculateEndPoint([f.source.x,f.source.y],e,v);return void m("target",{x:t,y:r})}m("angle",e)}}),jsxRuntimeExports.jsx(PanelOne,{title:"文本"}),jsxRuntimeExports.jsx(PanelTwo,{title:"内容"}),jsxRuntimeExports.jsx(Input.TextArea,{style:{resize:"none",height:"100px",marginBottom:"16px",background:"#f7f8fa"},value:b,onChange:e=>{const t=e.target.value;"edge"!==f.shape?m("attrs/text/text",t):f.labels?p.setLabelAt(0,t):p.appendLabel({attrs:{text:{text:t}}})}}),jsxRuntimeExports.jsx(PanelTwo,{title:"字号"}),jsxRuntimeExports.jsx(TypedInputNumber,{style:{marginBottom:"16px"},value:q,min:0,onChange:e=>{"edge"!==f.shape||null==e?m("attrs/text/fontSize",e):f.labels?p.setLabelAt(0,{attrs:{label:{text:b},text:{fontSize:e}}}):p.appendLabel({attrs:{label:{text:b},text:{fontSize:e}}})}})]})},PanelOne=e=>{const{title:t}=e;return jsxRuntimeExports.jsx("div",{className:"cell-panel-one",children:t})},PanelTwo=e=>{const{title:t}=e;return jsxRuntimeExports.jsx("div",{className:"cell-panel-two",children:t})};function calculateDistanceAndAngle(e,t){const[r,n]=e,[i,o]=t,a=Math.sqrt(Math.pow(i-r,2)+Math.pow(o-n,2));let s=Math.atan2(o-n,i-r)*(180/Math.PI);s<0&&(s+=360);return[Math.floor(a),Math.floor(s)]}function calculateEndPoint(e,t,r){const[n,i]=e,o=t*(Math.PI/180),a=n+r*Math.cos(o),s=i+r*Math.sin(o);return[Math.round(a),Math.round(s)]}const{Text:Text}=Typography,KeyBordModal=e=>{const{children:t}=e;return jsxRuntimeExports.jsx(Popover,{arrow:!1,trigger:"click",rootClassName:"drawx6-keybordermodal-pop",content:jsxRuntimeExports.jsx("div",{className:"drawx6-keybordermodal-pop-content",children:jsxRuntimeExports.jsx(List,{bordered:!1,dataSource:[{key:["Ctrl","C"],desc:"拷贝"},{key:["Ctrl","V"],desc:"粘贴"},{key:["Ctrl","X"],desc:"剪切"},{key:["Ctrl","Z"],desc:"撤销"},{key:["Ctrl","Shift","Z"],desc:"重做"},{key:["BackSpace"],desc:"删除"},{key:["Ctrl","鼠标拖动"],desc:"平移"},{key:["Ctrl","鼠标滚轮"],desc:"缩放"}],renderItem:(e,t)=>jsxRuntimeExports.jsx(List.Item,{children:jsxRuntimeExports.jsxs(Space,{style:{display:"flex",justifyContent:"space-between",width:"100%"},children:[jsxRuntimeExports.jsx(Space,{size:6,children:e.key.map((e,t,r)=>jsxRuntimeExports.jsxs(React.Fragment,{children:[jsxRuntimeExports.jsx(Tag,{style:{marginRight:0},children:e}),t<r.length-1&&"+"]},t))}),jsxRuntimeExports.jsx(Text,{strong:!0,children:e.desc})]})},t)})}),children:t})},content=".x6-widget-edgednd {\n position: absolute;\n top: -10000px;\n left: -10000px;\n z-index: 999999;\n display: none;\n cursor: move;\n opacity: 0.7;\n pointer-events: 'cursor';\n }\n .x6-widget-edgednd.dragging {\n display: inline-block;\n }\n .x6-widget-edgednd.dragging * {\n pointer-events: none !important;\n }\n .x6-widget-edgednd .x6-graph {\n background: transparent;\n box-shadow: none;\n }\n ",_EdgeDnd=class e extends View{constructor(e){super(),__publicField(this,"name","edgednd"),__publicField(this,"options"),__publicField(this,"draggingGraph"),__publicField(this,"sourceEdge"),__publicField(this,"draggingEdge"),__publicField(this,"length",0),__publicField(this,"draggingBBox"),__publicField(this,"geometryBBox"),__publicField(this,"draggingView"),__publicField(this,"delta"),__publicField(this,"padding"),__publicField(this,"snapOffset"),__publicField(this,"originOffset"),this.options={...e,getDragEdge:e=>e.clone(),getDropEdge:e=>e.clone()},this.init()}get targetGraph(){return this.options.target}get targetModel(){return this.targetGraph.model}init(){ensure(this.name,content),this.container=document.createElement("div"),addClass(this.container,this.prefixClassName("widget-edgednd")),this.draggingGraph=new Graph({...this.options.delegateGraphOptions,container:document.createElement("div"),width:1,height:1,async:!1}),append(this.container,this.draggingGraph.container)}start(t,r,n){const i=n;i.preventDefault(),this.length=r,this.targetModel.startBatch("edgednd"),addClass(this.container,"dragging"),appendTo(this.container,this.options.draggingContainer||document.body),this.sourceEdge=t,this.prepareDragging(t,i.clientX,i.clientY),this.updateNodePosition(i.clientX,i.clientY),this.delegateDocumentEvents(e.documentEvents,i.data)}prepareDragging(e,t,r){const n=this.draggingGraph,i=n.model,o=this.options.getDragEdge(e);o.setSource({x:0,y:0}),o.setTarget({x:0+this.length,y:0});n.scale(1,1),this.clearDragging(),i.resetCells([o]);const a=n.findViewByCell(o);a.undelegateEvents(),a.cell.off("changed"),n.fitToContent({padding:5,allowNewOrigin:"any",useCellGeometry:!1});const s=a.getBBox();this.geometryBBox=a.getBBox({useCellGeometry:!0}),this.delta=this.geometryBBox.getTopLeft().diff(s.getTopLeft()),this.draggingEdge=o,this.draggingView=a,this.draggingBBox=o.getBBox(),this.padding=5,this.originOffset=this.updateGraphPosition(t,r)}clearDragging(){this.draggingEdge&&(this.sourceEdge=null,this.draggingEdge.remove(),this.draggingEdge=null,this.draggingView=null,this.delta=null,this.padding=null,this.snapOffset=null,this.originOffset=null,this.undelegateDocumentEvents())}updateGraphPosition(e,t){const r=document.body.scrollTop||document.documentElement.scrollTop,n=document.body.scrollLeft||document.documentElement.scrollLeft,i=this.delta,o=this.geometryBBox,a=this.padding||5,s={left:e-i.x-o.width/2-a+n,top:t-i.y-o.height/2-a+r};return this.draggingGraph&&css$3(this.container,{left:`${s.left}px`,top:`${s.top}px`}),s}updateNodePosition(e,t){const r=this.targetGraph.clientToLocal(e,t),n=this.draggingBBox;return r.x-=n.width/2,r.y-=n.height/2,this.draggingEdge.setSource({x:r.x,y:r.y}),this.draggingEdge.setTarget({x:r.x+this.length,y:r.y}),r}onDragging(e){if(this.draggingView){e.preventDefault();const t=this.normalizeEvent(e),r=t.clientX,n=t.clientY;this.updateGraphPosition(r,n),this.updateNodePosition(r,n)}}onDragEnd(e){const t=this.draggingEdge;if(t){const r=this.normalizeEvent(e);this.draggingView;const n=this.draggingBBox,i=this.snapOffset;let o=n.x,a=n.y;i&&(o+=i.x,a+=i.y),t.setSource({x:o,y:a}),t.setTarget({x:o+this.length,y:a});(e=>{e?this.onDropped(e):this.onDropInvalid(),this.targetModel.stopBatch("edgednd")})(this.drop(t,{x:r.clientX,y:r.clientY}))}}drop(e,t){if(this.isInsideValidArea(t)){const r=this.targetGraph,n=r.model,i=r.clientToLocal(t),o=this.options.getDropEdge(e),a=o.getBBox();i.x+=a.x-a.width/2,i.y+=a.y-a.height/2;const s=this.snapOffset?1:r.getGridSize(),l=GeometryUtil.snapToGrid(i.x,s),c=GeometryUtil.snapToGrid(i.y,s);return o.setSource({x:l,y:c}),o.setTarget({x:l+this.length,y:c}),o.removeZIndex(),n.addCell(o,{stencil:this.cid}),o}return null}isInsideValidArea(e){let t;const r=this.targetGraph;return t=this.getDropArea(r.container),t&&t.containsPoint(e)}getDropArea(e){const t=offset$1(e),r=document.body.scrollTop||document.documentElement.scrollTop,n=document.body.scrollLeft||document.documentElement.scrollLeft;return Rectangle.create({x:t.left+parseInt(css$3(e,"border-left-width"),10)-n,y:t.top+parseInt(css$3(e,"border-top-width"),10)-r,width:e.clientWidth,height:e.clientHeight})}onDropInvalid(){const e=this.draggingEdge;e&&this.onDropped(e)}onDropped(e){this.clearDragging(),removeClass(this.container,"dragging"),remove(this.container)}onRemove(){this.draggingGraph&&(this.draggingGraph.view.remove(),this.draggingGraph.dispose())}dispose(){this.remove(),clean(this.name)}};__publicField(_EdgeDnd,"documentEvents",{mousemove:"onDragging",touchmove:"onDragging",mouseup:"onDragEnd",touchend:"onDragEnd",touchcancel:"onDragEnd"});let EdgeDnd=_EdgeDnd;const activeColor="#1677ff",normalColor="#999999",ports={groups:{top:{position:"top",attrs:{circle:{magnet:!0,stroke:normalColor,r:5,style:{visibility:"hidden"}}}},right:{position:"right",attrs:{circle:{magnet:!0,stroke:normalColor,r:5,style:{visibility:"hidden"}}}},bottom:{position:"bottom",attrs:{circle:{magnet:!0,stroke:normalColor,r:5,style:{visibility:"hidden"}}}},left:{position:"left",attrs:{circle:{magnet:!0,stroke:normalColor,r:5,style:{visibility:"hidden"}}}}},items:[{group:"top"},{group:"right"},{group:"bottom"},{group:"left"}]},Editor=React.forwardRef((e,t)=>{const{value:r,onSave:n,onExit:i,savePngType:o="url",editabled:a=!0,showSaveBtn:s=!0}=e,{topProps:l}=useQuestionContext(),{uploadImg:c}=l,u=React.useRef(null),d=React.useRef(null),p=React.useRef(null),h=React.useRef(null),[f,g]=React.useState(!1),[m,v]=React.useState(null),[y,b]=React.useState(!1);React.useEffect(()=>(u.current&&q(u.current),()=>{var e;null==(e=d.current)||e.dispose()}),[]),React.useEffect(()=>{var e;(null==r?void 0:r.cells)&&(null==(e=d.current)||e.fromJSON(r.cells))},[r]);const q=e=>{d.current=new Graph({container:e,autoResize:!0,background:{color:"#ffffff"},grid:{visible:!0,size:10,type:"dot",args:{color:"#a0a0a0",thickness:1}},panning:{enabled:!0,modifiers:["ctrl","meta"]},mousewheel:{enabled:!0,zoomAtMousePosition:!0,modifiers:["ctrl","meta"],minScale:.5,maxScale:3},interacting:a,connecting:{createEdge:()=>new Edge({attrs:{line:{stroke:"#333333",strokeWidth:2,targetMarker:{name:"block",width:12,height:8}}},tools:["edge-editor"]})},highlighting:{magnetAdsorbed:{name:"stroke",args:{attrs:{"stroke-width":1,stroke:activeColor}}}}}),S(d.current),V(d.current),E(d.current),x(d.current)},V=e=>{e.use(new Export),e.use(new Transform({resizing:{enabled:!0,preserveAspectRatio:e=>"circle"===e.shape},rotating:!0})),e.use(new Selection({rubberband:!0,showNodeSelectionBox:!0})),e.use(new Snapline({className:"x6-snapline-color"})),e.use(new Keyboard),e.use(new Clipboard),e.use(new History)},S=e=>{p.current=new Dnd({target:e}),h.current=new EdgeDnd({target:e})},E=e=>{const t=(e,t)=>{for(let r=0,n=e.length;r<n;r+=1)e[r].style.visibility=t?"visible":"hidden"};e.on("node:mouseenter",({e:e,node:r,view:n})=>{const i=u.current.querySelectorAll(".x6-port-body");t(i,!0)}),e.on("node:mouseleave",({e:e,node:r,view:n})=>{const i=u.current.querySelectorAll(".x6-port-body");t(i,!1)}),e.on("cell:click",({e:e,x:t,y:r,cell:n,view:i})=>{"edge"!==n.shape&&(g(!0),v(n))}),e.on("blank:click",({e:e,x:t,y:r})=>{g(!1),v(null)})},x=e=>{e.bindKey(["meta+c","ctrl+c"],()=>{const t=e.getSelectedCells();return t.length&&e.copy(t,{deep:!0}),!1}),e.bindKey(["meta+x","ctrl+x"],()=>{const t=e.getSelectedCells();return t.length&&e.cut(t,{deep:!0}),!1}),e.bindKey(["meta+v","ctrl+v"],()=>{if(!e.isClipboardEmpty()){const t=e.paste({offset:32});e.cleanSelection(),e.select(t)}return!1}),e.bindKey(["meta+z","ctrl+z"],()=>(e.canUndo()&&e.undo(),!1)),e.bindKey(["meta+shift+z","ctrl+shift+z"],()=>(e.canRedo()&&e.redo(),!1)),e.bindKey("backspace",()=>{const t=e.getSelectedCells();t.length&&e.removeCells(t)})},C=e=>{let t=null;switch(e.currentTarget.getAttribute("data-type")){case"rect":t=d.current.createNode({width:80,height:40,shape:"rect",label:"矩形",attrs:{body:{stroke:normalColor,strokeWidth:1,fill:"#fff"}},ports:{...ports},tools:["node-editor"]});break;case"circle":t=d.current.createNode({width:60,height:60,shape:"circle",label:"圆形",attrs:{body:{stroke:normalColor,strokeWidth:1,fill:"#fff"}},ports:{...ports},tools:["node-editor"]});break;case"text":t=d.current.createNode({width:80,height:40,shape:"text",tools:["node-editor"]});break;case"hori-line":t=d.current.createEdge({attrs:{line:{stroke:"#333333",strokeWidth:2,targetMarker:null,sourceMarker:null}},tools:[{name:"edge-editor",args:{labelAddable:!0}},{name:"source-arrowhead",args:{attrs:{fill:"transparent",stroke:"transparent"}}},{name:"target-arrowhead",args:{attrs:{fill:"transparent",stroke:"transparent"}}}]});break;case"arrow":t=d.current.createEdge({attrs:{line:{stroke:"#333333",strokeWidth:2,targetMarker:{name:"block",width:12,height:8}}},tools:["edge-editor",{name:"source-arrowhead",args:{attrs:{fill:"transparent",stroke:"transparent"}}},{name:"target-arrowhead",args:{attrs:{fill:"transparent",stroke:"transparent"}}}]})}t&&(t.isNode()?p.current.start(t,e.nativeEvent):h.current.start(t,100,e.nativeEvent))},w=async()=>new Promise(e=>{var t,r;const n=null==(t=d.current)?void 0:t.toJSON();null==(r=d.current)||r.toPNG(t=>{e({json:n,png:t})},{padding:20,copyStyles:!1})}),R=async(e=!1)=>{if(e){b(!0);const e=await w();if("url"===o){const t=A(e.png),r=new FormData;r.append("file",t);const n=await(null==c?void 0:c({file:r}).catch(()=>{}));(null==n?void 0:n.url)&&(e.png=n.url)}null==n||n(e),b(!1)}null==i||i()},A=e=>{const t=e.replace(/^data:image\/png;base64,/,""),r=atob(t),n=r.length,i=new ArrayBuffer(n),o=new Uint8Array(i);for(let l=0;l<n;l++)o[l]=r.charCodeAt(l);const a=new Blob([i],{type:"image/png"}),s=`${nanoid()}.png`;return new File([a],s,{type:"image/png"})};return React.useImperativeHandle(t,()=>({getGraphInstance:()=>d.current,getData:async()=>{const e=await w();if("url"===o){const t=A(e.png),r=new FormData;r.append("file",t);const n=await(null==c?void 0:c({file:r}).catch(()=>{}));(null==n?void 0:n.url)&&(e.png=n.url)}return e}})),jsxRuntimeExports.jsxs("div",{className:classNames("drawx6","drawx6-editor"),children:[jsxRuntimeExports.jsxs("div",{className:"drawx6-editor-header drawx6-space",children:[jsxRuntimeExports.jsx("div",{children:"画板"}),jsxRuntimeExports.jsxs(Space,{size:10,children:[jsxRuntimeExports.jsx(Button$1,{ghost:!0,type:"primary",onClick:()=>R(!1),children:"仅退出"}),s&&jsxRuntimeExports.jsx(Button$1,{loading:y,type:"primary",onClick:()=>R(!0),children:"保存并退出"})]})]}),jsxRuntimeExports.jsxs("div",{className:"drawx6-editor-container",children:[jsxRuntimeExports.jsx("div",{style:{width:"100%",height:"100%"},children:jsxRuntimeExports.jsx("div",{ref:u,className:"drawx6-container"})}),jsxRuntimeExports.jsxs("div",{className:"drawx6-editor-container-nav drawx6-overflow-y",children:[jsxRuntimeExports.jsxs("div",{className:"nav-item drawx6-space","data-type":"rect",onMouseDown:C,children:[jsxRuntimeExports.jsx("div",{className:"graph-rect"}),jsxRuntimeExports.jsx("span",{className:"nav-item-title",children:"矩形"})]}),jsxRuntimeExports.jsxs("div",{className:"nav-item drawx6-space","data-type":"circle",onMouseDown:C,children:[jsxRuntimeExports.jsx("div",{className:"graph-circle"}),jsxRuntimeExports.jsx("span",{className:"nav-item-title",children:"圆形"})]}),jsxRuntimeExports.jsxs("div",{className:"nav-item drawx6-space","data-type":"text",onMouseDown:C,children:[jsxRuntimeExports.jsx(TextSvg,{}),jsxRuntimeExports.jsx("span",{className:"nav-item-title",children:"文本"})]}),jsxRuntimeExports.jsxs("div",{className:"nav-item drawx6-space","data-type":"hori-line",onMouseDown:C,children:[jsxRuntimeExports.jsx(LineSvg,{}),jsxRuntimeExports.jsx("span",{className:"nav-item-title",children:"水平线"})]}),jsxRuntimeExports.jsxs("div",{className:"nav-item drawx6-space","data-type":"arrow",onMouseDown:C,children:[jsxRuntimeExports.jsx(ArrawSvg,{}),jsxRuntimeExports.jsx("span",{className:"nav-item-title",children:"箭头"})]}),jsxRuntimeExports.jsx(KeyBordModal,{children:jsxRuntimeExports.jsxs("div",{className:"nav-item drawx6-space",style:{cursor:"default"},children:[jsxRuntimeExports.jsx(KeyBoard,{}),jsxRuntimeExports.jsx("span",{className:"nav-item-title",children:"快捷键"})]})})]}),jsxRuntimeExports.jsx(Popconfirm,{title:null,description:jsxRuntimeExports.jsxs("div",{style:{marginTop:"-4px"},children:["确认清空画板?清空后无法恢复,",jsxRuntimeExports.jsx("br",{}),"请谨慎操作。"]}),onConfirm:()=>{var e;null==(e=d.current)||e.clearCells()},placement:"bottomRight",arrow:!1,children:jsxRuntimeExports.jsx("div",{className:"drawx6-editor-container-clear drawx6-center",style:{right:f?"220px":"20px"},children:jsxRuntimeExports.jsx(ClearSvg,{})})}),f&&jsxRuntimeExports.jsx("div",{className:"drawx6-editor-container-control drawx6-overflow-y",children:jsxRuntimeExports.jsx(CellPanel,{cell:m,graph:d.current})})]})]})}),TextSvg=()=>jsxRuntimeExports.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("g",{clipPath:"url(#clip0_6137_1319)",children:jsxRuntimeExports.jsx("path",{d:"M13.5394 28.9231H12.3086C11.9394 28.9231 11.6932 29.1692 11.6932 29.5385C11.6932 29.9077 11.9394 30.1539 12.3086 30.1539H13.5394C13.9086 30.1539 14.1547 29.9077 14.1547 29.5385C14.1547 29.1692 13.9086 28.9231 13.5394 28.9231ZM6.15475 28.9231H4.92398C4.8009 28.9231 4.67782 28.9846 4.61629 29.0462V28.3077C4.61629 27.8154 4.18552 27.3846 3.69321 27.3846H1.23167C0.739363 27.3846 0.308594 27.8154 0.308594 28.3077V30.7692C0.308594 31.2615 0.739363 31.6923 1.23167 31.6923H3.69321C4.18552 31.6923 4.61629 31.2615 4.61629 30.7692V30.0308C4.67782 30.0923 4.8009 30.1539 4.92398 30.1539H6.15475C6.52398 30.1539 6.77013 29.9077 6.77013 29.5385C6.77013 29.1692 6.52398 28.9231 6.15475 28.9231ZM3.07782 6.15385C3.07782 5.78462 2.83167 5.53846 2.46244 5.53846C2.09321 5.53846 1.84706 5.78462 1.84706 6.15385V7.38462C1.84706 7.75385 2.09321 8 2.46244 8C2.83167 8 3.07783 7.75385 3.07782 7.38462V6.15385ZM9.84706 28.9231H8.61629C8.24706 28.9231 8.0009 29.1692 8.0009 29.5385C8.0009 29.9077 8.24706 30.1539 8.61629 30.1539H9.84706C10.2163 30.1539 10.4624 29.9077 10.4624 29.5385C10.4624 29.1692 10.2163 28.9231 9.84706 28.9231ZM7.38552 1.84616H6.15475C5.78552 1.84616 5.53936 2.09231 5.53936 2.46154C5.53936 2.83077 5.78552 3.07692 6.15475 3.07692H7.38552C7.75475 3.07692 8.0009 2.83077 8.0009 2.46154C8.0009 2.09231 7.75475 1.84616 7.38552 1.84616ZM3.07782 17.2308C3.07782 16.8615 2.83167 16.6154 2.46244 16.6154C2.09321 16.6154 1.84706 16.8615 1.84706 17.2308V18.4615C1.84706 18.8308 2.09321 19.0769 2.46244 19.0769C2.83167 19.0769 3.07783 18.8308 3.07782 18.4615V17.2308ZM3.07782 20.9231C3.07782 20.5539 2.83167 20.3077 2.46244 20.3077C2.09321 20.3077 1.84706 20.5539 1.84706 20.9231V22.1539C1.84706 22.5231 2.09321 22.7692 2.46244 22.7692C2.83167 22.7692 3.07783 22.5231 3.07782 22.1539V20.9231ZM3.07782 9.84616C3.07782 9.47693 2.83167 9.23077 2.46244 9.23077C2.09321 9.23077 1.84706 9.47693 1.84706 9.84616V11.0769C1.84706 11.4462 2.09321 11.6923 2.46244 11.6923C2.83167 11.6923 3.07783 11.4462 3.07782 11.0769V9.84616ZM13.5394 3.07692H14.7701C15.1394 3.07692 15.3855 2.83077 15.3855 2.46154C15.3855 2.09231 15.1394 1.84616 14.7701 1.84616H13.5394C13.1701 1.84616 12.924 2.09231 12.924 2.46154C12.924 2.83077 13.1701 3.07692 13.5394 3.07692ZM2.46244 24C2.09321 24 1.84706 24.2462 1.84706 24.6154V25.8462C1.84706 26.2154 2.09321 26.4615 2.46244 26.4615C2.83167 26.4615 3.07783 26.2154 3.07782 25.8462V24.6154C3.07782 24.2462 2.83167 24 2.46244 24ZM3.07782 13.5385C3.07782 13.1692 2.83167 12.9231 2.46244 12.9231C2.09321 12.9231 1.84706 13.1692 1.84706 13.5385V14.7692C1.84706 15.1385 2.09321 15.3846 2.46244 15.3846C2.83167 15.3846 3.07783 15.1385 3.07782 14.7692V13.5385ZM20.924 3.07692H22.1548C22.524 3.07692 22.7701 2.83077 22.7701 2.46154C22.7701 2.09231 22.524 1.84616 22.1548 1.84616H20.924C20.5548 1.84616 20.3086 2.09231 20.3086 2.46154C20.3086 2.83077 20.5548 3.07692 20.924 3.07692ZM28.924 20.9231C28.924 21.2923 29.1701 21.5385 29.5394 21.5385C29.9086 21.5385 30.1548 21.2923 30.1548 20.9231V19.6923C30.1548 19.3231 29.9086 19.0769 29.5394 19.0769C29.1701 19.0769 28.924 19.3231 28.924 19.6923V20.9231ZM29.5394 10.4615C29.9086 10.4615 30.1548 10.2154 30.1548 9.84616V8.61539C30.1548 8.24616 29.9086 8 29.5394 8C29.1701 8 28.924 8.24616 28.924 8.61539V9.84616C28.924 10.2154 29.1701 10.4615 29.5394 10.4615ZM28.924 17.2308C28.924 17.6 29.1701 17.8462 29.5394 17.8462C29.9086 17.8462 30.1548 17.6 30.1548 17.2308V16C30.1548 15.6308 29.9086 15.3846 29.5394 15.3846C29.1701 15.3846 28.924 15.6308 28.924 16V17.2308ZM28.924 24.6154C28.924 24.9846 29.1701 25.2308 29.5394 25.2308C29.9086 25.2308 30.1548 24.9846 30.1548 24.6154V23.3846C30.1548 23.0154 29.9086 22.7692 29.5394 22.7692C29.1701 22.7692 28.924 23.0154 28.924 23.3846V24.6154ZM9.84706 3.07692H11.0778C11.4471 3.07692 11.6932 2.83077 11.6932 2.46154C11.6932 2.09231 11.4471 1.84616 11.0778 1.84616H9.84706C9.47783 1.84616 9.23167 2.09231 9.23167 2.46154C9.23167 2.83077 9.47783 3.07692 9.84706 3.07692ZM17.2317 28.9231H16.0009C15.6317 28.9231 15.3855 29.1692 15.3855 29.5385C15.3855 29.9077 15.6317 30.1539 16.0009 30.1539H17.2317C17.6009 30.1539 17.8471 29.9077 17.8471 29.5385C17.8471 29.1692 17.6009 28.9231 17.2317 28.9231ZM20.924 28.9231H19.6932C19.324 28.9231 19.0778 29.1692 19.0778 29.5385C19.0778 29.9077 19.324 30.1539 19.6932 30.1539H20.924C21.2932 30.1539 21.5394 29.9077 21.5394 29.5385C21.5394 29.1692 21.2932 28.9231 20.924 28.9231ZM24.6163 28.9231H23.3855C23.0163 28.9231 22.7701 29.1692 22.7701 29.5385C22.7701 29.9077 23.0163 30.1539 23.3855 30.1539H24.6163C24.9855 30.1539 25.2317 29.9077 25.2317 29.5385C25.2317 29.1692 24.9855 28.9231 24.6163 28.9231ZM17.2317 3.07692H18.4624C18.8317 3.07692 19.0778 2.83077 19.0778 2.46154C19.0778 2.09231 18.8317 1.84616 18.4624 1.84616H17.2317C16.8624 1.84616 16.6163 2.09231 16.6163 2.46154C16.6163 2.83077 16.8624 3.07692 17.2317 3.07692ZM28.924 13.5385C28.924 13.9077 29.1701 14.1538 29.5394 14.1538C29.9086 14.1538 30.1548 13.9077 30.1548 13.5385V12.3077C30.1548 11.9385 29.9086 11.6923 29.5394 11.6923C29.1701 11.6923 28.924 11.9385 28.924 12.3077V13.5385ZM25.8471 1.84616H24.6163C24.2471 1.84616 24.0009 2.09231 24.0009 2.46154C24.0009 2.83077 24.2471 3.07692 24.6163 3.07692H25.8471C26.2163 3.07692 26.4624 2.83077 26.4624 2.46154C26.4624 2.09231 26.2163 1.84616 25.8471 1.84616ZM17.6624 24V10.7692H22.7701V8H9.23167V10.7692H14.4624V24H17.6624ZM1.23167 4.61539H3.69321C4.18552 4.61539 4.61629 4.18462 4.61629 3.69231V1.23077C4.61629 0.738463 4.18552 0.307693 3.69321 0.307693H1.23167C0.739363 0.307693 0.308594 0.738463 0.308594 1.23077V3.69231C0.308594 4.18462 0.739363 4.61539 1.23167 4.61539ZM30.7701 0.307693H28.3086C27.8163 0.307693 27.3855 0.738463 27.3855 1.23077V3.69231C27.3855 4.18462 27.8163 4.61539 28.3086 4.61539H29.0471C28.9855 4.67692 28.924 4.8 28.924 4.92308V6.15385C28.924 6.52308 29.1701 6.76923 29.5394 6.76923C29.9086 6.76923 30.1548 6.52308 30.1548 6.15385V4.92308C30.1548 4.8 30.0932 4.67692 30.0317 4.61539H30.7701C31.2624 4.61539 31.6932 4.18462 31.6932 3.69231V1.23077C31.6932 0.738463 31.2624 0.307693 30.7701 0.307693ZM30.7701 27.3846H30.1548V27.0769C30.1548 26.7077 29.9086 26.4615 29.5394 26.4615C29.1701 26.4615 28.924 26.7077 28.924 27.0769V27.3846H28.3086C27.8163 27.3846 27.3855 27.8154 27.3855 28.3077V28.9231H27.0778C26.7086 28.9231 26.4624 29.1692 26.4624 29.5385C26.4624 29.9077 26.7086 30.1539 27.0778 30.1539H27.3855V30.7692C27.3855 31.2615 27.8163 31.6923 28.3086 31.6923H30.7701C31.2624 31.6923 31.6932 31.2615 31.6932 30.7692V28.3077C31.6932 27.8154 31.2624 27.3846 30.7701 27.3846Z",fill:"#999999"})}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_6137_1319",children:jsxRuntimeExports.jsx("rect",{width:"32",height:"32",fill:"white"})})})]}),LineSvg=()=>jsxRuntimeExports.jsx("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M6.2069 18.6207V21.1034H0V14.8965H6.2069V17.3793H29.7931V14.8965H36V21.1034H29.7931V18.6207H6.2069Z",fill:"#999999"})}),ArrawSvg=()=>jsxRuntimeExports.jsx("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M35.1875 17.9118L25.1875 11.3857V17.2H0.8125V18.8H25.1875V24.6143L35.1875 17.9118Z",fill:"#999999"})}),ClearSvg=()=>jsxRuntimeExports.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M11.884 12.8993C11.884 13.3639 11.5054 13.7425 11.0408 13.7425H4.96411C4.74038 13.7425 4.52579 13.6537 4.3675 13.4956C4.2092 13.3375 4.12014 13.123 4.11988 12.8993V3.94589H11.884V12.8993ZM5.80735 2.43241C5.80735 2.33553 5.88248 2.25941 5.98035 2.25941H10.0344C10.1323 2.25941 10.2074 2.33553 10.2074 2.43241V2.94053H5.80735V2.43241ZM14.4138 2.94053H11.2128V2.43241C11.2128 1.78391 10.6839 1.25404 10.0344 1.25404H5.98035C5.66807 1.25483 5.3688 1.37923 5.14798 1.60004C4.92717 1.82086 4.80277 2.12013 4.80198 2.43241V2.94053H1.59015C1.45539 2.94053 1.32615 2.99406 1.23086 3.08935C1.13557 3.18464 1.08203 3.31389 1.08203 3.44865C1.08203 3.58341 1.13557 3.71265 1.23086 3.80794C1.32615 3.90323 1.45539 3.95677 1.59015 3.95677H3.10364V12.8993C3.10364 13.9264 3.93699 14.7578 4.96411 14.7578H11.0398C11.284 14.7579 11.5258 14.7099 11.7515 14.6166C11.9771 14.5233 12.1822 14.3864 12.3549 14.2139C12.5277 14.0413 12.6648 13.8364 12.7583 13.6108C12.8519 13.3853 12.9001 13.1435 12.9003 12.8993V3.94589H14.4128C14.6945 3.94589 14.9219 3.71852 14.9219 3.43777C14.9218 3.37159 14.9085 3.30609 14.8827 3.2451C14.857 3.18411 14.8194 3.12886 14.7721 3.08257C14.7248 3.03628 14.6688 2.99987 14.6072 2.97549C14.5457 2.9511 14.4799 2.93921 14.4138 2.94053ZM8.00195 12.2182C8.28271 12.2182 8.51007 11.9908 8.51007 11.71V6.30262C8.51007 6.16786 8.45654 6.03862 8.36125 5.94333C8.26596 5.84804 8.13672 5.7945 8.00195 5.7945C7.86719 5.7945 7.73795 5.84804 7.64266 5.94333C7.54737 6.03862 7.49383 6.16786 7.49383 6.30262V11.71C7.49383 11.9908 7.7212 12.2182 8.00195 12.2182ZM5.63435 12.2182C5.9151 12.2182 6.14247 11.9908 6.14247 11.71V6.30262C6.14247 6.16786 6.08894 6.03862 5.99365 5.94333C5.89836 5.84804 5.76911 5.7945 5.63435 5.7945C5.49959 5.7945 5.37035 5.84804 5.27506 5.94333C5.17977 6.03862 5.12623 6.16786 5.12623 6.30262V11.71C5.13612 11.9908 5.36349 12.2182 5.63435 12.2182ZM10.3696 12.2182C10.6513 12.2182 10.8787 11.9908 10.8787 11.71V6.30262C10.8787 6.23583 10.8655 6.16969 10.8399 6.10798C10.8144 6.04628 10.7769 5.99021 10.7297 5.94298C10.6825 5.89575 10.6264 5.85828 10.5647 5.83272C10.503 5.80716 10.4368 5.79401 10.3701 5.79401C10.3033 5.79401 10.2371 5.80716 10.1754 5.83272C10.1137 5.85828 10.0576 5.89575 10.0104 5.94298C9.96318 5.99021 9.92571 6.04628 9.90015 6.10798C9.87459 6.16969 9.86144 6.23583 9.86144 6.30262V11.71C9.86144 11.9908 10.0888 12.2182 10.3696 12.2182Z"})}),KeyBoard=()=>jsxRuntimeExports.jsx("svg",{width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{d:"M9.83398 4.15039C11.3405 4.15201 12.7852 4.75035 13.8506 5.81543C14.9161 6.88062 15.5156 8.32539 15.5176 9.83203V13.4824H20.4844V9.83594L20.4922 9.55371C20.5632 8.14986 21.152 6.81818 22.1504 5.81934C23.2155 4.75392 24.6596 4.15448 26.166 4.15234C27.6725 4.15384 29.1171 4.75238 30.1826 5.81738C31.2482 6.88257 31.8476 8.32733 31.8496 9.83398L31.8428 10.1152C31.7718 11.5193 31.1832 12.8516 30.1846 13.8506C29.1194 14.9161 27.6746 15.5156 26.168 15.5176H22.5176V20.4844H26.168C27.6743 20.4864 29.1185 21.0862 30.1836 22.1514C31.182 23.1499 31.7714 24.4812 31.8428 25.8848L31.8496 26.167C31.8479 27.6732 31.2494 29.1173 30.1846 30.1826C29.1194 31.2482 27.6746 31.8476 26.168 31.8496L25.8867 31.8428C24.4827 31.7718 23.1503 31.1832 22.1514 30.1846C21.0858 29.1194 20.4864 27.6746 20.4844 26.168V22.5176H15.5176V26.168L15.5098 26.4502C15.4383 27.8537 14.849 29.1851 13.8506 30.1836C12.7855 31.2486 11.3412 31.8466 9.83496 31.8486C8.32824 31.8474 6.88316 31.2496 5.81738 30.1846C4.75165 29.1194 4.15238 27.6748 4.15039 26.168L4.15723 25.8867C4.22817 24.4827 4.81682 23.1503 5.81543 22.1514C6.81394 21.1525 8.14594 20.5637 9.5498 20.4922L9.83203 20.4844H13.4824V15.5176H9.83594L9.55371 15.5098C8.14943 15.4392 6.81665 14.8511 5.81738 13.8525C4.75158 12.7874 4.15253 11.3427 4.15039 9.83594C4.15139 8.32878 4.74997 6.88336 5.81543 5.81738C6.81442 4.81806 8.14719 4.22829 9.55176 4.15723L9.83398 4.15039ZM9.68555 22.5225C7.74117 22.6014 6.18669 24.2064 6.18652 26.168C6.18652 28.1818 7.82394 29.8193 9.83594 29.8193C11.8497 29.8191 13.4863 28.1817 13.4863 26.168V22.5176H9.68555V22.5225ZM22.5176 26.168C22.5176 28.1817 24.1542 29.8192 26.168 29.8193C28.182 29.8193 29.8174 28.1817 29.8174 26.168C29.8172 24.1543 28.1799 22.5176 26.168 22.5176H22.5176V26.168ZM15.5176 20.4844H20.4844V15.5195H15.5176V20.4844ZM9.83594 6.18652C7.82195 6.18652 6.18652 7.82412 6.18652 9.83789C6.18673 11.8497 7.82412 13.4863 9.83594 13.4863H13.4863V9.83594C13.4863 7.82405 11.8496 6.18671 9.83594 6.18652ZM26.168 6.18652C24.1543 6.18669 22.5176 7.82404 22.5176 9.83594V13.4863H26.168C28.1818 13.4863 29.8172 11.8495 29.8174 9.83594C29.8174 7.82206 28.1818 6.18652 26.168 6.18652Z",fill:"#999999",stroke:"white",strokeWidth:"0.3"})}),Drawx6=React.forwardRef((e,t)=>{const{height:r="300px",maskTip:n="点击画板进入绘制",value:i,onSave:o,savePngType:a="url",showSaveBtn:s}=e,[l,c]=React.useState(!1),u=React.useRef(null);return React.useImperativeHandle(t,()=>{var e;return{getIsFullScreen:()=>l,getData:null==(e=u.current)?void 0:e.getData}}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Show,{height:r,value:i,maskTip:n,maskClick:()=>{c(!0)}}),l&&jsxRuntimeExports.jsx(Editor,{ref:u,value:i,savePngType:a,editabled:!0,onSave:o,onExit:()=>{c(!1)},showSaveBtn:s})]})}),Draw=e=>{const{status:t=QuestionStatus.EXAM,data:r,onSubmit:n}=e,[i,o]=React.useState(),a=React.useRef(null),s=(e,i=!0)=>{if("exam"!==t)return;const a={userAnswerOption:{content:null==e?void 0:e.json,photo:null==e?void 0:e.png},questionCode:null==r?void 0:r.questionCode};o(null==e?void 0:e.json),null==n||n(a),i&&staticMethods.success("保存成功")};return React.useEffect(()=>{if("exam"!==t)return;const e=async e=>{var t,r;const{type:n}=e.data??{};if("examTimeEnd5"===n&&(null==(t=a.current)?void 0:t.getIsFullScreen())){const e=await(null==(r=a.current)?void 0:r.getData());s(e,!1)}};return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[t]),React.useEffect(()=>{if(r){const{answerOption:e}=r;e&&!Array.isArray(e)&&o(null==e?void 0:e.content)}},[r,t]),jsxRuntimeExports.jsxs("div",{className:"draw-question",children:[jsxRuntimeExports.jsx("div",{className:"draw-question-title",children:jsxRuntimeExports.jsxs("div",{className:"draw-question-title-content",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsxs("span",{className:"score",children:[null==r?void 0:r.score,"分"]}),jsxRuntimeExports.jsx("span",{className:"type",children:"画图题"}),((null==r?void 0:r.hasAutoScore)??(null==r?void 0:r.judgeMode)===CCMJudgeMode.AI_AGENT)&&jsxRuntimeExports.jsx("span",{className:"auto",children:"自动判分"})]}),jsxRuntimeExports.jsx(RichEditor,{isBorder:!1,noPadding:!0,defaultValue:null==r?void 0:r.topic,readOnly:!0,autoHeight:{min:0,max:1e5}})]})}),jsxRuntimeExports.jsxs("div",{className:"draw-question-content",children:[jsxRuntimeExports.jsx(Drawx6,{ref:a,value:i,showSaveBtn:"mark"!==t&&"view"!==t,onSave:s,maskTip:"mark"===t||"view"===t?"点击画板查看答题":"点击画板进入答题"}),["add","mark"].includes(t)&&!!(null==r?void 0:r.judgeNorm)&&jsxRuntimeExports.jsx(Collapse,{defaultActiveKey:"add"===t?["1"]:[],ghost:!0,expandIcon:({isActive:e})=>jsxRuntimeExports.jsx(RefIcon$i,{rotate:e?90:0}),items:[{key:"1",label:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("span",{style:{fontWeight:"bold"},children:"判分标准"}),jsxRuntimeExports.jsx("span",{style:{fontSize:"12px",color:"#999999"},children:"(学生不可见)"})]}),children:jsxRuntimeExports.jsx(RichEditor,{isBorder:!1,readOnly:!0,defaultValue:r.judgeNorm,noPadding:!0,autoHeight:{min:0,max:1e4}})}]}),r.difficulty&&jsxRuntimeExports.jsx("div",{className:"draw-question-content-others",children:jsxRuntimeExports.jsxs("div",{className:"difficulty",children:[jsxRuntimeExports.jsx("span",{children:"题目难度:"}),jsxRuntimeExports.jsx("span",{children:difficultyMap[r.difficulty]})]})})]})]},null==r?void 0:r.questionCode)},Composite=e=>{var t;const{data:r}=e,{children:n,difficulty:i,topic:o,score:a}=r,[s,l]=React.useState([]),c=React.useRef(null);return React.useEffect(()=>{const e=null==n?void 0:n.map((e,t)=>(null==e?void 0:e.questionCode)||t);l(e)},[null==(t=null==r?void 0:r.children)?void 0:t.length]),jsxRuntimeExports.jsxs("div",{className:"composite",children:[jsxRuntimeExports.jsx("div",{className:"composite-title",children:jsxRuntimeExports.jsxs("div",{className:"composite-title-content",children:[jsxRuntimeExports.jsxs("div",{children:[a&&jsxRuntimeExports.jsxs("span",{className:"score",children:[a,"分"]}),jsxRuntimeExports.jsx("span",{className:"type",children:"组合题"}),(null==r?void 0:r.hasAutoScore)&&jsxRuntimeExports.jsx("span",{className:"auto",children:"自动判分"})]}),jsxRuntimeExports.jsx(RichEditor,{isBorder:!1,noPadding:!0,defaultValue:o,readOnly:!0,autoHeight:{min:0,max:1e5}})]})}),jsxRuntimeExports.jsxs("div",{className:"composite-content",children:[jsxRuntimeExports.jsx(Collapse,{activeKey:s,ghost:!0,ref:c,expandIcon:({isActive:e})=>jsxRuntimeExports.jsx(RefIcon$i,{rotate:e?90:0}),onChange:e=>{l(Array.isArray(e)?e:[e])},items:null==n?void 0:n.map((e,t)=>({key:(null==e?void 0:e.questionCode)||t,label:`第${t+1}小题(${questionTypesMap[null==e?void 0:e.type]})`,children:jsxRuntimeExports.jsx(QuestionRender,{data:e})}))}),jsxRuntimeExports.jsx("div",{className:"composite-content-others",children:i&&jsxRuntimeExports.jsxs("div",{className:"difficulty",children:[jsxRuntimeExports.jsx("span",{children:"题目难度:"}),jsxRuntimeExports.jsx("span",{children:difficultyMap[i]})]})})]})]})},QuestionRender=React.forwardRef((e,t)=>{const{data:r,questionProps:n={},listeners:i}=e,{onSubmit:o,onNextQuestion:a,editable:s=!1,deleteable:l=!1,onDelete:c=()=>{},onEditOk:u=()=>{},buttonText:d="",showQuestionTip:p=!1,langList:h,showResult:f,status:g=QuestionStatus.PREVIEW,className:m="",styles:v={},uploadImg:y,codeTestURL:b,codeplayerURL:q,rightTopButtonArr:V,unknowQesutionRender:S,QuestionTopRender:E,QuestionBottomRender:x,onlyAdd:C,toRunCodeQuestion:w}=n,[R,A]=React.useState(!1),[T,k]=React.useState(!0),[N,P]=React.useState(!1),[O,F]=React.useState(""),_=React.useMemo(()=>{const e={...r},{optionJson:t,type:n}=r;return!t||n!==QuestionTypeEnum.ACM&&n!==QuestionTypeEnum.CCM||(e.lang=null==t?void 0:t.defaultLanguage),e},[r]);React.useImperativeHandle(t,()=>({setEditShow:e=>A(e),setShowOperateButton:k,addQuestion:()=>{P(!0)}}));const[D,I]=React.useState((e=>{switch(e){case QuestionTypeEnum.RADIO:return"";case QuestionTypeEnum.CHECKBOX:return[];case QuestionTypeEnum.ANSWER:case QuestionTypeEnum.JUDGE:return"";case QuestionTypeEnum.ACM:case QuestionTypeEnum.CCM:return{code:"",language:"javascript"};case QuestionTypeEnum.COMPLETION:return[];case QuestionTypeEnum.DRAW:case QuestionTypeEnum.COMPOSITE:return{};default:return null}})(_.type)),U=e=>jsxRuntimeExports.jsx(QuestionContext.Provider,{value:{topProps:{uploadImg:y}},children:jsxRuntimeExports.jsxs("div",{className:`question-wrapper ${m}`,style:{...v},children:[T&&jsxRuntimeExports.jsxs("div",{className:"operate-area",children:[s&&jsxRuntimeExports.jsx(Tooltip,{title:"编辑",children:jsxRuntimeExports.jsx(Button$1,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$a,{}),onClick:()=>A(!0)},"edit")}),l&&jsxRuntimeExports.jsx(Tooltip,{title:"删除",children:jsxRuntimeExports.jsx(Button$1,{size:"small",icon:jsxRuntimeExports.jsx(RefIcon$e,{}),onClick:()=>c(_)},"delete")}),(null==V?void 0:V.length)&&V.map(e=>{const{text:r,icon:n,needBindRef:o}=e,a={...e};return delete a.needBindRef,jsxRuntimeExports.jsx(Tooltip,{title:r,children:React.createElement(Button$1,{...a,ref:o?t:null,size:"small",key:r??(null==n?void 0:n.toString()),"data-cypress":o?"draggable-handle":"",...o?i:{}})},r??(null==n?void 0:n.toString()))})]}),E&&E(_),e,x&&x(_)]})}),L={data:_,onSubmit:o,buttonText:d,status:g,onNextQuestion:a};if(C)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(QuestionContext.Provider,{value:{topProps:{uploadImg:y}},children:N&&jsxRuntimeExports.jsx(Modal,{style:{top:"40%"},open:N,footer:null,title:"请选择题型",width:300,onCancel:()=>{P(!1),F("")},children:jsxRuntimeExports.jsx(Select,{style:{width:"100%"},placeholder:"请选择",onChange:e=>{P(!1),F(e),A(!0)},options:questionTypeSelectOptions})})})});switch(_.type){case QuestionTypeEnum.RADIO:case QuestionTypeEnum.CHECKBOX:return(()=>{const e=jsxRuntimeExports.jsx(ChoiceQuestion,{showQuestionTip:p,showResult:f,...L});return U(e)})();case QuestionTypeEnum.ACM:case QuestionTypeEnum.CCM:return(()=>{const e=jsxRuntimeExports.jsx(Preview,{codeTestURL:b,codeplayerURL:q,toRunCodeQuestion:w,...L});return U(e)})();case QuestionTypeEnum.COMPLETION:return(()=>{const e=jsxRuntimeExports.jsx(Completion,{showResult:f,...L});return U(e)})();case QuestionTypeEnum.ANSWER:return(()=>{const e=jsxRuntimeExports.jsx(AnswerQuestion,{...L});return U(e)})();case QuestionTypeEnum.DRAW:return(()=>{const e=jsxRuntimeExports.jsx(Draw,{...L});return U(e)})();case QuestionTypeEnum.COMPOSITE:return(()=>{const e=jsxRuntimeExports.jsx(Composite,{...L});return U(e)})();default:return S?S(_):jsxRuntimeExports.jsx("div",{children:"未知题型"})}}),useQuestionRender=()=>{const e=React.useRef(null);return{ref:e,setEditShow:t=>{var r,n;return null==(n=null==(r=e.current)?void 0:r.setEditShow)?void 0:n.call(r,t)},setShowOperateButton:t=>{var r,n;return null==(n=null==(r=e.current)?void 0:r.setShowOperateButton)?void 0:n.call(r,t)}}},QuestionPractice=({questionsList:e,questionOperations:t,submitQuestion:r,getCodeSaveAnswer:n,createQuestionCallback:i})=>{var o,a,s;const[l,c]=React.useState(0),[u,d]=React.useState(!1),[p,h]=React.useState(),[f,g]=React.useState(),[m,v]=React.useState(!1),[y,b]=React.useState(!1);React.useEffect(()=>{(null==E?void 0:E.userAnswer)?b(!0):b(!1)},[l,e]);const q=React.useRef(null),V=()=>{d(!0),q.current&&clearTimeout(q.current),q.current=setTimeout(()=>{d(!1)},0)},S=e=>{const t=E,r=e||t.userAnswer,{answer:n,answerOption:i}=t;switch(t.type){case QuestionTypeEnum.CHECKBOX:case QuestionTypeEnum.RADIO:return r===n||r&&isArrayEqual(null==r?void 0:r.split(","),null==n?void 0:n.split(","));case QuestionTypeEnum.COMPLETION:return null==i?void 0:i.every((e,t)=>{var n;return(null==e?void 0:e.answer)===(null==(n=null==r?void 0:r[t])?void 0:n.answer)});default:return!0}},E=React.useMemo(()=>e?e[l]:{},[l,e]);return jsxRuntimeExports.jsx("div",{className:"tailwind-scoped questionPractice",children:(null==e?void 0:e.length)>0?jsxRuntimeExports.jsxs(Splitter,{style:{maxHeight:"568px"},children:[jsxRuntimeExports.jsx(Splitter.Panel,{min:275,max:400,defaultSize:300,children:jsxRuntimeExports.jsx("div",{className:"mr",style:{height:"100%"},children:jsxRuntimeExports.jsxs("div",{className:"bg-white rounded-lg p-6 shadow-sm overflow-y-auto h-full",children:[jsxRuntimeExports.jsx("h3",{className:"font-semibold text-gray-800 mb-4",children:"题目列表"}),(null==e?void 0:e.length)>0&&jsxRuntimeExports.jsx("div",{className:"space-y-3 pr-[12px] left-que-item",children:e.map((t,r)=>{var n,i,o;return jsxRuntimeExports.jsxs("button",{onClick:()=>{c(r),V()},className:"w-full text-left p-4 rounded-lg border-2 transition-all "+(l===r?"border-blue-500 bg-blue-50 shadow-md":"border-gray-200 hover:border-gray-300 hover:bg-gray-50"),children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between mb-2",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntimeExports.jsx("span",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-medium "+(l===r?"bg-blue-600 text-white":"bg-gray-200 text-gray-600"),children:r+1}),jsxRuntimeExports.jsx("div",{className:"p-1 rounded "+(l===r?"bg-blue-100":"bg-gray-100"),children:getQuestionTypeIcon(t.type)}),e[r].userAnswer&&jsxRuntimeExports.jsx("div",{className:"text-xs px-2 py-1 rounded-1 font-medium text-green-500 bg-green-100}",children:"已完成"})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[jsxRuntimeExports.jsx("span",{className:`text-xs px-2 py-1 rounded-full font-medium ${getDifficultyColor(t.difficulty||"")}`,children:"low"===t.difficulty?"简单":"middle"===t.difficulty?"中等":"困难"}),t.score?jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1 text-xs text-gray-500",children:[jsxRuntimeExports.jsx(Star,{className:"w-3 h-3"}),jsxRuntimeExports.jsx("span",{children:t.score})]}):null]})]}),jsxRuntimeExports.jsx(Tooltip,{title:(t.topic||t.content||"").replace(/<[^>]*>/g,""),children:jsxRuntimeExports.jsx("h4",{className:"font-medium text-sm mb-1 text-ellipsis line-clamp-2 "+(l===r?"text-blue-800":"text-gray-800"),children:jsxRuntimeExports.jsx("span",{dangerouslySetInnerHTML:{__html:t.topic||t.content||""}})})}),jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between",children:[(null==(n=null==t?void 0:t.labels)?void 0:n.length)?jsxRuntimeExports.jsx("span",{className:"text-xs text-blue-600 bg-blue-100 px-2 py-1 rounded-full",children:null==(o=null==(i=null==t?void 0:t.labels)?void 0:i[0])?void 0:o.labelName}):jsxRuntimeExports.jsx("span",{}),jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-500",children:getQuestionTypeName(t.type)})]})]},t.content||""+r)})})]})})}),jsxRuntimeExports.jsx(Splitter.Panel,{children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("div",{className:"bg-white rounded-lg pb-5 pt-4 relative",children:[!u&&E&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{className:"flex justify-end ant-btn-important absolute top-3 right-3 z-10",children:null==t?void 0:t(E)}),jsxRuntimeExports.jsx(QuestionRender,{data:E,questionProps:{onSubmit:e=>{null==r||r(E,e)},toRunCodeQuestion:()=>(async e=>{var t,r;h(e);const{lang:i="",topic:o,content:a,title:s,exampleList:l,verifyMode:c,userAnswer:u,optionJson:d}=e;let f=u||(null==n?void 0:n(p));g({lang:i||(null==(t=null==d?void 0:d.languages)?void 0:t[0]),topic:o||s,content:a,verifyMode:c||(null==d?void 0:d.verifyMode)||(null==(r=null==e?void 0:e.optionJson)?void 0:r.verifyMode),code:f,cases:l||e.testCaseList||e.exampleList}),v(!0)})(E),showResult:!0,onNextQuestion:()=>{l<e.length-1?(c(l+1),V(),b(!1)):staticMethods.warning("已经是最后一题了")}}})]},E.id+E.questionId+E.userAnswer),y&&(null==E?void 0:E.type)!==QuestionTypeEnum.CCM&&(null==E?void 0:E.type)!==QuestionTypeEnum.ACM&&jsxRuntimeExports.jsxs("div",{className:"question-result mt-6 p-4 rounded-lg "+(S()?"bg-green-50 border border-green-200":"bg-red-50 border border-red-200"),children:[[QuestionTypeEnum.RADIO,QuestionTypeEnum.CHECKBOX,QuestionTypeEnum.COMPLETION].includes(E.type)&&jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2 mb-2",children:[S()?jsxRuntimeExports.jsx(CircleCheckBig,{className:"w-5 h-5 text-green-600"}):jsxRuntimeExports.jsx(CircleX,{className:"w-5 h-5 text-red-600"}),jsxRuntimeExports.jsx("span",{className:"font-medium "+(S()?"text-green-800":"text-red-800"),children:S()?"回答正确!":"回答错误"}),!S()&&jsxRuntimeExports.jsx("span",{className:"text-red-600 text-sm bg-red-100 px-2 py-1 rounded-full",children:"已加入错题本"})]}),jsxRuntimeExports.jsx("div",{className:"text-gray-700 text-sm",children:(null==E?void 0:E.analyze)&&jsxRuntimeExports.jsxs("div",{className:"analyze",children:[jsxRuntimeExports.jsx("div",{className:"analyzeTitle",children:"答案分析"}),jsxRuntimeExports.jsx("div",{className:"analyzeContent",children:"answer"===E.type?jsxRuntimeExports.jsx(MyReactMarkdown,{children:(null==(o=null==E?void 0:E.analyze)?void 0:o.answerAnalysis)||(null==(a=null==E?void 0:E.analyze)?void 0:a.answer)}):jsxRuntimeExports.jsx(MyReactMarkdown,{children:null==(s=null==E?void 0:E.analyze)?void 0:s.answerAnalysis})})]})})]})]})})})]}):jsxRuntimeExports.jsx(Empty,{image:Empty.PRESENTED_IMAGE_SIMPLE,description:jsxRuntimeExports.jsxs("div",{className:"emptyDescription",children:["暂无相关题目 ",i&&jsxRuntimeExports.jsx("span",{onClick:()=>i(),children:"现在生成"})]})})})};function _getDefaults(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let _defaults=_getDefaults();function changeDefaults(e){_defaults=e}const escapeTest=/[&<>"']/,escapeReplace=new RegExp(escapeTest.source,"g"),escapeTestNoEncode=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode=new RegExp(escapeTestNoEncode.source,"g"),escapeReplacements={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},getEscapeReplacement=e=>escapeReplacements[e];function escape$1(e,t){if(t){if(escapeTest.test(e))return e.replace(escapeReplace,getEscapeReplacement)}else if(escapeTestNoEncode.test(e))return e.replace(escapeReplaceNoEncode,getEscapeReplacement);return e}const caret=/(^|[^\[])\^/g;function edit(e,t){let r="string"==typeof e?e:e.source;t=t||"";const n={replace:(e,t)=>{let i="string"==typeof t?t:t.source;return i=i.replace(caret,"$1"),r=r.replace(e,i),n},getRegex:()=>new RegExp(r,t)};return n}function cleanUrl(e){try{e=encodeURI(e).replace(/%25/g,"%")}catch{return null}return e}const noopTest={exec:()=>null};function splitCells(e,t){const r=e.replace(/\|/g,(e,t,r)=>{let n=!1,i=t;for(;--i>=0&&"\\"===r[i];)n=!n;return n?"|":" |"}).split(/ \|/);let n=0;if(r[0].trim()||r.shift(),r.length>0&&!r[r.length-1].trim()&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;n<r.length;n++)r[n]=r[n].trim().replace(/\\\|/g,"|");return r}function rtrim(e,t,r){const n=e.length;if(0===n)return"";let i=0;for(;i<n;){if(e.charAt(n-i-1)!==t)break;i++}return e.slice(0,n-i)}function findClosingBracket(e,t){if(-1===e.indexOf(t[1]))return-1;let r=0;for(let n=0;n<e.length;n++)if("\\"===e[n])n++;else if(e[n]===t[0])r++;else if(e[n]===t[1]&&(r--,r<0))return n;return-1}function outputLink(e,t,r,n){const i=t.href,o=t.title?escape$1(t.title):null,a=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){n.state.inLink=!0;const e={type:"link",raw:r,href:i,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,e}return{type:"image",raw:r,href:i,title:o,text:escape$1(a)}}function indentCodeCompensation(e,t){const r=e.match(/^(\s+)(?:```)/);if(null===r)return t;const n=r[1];return t.split("\n").map(e=>{const t=e.match(/^\s+/);if(null===t)return e;const[r]=t;return r.length>=n.length?e.slice(n.length):e}).join("\n")}class _Tokenizer{constructor(e){__publicField(this,"options"),__publicField(this,"rules"),__publicField(this,"lexer"),this.options=e||_defaults}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:rtrim(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],r=indentCodeCompensation(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=rtrim(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:rtrim(t[0],"\n")}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let e=rtrim(t[0],"\n").split("\n"),r="",n="";const i=[];for(;e.length>0;){let t=!1;const o=[];let a;for(a=0;a<e.length;a++)if(/^ {0,3}>/.test(e[a]))o.push(e[a]),t=!0;else{if(t)break;o.push(e[a])}e=e.slice(a);const s=o.join("\n"),l=s.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,"\n $1").replace(/^ {0,3}>[ \t]?/gm,"");r=r?`${r}\n${s}`:s,n=n?`${n}\n${l}`:l;const c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(l,i,!0),this.lexer.state.top=c,0===e.length)break;const u=i[i.length-1];if("code"===(null==u?void 0:u.type))break;if("blockquote"===(null==u?void 0:u.type)){const t=u,o=t.raw+"\n"+e.join("\n"),a=this.blockquote(o);i[i.length-1]=a,r=r.substring(0,r.length-t.raw.length)+a.raw,n=n.substring(0,n.length-t.text.length)+a.text;break}if("list"===(null==u?void 0:u.type)){const t=u,o=t.raw+"\n"+e.join("\n"),a=this.list(o);i[i.length-1]=a,r=r.substring(0,r.length-u.raw.length)+a.raw,n=n.substring(0,n.length-t.raw.length)+a.raw,e=o.substring(i[i.length-1].raw.length).split("\n");continue}}return{type:"blockquote",raw:r,tokens:i,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim();const n=r.length>1,i={type:"list",raw:"",ordered:n,start:n?+r.slice(0,-1):"",loose:!1,items:[]};r=n?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=n?r:"[*+-]");const o=new RegExp(`^( {0,3}${r})((?:[\t ][^\\n]*)?(?:\\n|$))`);let a=!1;for(;e;){let r=!1,n="",s="";if(!(t=o.exec(e)))break;if(this.rules.block.hr.test(e))break;n=t[0],e=e.substring(n.length);let l=t[2].split("\n",1)[0].replace(/^\t+/,e=>" ".repeat(3*e.length)),c=e.split("\n",1)[0],u=!l.trim(),d=0;if(this.options.pedantic?(d=2,s=l.trimStart()):u?d=t[1].length+1:(d=t[2].search(/[^ ]/),d=d>4?1:d,s=l.slice(d),d+=t[1].length),u&&/^ *$/.test(c)&&(n+=c+"\n",e=e.substring(c.length+1),r=!0),!r){const t=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ \t][^\\n]*)?(?:\\n|$))`),r=new RegExp(`^ {0,${Math.min(3,d-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),i=new RegExp(`^ {0,${Math.min(3,d-1)}}(?:\`\`\`|~~~)`),o=new RegExp(`^ {0,${Math.min(3,d-1)}}#`);for(;e;){const a=e.split("\n",1)[0];if(c=a,this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),i.test(c))break;if(o.test(c))break;if(t.test(c))break;if(r.test(e))break;if(c.search(/[^ ]/)>=d||!c.trim())s+="\n"+c.slice(d);else{if(u)break;if(l.search(/[^ ]/)>=4)break;if(i.test(l))break;if(o.test(l))break;if(r.test(l))break;s+="\n"+c}u||c.trim()||(u=!0),n+=a+"\n",e=e.substring(a.length+1),l=c.slice(d)}}i.loose||(a?i.loose=!0:/\n *\n *$/.test(n)&&(a=!0));let p,h=null;this.options.gfm&&(h=/^\[[ xX]\] /.exec(s),h&&(p="[ ] "!==h[0],s=s.replace(/^\[[ xX]\] +/,""))),i.items.push({type:"list_item",raw:n,task:!!h,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=n}i.items[i.items.length-1].raw=i.items[i.items.length-1].raw.trimEnd(),i.items[i.items.length-1].text=i.items[i.items.length-1].text.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){const t=i.items[e].tokens.filter(e=>"space"===e.type),r=t.length>0&&t.some(e=>/\n.*\n/.test(e.raw));i.loose=r}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){const t=this.rules.block.html.exec(e);if(t){return{type:"html",block:!0,raw:t[0],pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:t[0]}}}def(e){const t=this.rules.block.def.exec(e);if(t){const e=t[1].toLowerCase().replace(/\s+/g," "),r=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:r,title:n}}}table(e){const t=this.rules.block.table.exec(e);if(!t)return;if(!/[:|]/.test(t[2]))return;const r=splitCells(t[1]),n=t[2].replace(/^\||\| *$/g,"").split("|"),i=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split("\n"):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===n.length){for(const e of n)/^ *-+: *$/.test(e)?o.align.push("right"):/^ *:-+: *$/.test(e)?o.align.push("center"):/^ *:-+ *$/.test(e)?o.align.push("left"):o.align.push(null);for(let e=0;e<r.length;e++)o.header.push({text:r[e],tokens:this.lexer.inline(r[e]),header:!0,align:o.align[e]});for(const e of i)o.rows.push(splitCells(e,o.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:o.align[t]})));return o}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e="\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:escape$1(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=rtrim(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=findClosingBracket(t[2],"()");if(e>-1){const r=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let r=t[2],n="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(r);e&&(r=e[1],n=e[3])}else n=t[3]?t[3].slice(1,-1):"";return r=r.trim(),/^</.test(r)&&(r=this.options.pedantic&&!/>$/.test(e)?r.slice(1):r.slice(1,-1)),outputLink(t,{href:r?r.replace(this.rules.inline.anyPunctuation,"$1"):r,title:n?n.replace(this.rules.inline.anyPunctuation,"$1"):n},t[0],this.lexer)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){const e=t[(r[2]||r[1]).replace(/\s+/g," ").toLowerCase()];if(!e){const e=r[0].charAt(0);return{type:"text",raw:e,text:e}}return outputLink(r,e,r[0],this.lexer)}}emStrong(e,t,r=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!n)return;if(n[3]&&r.match(/[\p{L}\p{N}]/u))return;if(!(n[1]||n[2]||"")||!r||this.rules.inline.punctuation.exec(r)){const r=[...n[0]].length-1;let i,o,a=r,s=0;const l="*"===n[0][0]?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(l.lastIndex=0,t=t.slice(-1*e.length+r);null!=(n=l.exec(t));){if(i=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!i)continue;if(o=[...i].length,n[3]||n[4]){a+=o;continue}if((n[5]||n[6])&&r%3&&!((r+o)%3)){s+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a+s);const t=[...n[0]][0].length,l=e.slice(0,r+n.index+t+o);if(Math.min(r,o)%2){const e=l.slice(1,-1);return{type:"em",raw:l,text:e,tokens:this.lexer.inlineTokens(e)}}const c=l.slice(2,-2);return{type:"strong",raw:l,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const r=/[^ ]/.test(e),n=/^ /.test(e)&&/ $/.test(e);return r&&n&&(e=e.substring(1,e.length-1)),e=escape$1(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let e,r;return"@"===t[2]?(e=escape$1(t[1]),r="mailto:"+e):(e=escape$1(t[1]),r=e),{type:"link",raw:t[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}url(e){var t;let r;if(r=this.rules.inline.url.exec(e)){let e,n;if("@"===r[2])e=escape$1(r[0]),n="mailto:"+e;else{let i;do{i=r[0],r[0]=(null==(t=this.rules.inline._backpedal.exec(r[0]))?void 0:t[0])??""}while(i!==r[0]);e=escape$1(r[0]),n="www."===r[1]?"http://"+r[0]:r[0]}return{type:"link",raw:r[0],text:e,href:n,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:escape$1(t[0]),{type:"text",raw:t[0],text:e}}}}const newline=/^(?: *(?:\n|$))+/,blockCode=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bullet=/(?:[*+-]|\d{1,9}[.)])/,lheading=edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,bullet).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),_paragraph=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,blockText=/^[^\n]+/,_blockLabel=/(?!\s*\])(?:\\.|[^\[\]\\])+/,def=edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",_blockLabel).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),list=edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bullet).getRegex(),_tag="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",_comment=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,html$3=edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",_comment).replace("tag",_tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),paragraph=edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockquote=edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",paragraph).getRegex(),blockNormal={blockquote:blockquote,code:blockCode,def:def,fences:fences,heading:heading,hr:hr,html:html$3,lheading:lheading,list:list,newline:newline,paragraph:paragraph,table:noopTest,text:blockText},gfmTable=edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex(),blockGfm={...blockNormal,table:gfmTable,paragraph:edit(_paragraph).replace("hr",hr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",gfmTable).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",_tag).getRegex()},blockPedantic={...blockNormal,html:edit("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",_comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:noopTest,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:edit(_paragraph).replace("hr",hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",lheading).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},escape$2=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,inlineCode=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br=/^( {2,}|\\)\n(?!\s*$)/,inlineText=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_punctuation="\\p{P}\\p{S}",punctuation=edit(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,_punctuation).getRegex(),blockSkip=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,emStrongLDelim=edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,_punctuation).getRegex(),emStrongRDelimAst=edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,_punctuation).getRegex(),emStrongRDelimUnd=edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,_punctuation).getRegex(),anyPunctuation=edit(/\\([punct])/,"gu").replace(/punct/g,_punctuation).getRegex(),autolink=edit(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),_inlineComment=edit(_comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),tag=edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",_inlineComment).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_inlineLabel=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,link=edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",_inlineLabel).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),reflink=edit(/^!?\[(label)\]\[(ref)\]/).replace("label",_inlineLabel).replace("ref",_blockLabel).getRegex(),nolink=edit(/^!?\[(ref)\](?:\[\])?/).replace("ref",_blockLabel).getRegex(),reflinkSearch=edit("reflink|nolink(?!\\()","g").replace("reflink",reflink).replace("nolink",nolink).getRegex(),inlineNormal={_backpedal:noopTest,anyPunctuation:anyPunctuation,autolink:autolink,blockSkip:blockSkip,br:br,code:inlineCode,del:noopTest,emStrongLDelim:emStrongLDelim,emStrongRDelimAst:emStrongRDelimAst,emStrongRDelimUnd:emStrongRDelimUnd,escape:escape$2,link:link,nolink:nolink,punctuation:punctuation,reflink:reflink,reflinkSearch:reflinkSearch,tag:tag,text:inlineText,url:noopTest},inlinePedantic={...inlineNormal,link:edit(/^!?\[(label)\]\((.*?)\)/).replace("label",_inlineLabel).getRegex(),reflink:edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_inlineLabel).getRegex()},inlineGfm={...inlineNormal,escape:edit(escape$2).replace("])","~|])").getRegex(),url:edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},inlineBreaks={...inlineGfm,br:edit(br).replace("{2,}","*").getRegex(),text:edit(inlineGfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},block={normal:blockNormal,gfm:blockGfm,pedantic:blockPedantic},inline={normal:inlineNormal,gfm:inlineGfm,breaks:inlineBreaks,pedantic:inlinePedantic};class _Lexer{constructor(e){__publicField(this,"tokens"),__publicField(this,"options"),__publicField(this,"state"),__publicField(this,"tokenizer"),__publicField(this,"inlineQueue"),this.tokens=[],this.tokens.links=Object.create(null),this.options=e||_defaults,this.options.tokenizer=this.options.tokenizer||new _Tokenizer,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:block.normal,inline:inline.normal};this.options.pedantic?(t.block=block.pedantic,t.inline=inline.pedantic):this.options.gfm&&(t.block=block.gfm,this.options.breaks?t.inline=inline.breaks:t.inline=inline.gfm),this.tokenizer.rules=t}static get rules(){return{block:block,inline:inline}}static lex(e,t){return new _Lexer(t).lex(e)}static lexInline(e,t){return new _Lexer(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,"\n"),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const e=this.inlineQueue[t];this.inlineTokens(e.src,e.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){let n,i,o;for(e=this.options.pedantic?e.replace(/\t/g," ").replace(/^ +$/gm,""):e.replace(/^( *)(\t+)/gm,(e,t,r)=>t+" ".repeat(r.length));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),1===n.raw.length&&t.length>0?t[t.length-1].raw+="\n":t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?t.push(n):(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),i=t[t.length-1],!i||"paragraph"!==i.type&&"text"!==i.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(i.raw+="\n"+n.raw,i.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(o=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const r=e.slice(1);let n;this.options.extensions.startBlock.forEach(e=>{n=e.call({lexer:this},r),"number"==typeof n&&n>=0&&(t=Math.min(t,n))}),t<1/0&&t>=0&&(o=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(o)))i=t[t.length-1],r&&"paragraph"===(null==i?void 0:i.type)?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),r=o.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),i=t[t.length-1],i&&"text"===i.type?(i.raw+="\n"+n.raw,i.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r,n,i,o,a,s,l=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(o=this.tokenizer.rules.inline.reflinkSearch.exec(l));)e.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(o=this.tokenizer.rules.inline.blockSkip.exec(l));)l=l.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(o=this.tokenizer.rules.inline.anyPunctuation.exec(l));)l=l.slice(0,o.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(a||(s=""),a=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(n=>!!(r=n.call({lexer:this},e,t))&&(e=e.substring(r.raw.length),t.push(r),!0))))if(r=this.tokenizer.escape(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.tag(e))e=e.substring(r.raw.length),n=t[t.length-1],n&&"text"===r.type&&"text"===n.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);else if(r=this.tokenizer.link(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(r.raw.length),n=t[t.length-1],n&&"text"===r.type&&"text"===n.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);else if(r=this.tokenizer.emStrong(e,l,s))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.codespan(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.br(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.del(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.autolink(e))e=e.substring(r.raw.length),t.push(r);else if(this.state.inLink||!(r=this.tokenizer.url(e))){if(i=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const r=e.slice(1);let n;this.options.extensions.startInline.forEach(e=>{n=e.call({lexer:this},r),"number"==typeof n&&n>=0&&(t=Math.min(t,n))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i))e=e.substring(r.raw.length),"_"!==r.raw.slice(-1)&&(s=r.raw.slice(-1)),a=!0,n=t[t.length-1],n&&"text"===n.type?(n.raw+=r.raw,n.text+=r.text):t.push(r);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent)break;throw new Error(t)}}else e=e.substring(r.raw.length),t.push(r);return t}}class _Renderer{constructor(e){__publicField(this,"options"),__publicField(this,"parser"),this.options=e||_defaults}space(e){return""}code({text:e,lang:t,escaped:r}){var n;const i=null==(n=(t||"").match(/^\S*/))?void 0:n[0],o=e.replace(/\n$/,"")+"\n";return i?'<pre><code class="language-'+escape$1(i)+'">'+(r?o:escape$1(o,!0))+"</code></pre>\n":"<pre><code>"+(r?o:escape$1(o,!0))+"</code></pre>\n"}blockquote({tokens:e}){return`<blockquote>\n${this.parser.parse(e)}</blockquote>\n`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>\n`}hr(e){return"<hr>\n"}list(e){const t=e.ordered,r=e.start;let n="";for(let o=0;o<e.items.length;o++){const t=e.items[o];n+=this.listitem(t)}const i=t?"ol":"ul";return"<"+i+(t&&1!==r?' start="'+r+'"':"")+">\n"+n+"</"+i+">\n"}listitem(e){let t="";if(e.task){const r=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&"paragraph"===e.tokens[0].type?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&"text"===e.tokens[0].tokens[0].type&&(e.tokens[0].tokens[0].text=r+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" "}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>\n`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>\n`}table(e){let t="",r="";for(let i=0;i<e.header.length;i++)r+=this.tablecell(e.header[i]);t+=this.tablerow({text:r});let n="";for(let i=0;i<e.rows.length;i++){const t=e.rows[i];r="";for(let e=0;e<t.length;e++)r+=this.tablecell(t[e]);n+=this.tablerow({text:r})}return n&&(n=`<tbody>${n}</tbody>`),"<table>\n<thead>\n"+t+"</thead>\n"+n+"</table>\n"}tablerow({text:e}){return`<tr>\n${e}</tr>\n`}tablecell(e){const t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>\n`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${e}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){const n=this.parser.parseInline(r),i=cleanUrl(e);if(null===i)return n;let o='<a href="'+(e=i)+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>",o}image({href:e,title:t,text:r}){const n=cleanUrl(e);if(null===n)return r;let i=`<img src="${e=n}" alt="${r}"`;return t&&(i+=` title="${t}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}}class _TextRenderer{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class _Parser{constructor(e){__publicField(this,"options"),__publicField(this,"renderer"),__publicField(this,"textRenderer"),this.options=e||_defaults,this.options.renderer=this.options.renderer||new _Renderer,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new _TextRenderer}static parse(e,t){return new _Parser(t).parse(e)}static parseInline(e,t){return new _Parser(t).parseInline(e)}parse(e,t=!0){let r="";for(let n=0;n<e.length;n++){const i=e[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(!1!==t||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(e.type)){r+=t||"";continue}}const o=i;switch(o.type){case"space":r+=this.renderer.space(o);continue;case"hr":r+=this.renderer.hr(o);continue;case"heading":r+=this.renderer.heading(o);continue;case"code":r+=this.renderer.code(o);continue;case"table":r+=this.renderer.table(o);continue;case"blockquote":r+=this.renderer.blockquote(o);continue;case"list":r+=this.renderer.list(o);continue;case"html":r+=this.renderer.html(o);continue;case"paragraph":r+=this.renderer.paragraph(o);continue;case"text":{let i=o,a=this.renderer.text(i);for(;n+1<e.length&&"text"===e[n+1].type;)i=e[++n],a+="\n"+this.renderer.text(i);r+=t?this.renderer.paragraph({type:"paragraph",raw:a,text:a,tokens:[{type:"text",raw:a,text:a}]}):a;continue}default:{const e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return"";throw new Error(e)}}}return r}parseInline(e,t){t=t||this.renderer;let r="";for(let n=0;n<e.length;n++){const i=e[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){const e=this.options.extensions.renderers[i.type].call({parser:this},i);if(!1!==e||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(i.type)){r+=e||"";continue}}const o=i;switch(o.type){case"escape":case"text":r+=t.text(o);break;case"html":r+=t.html(o);break;case"link":r+=t.link(o);break;case"image":r+=t.image(o);break;case"strong":r+=t.strong(o);break;case"em":r+=t.em(o);break;case"codespan":r+=t.codespan(o);break;case"br":r+=t.br(o);break;case"del":r+=t.del(o);break;default:{const e='Token with "'+o.type+'" type was not found.';if(this.options.silent)return"";throw new Error(e)}}}return r}}class _Hooks{constructor(e){__publicField(this,"options"),this.options=e||_defaults}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}__publicField(_Hooks,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class Marked{constructor(...e){__publicField(this,"defaults",_getDefaults()),__publicField(this,"options",this.setOptions),__publicField(this,"parse",this.parseMarkdown(_Lexer.lex,_Parser.parse)),__publicField(this,"parseInline",this.parseMarkdown(_Lexer.lexInline,_Parser.parseInline)),__publicField(this,"Parser",_Parser),__publicField(this,"Renderer",_Renderer),__publicField(this,"TextRenderer",_TextRenderer),__publicField(this,"Lexer",_Lexer),__publicField(this,"Tokenizer",_Tokenizer),__publicField(this,"Hooks",_Hooks),this.use(...e)}walkTokens(e,t){var r,n;let i=[];for(const o of e)switch(i=i.concat(t.call(this,o)),o.type){case"table":{const e=o;for(const r of e.header)i=i.concat(this.walkTokens(r.tokens,t));for(const r of e.rows)for(const e of r)i=i.concat(this.walkTokens(e.tokens,t));break}case"list":{const e=o;i=i.concat(this.walkTokens(e.items,t));break}default:{const e=o;(null==(n=null==(r=this.defaults.extensions)?void 0:r.childTokens)?void 0:n[e.type])?this.defaults.extensions.childTokens[e.type].forEach(r=>{const n=e[r].flat(1/0);i=i.concat(this.walkTokens(n,t))}):e.tokens&&(i=i.concat(this.walkTokens(e.tokens,t)))}}return i}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{const r={...e};if(r.async=this.defaults.async||r.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw new Error("extension name required");if("renderer"in e){const r=t.renderers[e.name];t.renderers[e.name]=r?function(...t){let n=e.renderer.apply(this,t);return!1===n&&(n=r.apply(this,t)),n}:e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");const r=t[e.level];r?r.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),r.extensions=t),e.renderer){const t=this.defaults.renderer||new _Renderer(this.defaults);for(const r in e.renderer){if(!(r in t))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const n=r,i=e.renderer[n],o=t[n];t[n]=(...e)=>{let r=i.apply(t,e);return!1===r&&(r=o.apply(t,e)),r||""}}r.renderer=t}if(e.tokenizer){const t=this.defaults.tokenizer||new _Tokenizer(this.defaults);for(const r in e.tokenizer){if(!(r in t))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const n=r,i=e.tokenizer[n],o=t[n];t[n]=(...e)=>{let r=i.apply(t,e);return!1===r&&(r=o.apply(t,e)),r}}r.tokenizer=t}if(e.hooks){const t=this.defaults.hooks||new _Hooks;for(const r in e.hooks){if(!(r in t))throw new Error(`hook '${r}' does not exist`);if("options"===r)continue;const n=r,i=e.hooks[n],o=t[n];_Hooks.passThroughHooks.has(r)?t[n]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>o.call(t,e));const r=i.call(t,e);return o.call(t,r)}:t[n]=(...e)=>{let r=i.apply(t,e);return!1===r&&(r=o.apply(t,e)),r}}r.hooks=t}if(e.walkTokens){const t=this.defaults.walkTokens,n=e.walkTokens;r.walkTokens=function(e){let r=[];return r.push(n.call(this,e)),t&&(r=r.concat(t.call(this,e))),r}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return _Lexer.lex(e,t??this.defaults)}parser(e,t){return _Parser.parse(e,t??this.defaults)}parseMarkdown(e,t){return(r,n)=>{const i={...n},o={...this.defaults,...i},a=this.onError(!!o.silent,!!o.async);if(!0===this.defaults.async&&!1===i.async)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(null==r)return a(new Error("marked(): input parameter is undefined or null"));if("string"!=typeof r)return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));if(o.hooks&&(o.hooks.options=o),o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(t=>e(t,o)).then(e=>o.hooks?o.hooks.processAllTokens(e):e).then(e=>o.walkTokens?Promise.all(this.walkTokens(e,o.walkTokens)).then(()=>e):e).then(e=>t(e,o)).then(e=>o.hooks?o.hooks.postprocess(e):e).catch(a);try{o.hooks&&(r=o.hooks.preprocess(r));let n=e(r,o);o.hooks&&(n=o.hooks.processAllTokens(n)),o.walkTokens&&this.walkTokens(n,o.walkTokens);let i=t(n,o);return o.hooks&&(i=o.hooks.postprocess(i)),i}catch(e10){return a(e10)}}}onError(e,t){return r=>{if(r.message+="\nPlease report this to https://github.com/markedjs/marked.",e){const e="<p>An error occurred:</p><pre>"+escape$1(r.message+"",!0)+"</pre>";return t?Promise.resolve(e):e}if(t)return Promise.reject(r);throw r}}}const markedInstance=new Marked;function marked(e,t){return markedInstance.parse(e,t)}marked.options=marked.setOptions=function(e){return markedInstance.setOptions(e),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.getDefaults=_getDefaults,marked.defaults=_defaults,marked.use=function(...e){return markedInstance.use(...e),marked.defaults=markedInstance.defaults,changeDefaults(marked.defaults),marked},marked.walkTokens=function(e,t){return markedInstance.walkTokens(e,t)},marked.parseInline=markedInstance.parseInline,marked.Parser=_Parser,marked.parser=_Parser.parse,marked.Renderer=_Renderer,marked.TextRenderer=_TextRenderer,marked.Lexer=_Lexer,marked.lexer=_Lexer.lex,marked.Tokenizer=_Tokenizer,marked.Hooks=_Hooks,marked.parse=marked,marked.options,marked.setOptions,marked.use,marked.walkTokens,marked.parseInline,_Parser.parse,_Lexer.lex;const CodePlayer=React.forwardRef((e,t)=>{const{envStatus:r,podName:n,runnerBaseUrl:i}=React.useContext(KnowledgeCardContext),{data:o,hasTitle:a=!0,toScore:s,errorHanle:l,codeChange:c}=e,u=React.useRef(null),[d,p]=React.useState(!0),[h,f]=React.useState(!1),g=debounce$2(e=>{null==c||c(e.code)}),m=React.useRef(null);return React.useEffect(()=>(f(!1),p(!0),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{f(!0)},1e3),()=>{m.current&&clearTimeout(m.current)}),[o]),React.useImperativeHandle(t,()=>({toInstallPackage:e=>{var t,r;(null==(t=u.current)?void 0:t.contentWindow)&&postRobot.send(null==(r=u.current)?void 0:r.contentWindow,"vgenPackages",{packages:e})}})),jsxRuntimeExports.jsx(Spin,{spinning:d,children:jsxRuntimeExports.jsx("div",{className:"codePlayer",children:jsxRuntimeExports.jsx("div",{className:"codePlayerContent",style:{height:a?"":"100%"},children:h&&jsxRuntimeExports.jsx("iframe",{ref:u,allowFullScreen:!0,allow:"clipboard-write;clipboard-read",src:`${i||"https://run.cloudlab.top"}/embedded?fromVgen=true`,style:{border:"none"},title:"CodeRunner",className:"CodeRunner-iframe",onLoad:async()=>{var e,t,i;try{p(!1);const l=null==(e=u.current)?void 0:e.contentWindow,{topic:c="",content:d="",lang:h="",code:f="",cases:m=[]}=o;let v=d;try{v=marked.parse(d)}catch(a){}let y=[];if("html"===h)try{const e=JSON.parse(f);y=[e.html,e.css,e.js]}catch(a){}let b={...o};const q={title:c,content:v,lang:h,code:"html"===h?y:f,aiEnabled:!1,run:!1,cases:m,customButtons:s?[{name:"提交",value:"submit",style:{background:"#0064ff",color:"#ffffff"}}]:[]};r&&n&&(q.podName=n,q.nameSpace="pty-prod"),postRobot.send(l,"send",q),s&&postRobot.on("submit",{window:l},async function(e){var t,r;(null==(t=e.data)?void 0:t.code)?(staticMethods.success("提交成功,AI开始自动评分..."),s(null==(r=e.data)?void 0:r.code)):staticMethods.warning("请先作答!")}),postRobot.on("change",{window:null==(t=u.current)?void 0:t.contentWindow},async function(e){var t,r,n,i,o;if("html"===h)try{const i={html:(null==(t=e.data)?void 0:t[0])??"",css:(null==(r=e.data)?void 0:r[1])??"",js:(null==(n=e.data)?void 0:n[2])??""};b.code=JSON.stringify(i)}catch(a){b.code=(null==(i=e.data)?void 0:i[0])??""}else b.code=(null==(o=e.data)?void 0:o[0])??"";g(b)}),postRobot.on("getToken",{window:null==(i=u.current)?void 0:i.contentWindow},async e=>({token:localStorage.getItem("token")}))}catch(a){}}})})})})}),ExCodePlayer=React.memo(e=>{const{codePlayerData:t,saveCode:r}=e,{envDetail:n,envStatus:i,podName:o}=React.useContext(KnowledgeCardContext),[a,s]=React.useState(!1),l=React.useRef(null);React.useEffect(()=>{if(n)return""===i?Modal.confirm({title:"温馨提示",content:"该示例需要启动环境,请先启动环境后再使用。",cancelText:"我知道了",okText:"启动环境",centered:!0,width:400,onOk(e){e(),s(!0),window.postMessage({type:"startupEnv"})}}):i===EnvStatus.Running&&s(!1),()=>{l.current&&clearTimeout(l.current)}},[n,i]);const c=React.useRef(null);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Spin,{spinning:a,fullscreen:!0,tip:"环境启动中..."}),!n&&jsxRuntimeExports.jsx(CodePlayer,{data:{...t,topic:"",content:""},ref:c,codeChange:e=>r(e,t)}),n&&i===EnvStatus.Running&&o&&jsxRuntimeExports.jsx(CodePlayer,{data:{...t,topic:"",content:""},ref:c,codeChange:e=>r(e,t)})]})});var xterm={exports:{}};!function(e,t){var r;self,r=()=>(()=>{var e={4567:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.AccessibilityManager=void 0;const o=r(9042),a=r(6114),s=r(9924),l=r(844),c=r(5596),u=r(4725),d=r(3656);let p=t.AccessibilityManager=class extends l.Disposable{constructor(e,t){super(),this._terminal=e,this._renderService=t,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=document.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let r=0;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);if(this._topBoundaryFocusListener=e=>this._handleBoundaryFocus(e,0),this._bottomBoundaryFocusListener=e=>this._handleBoundaryFocus(e,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new s.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(e=>this._handleResize(e.rows))),this.register(this._terminal.onRender(e=>this._refreshRows(e.start,e.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(e=>this._handleChar(e))),this.register(this._terminal.onLineFeed(()=>this._handleChar("\n"))),this.register(this._terminal.onA11yTab(e=>this._handleTab(e))),this.register(this._terminal.onKey(e=>this._handleKey(e.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._screenDprMonitor=new c.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener(()=>this._refreshRowsDimensions()),this.register((0,d.addDisposableDomListener)(window,"resize",()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,l.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=o.tooMuchOutput)),a.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(()=>{this._accessibilityContainer.appendChild(this._liveRegion)},0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,a.isMac&&this._liveRegion.remove()}_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){const r=this._terminal.buffer,n=r.lines.length.toString();for(let i=e;i<=t;i++){const e=r.translateBufferLineToString(r.ydisp+i,!0),t=(r.ydisp+i+1).toString(),o=this._rowElements[i];o&&(0===e.length?o.innerText=" ":o.textContent=e,o.setAttribute("aria-posinset",t),o.setAttribute("aria-setsize",n))}this._announceCharacters()}_announceCharacters(){0!==this._charsToAnnounce.length&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){const r=e.target,n=this._rowElements[0===t?1:this._rowElements.length-2];if(r.getAttribute("aria-posinset")===(0===t?"1":`${this._terminal.buffer.lines.length}`))return;if(e.relatedTarget!==n)return;let i,o;if(0===t?(i=r,o=this._rowElements.pop(),this._rowContainer.removeChild(o)):(i=this._rowElements.shift(),o=r,this._rowContainer.removeChild(i)),i.removeEventListener("focus",this._topBoundaryFocusListener),o.removeEventListener("focus",this._bottomBoundaryFocusListener),0===t){const e=this._createAccessibilityTreeNode();this._rowElements.unshift(e),this._rowContainer.insertAdjacentElement("afterbegin",e)}else{const e=this._createAccessibilityTreeNode();this._rowElements.push(e),this._rowContainer.appendChild(e)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(0===t?-1:1),this._rowElements[0===t?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_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(){const e=document.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};t.AccessibilityManager=p=n([i(1,u.IRenderService)],p)},3614:(e,t)=>{function r(e){return e.replace(/\r?\n/g,"\r")}function n(e,t){return t?"[200~"+e+"[201~":e}function i(e,t,i,o){e=n(e=r(e),i.decPrivateModes.bracketedPasteMode&&!0!==o.rawOptions.ignoreBracketedPasteMode),i.triggerDataEvent(e,!0),t.value=""}function o(e,t,r){const n=r.getBoundingClientRect(),i=e.clientX-n.left-10,o=e.clientY-n.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${o}px`,t.style.zIndex="1000",t.focus()}Object.defineProperty(t,"__esModule",{value:!0}),t.rightClickHandler=t.moveTextAreaUnderMouseCursor=t.paste=t.handlePasteEvent=t.copyHandler=t.bracketTextForPaste=t.prepareTextForTerminal=void 0,t.prepareTextForTerminal=r,t.bracketTextForPaste=n,t.copyHandler=function(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()},t.handlePasteEvent=function(e,t,r,n){e.stopPropagation(),e.clipboardData&&i(e.clipboardData.getData("text/plain"),t,r,n)},t.paste=i,t.moveTextAreaUnderMouseCursor=o,t.rightClickHandler=function(e,t,r,n,i){o(e,t,r),i&&n.rightClickSelect(e),t.value=n.selectionText,t.select()}},7239:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;const n=r(1505);t.ColorContrastCache=class{constructor(){this._color=new n.TwoKeyMap,this._css=new n.TwoKeyMap}setCss(e,t,r){this._css.set(e,t,r)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,r){this._color.set(e,t,r)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}}},3656:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.addDisposableDomListener=void 0,t.addDisposableDomListener=function(e,t,r,n){e.addEventListener(t,r,n);let i=!1;return{dispose:()=>{i||(i=!0,e.removeEventListener(t,r,n))}}}},6465:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier2=void 0;const o=r(3656),a=r(8460),s=r(844),l=r(2585);let c=t.Linkifier2=class extends s.Disposable{get currentLink(){return this._currentLink}constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new a.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new a.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,s.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,s.toDisposable)(()=>{this._lastMouseEvent=void 0})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0}))}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{const t=this._linkProviders.indexOf(e);-1!==t&&this._linkProviders.splice(t,1)}}}attachToDom(e,t,r){this._element=e,this._mouseService=t,this._renderService=r,this.register((0,o.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,o.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,o.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;const r=e.composedPath();for(let n=0;n<r.length;n++){const e=r[n];if(e.classList.contains("xterm"))break;if(e.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)return this._clearCurrentLink(),this._askForLink(e,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,n;this._activeProviderReplies&&t||(null===(r=this._activeProviderReplies)||void 0===r||r.forEach(e=>{null==e||e.forEach(e=>{e.link.dispose&&e.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let i=!1;for(const[o,a]of this._linkProviders.entries())t?(null===(n=this._activeProviderReplies)||void 0===n?void 0:n.get(o))&&(i=this._checkLinkProviderResult(o,e,i)):a.provideLinks(e.y,t=>{var r,n;if(this._isMouseOut)return;const a=null==t?void 0:t.map(e=>({link:e}));null===(r=this._activeProviderReplies)||void 0===r||r.set(o,a),i=this._checkLinkProviderResult(o,e,i),(null===(n=this._activeProviderReplies)||void 0===n?void 0:n.size)===this._linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){const r=new Set;for(let n=0;n<t.size;n++){const i=t.get(n);if(i)for(let t=0;t<i.length;t++){const n=i[t],o=n.link.range.start.y<e?0:n.link.range.start.x,a=n.link.range.end.y>e?this._bufferService.cols:n.link.range.end.x;for(let e=o;e<=a;e++){if(r.has(e)){i.splice(t--,1);break}r.add(e)}}}}_checkLinkProviderResult(e,t,r){var n;if(!this._activeProviderReplies)return r;const i=this._activeProviderReplies.get(e);let o=!1;for(let a=0;a<e;a++)this._activeProviderReplies.has(a)&&!this._activeProviderReplies.get(a)||(o=!0);if(!o&&i){const e=i.find(e=>this._linkAtPosition(e.link,t));e&&(r=!0,this._handleNewLink(e))}if(this._activeProviderReplies.size===this._linkProviders.length&&!r)for(let a=0;a<this._activeProviderReplies.size;a++){const e=null===(n=this._activeProviderReplies.get(a))||void 0===n?void 0:n.find(e=>this._linkAtPosition(e.link,t));if(e){r=!0,this._handleNewLink(e);break}}return r}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;const t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){this._element&&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,(0,s.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var e,t;return null===(t=null===(e=this._currentLink)||void 0===e?void 0:e.state)||void 0===t?void 0:t.decorations.pointerCursor},set:e=>{var t,r;(null===(t=this._currentLink)||void 0===t?void 0:t.state)&&this._currentLink.state.decorations.pointerCursor!==e&&(this._currentLink.state.decorations.pointerCursor=e,this._currentLink.state.isHovered&&(null===(r=this._element)||void 0===r||r.classList.toggle("xterm-cursor-pointer",e)))}},underline:{get:()=>{var e,t;return null===(t=null===(e=this._currentLink)||void 0===e?void 0:e.state)||void 0===t?void 0:t.decorations.underline},set:t=>{var r,n,i;(null===(r=this._currentLink)||void 0===r?void 0:r.state)&&(null===(i=null===(n=this._currentLink)||void 0===n?void 0:n.state)||void 0===i?void 0:i.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e=>{if(!this._currentLink)return;const t=0===e.start?0:e.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+e.end;if(this._currentLink.link.range.start.y>=t&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(t,r),this._lastMouseEvent&&this._element)){const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._askForLink(e,!1)}})))}_linkHover(e,t,r){var n;(null===(n=this._currentLink)||void 0===n?void 0:n.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(r,t.text)}_fireUnderlineEvent(e,t){const r=e.range,n=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-n-1,r.end.x,r.end.y-n-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,r){var n;(null===(n=this._currentLink)||void 0===n?void 0:n.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(r,t.text)}_linkAtPosition(e,t){const r=e.range.start.y*this._bufferService.cols+e.range.start.x,n=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return r<=i&&i<=n}_positionFromMouseEvent(e,t,r){const n=r.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(n)return{x:n[0],y:n[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,r,n,i){return{x1:e,y1:t,x2:r,y2:n,cols:this._bufferService.cols,fg:i}}};t.Linkifier2=c=n([i(0,l.IBufferService)],c)},9042:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkProvider=void 0;const o=r(511),a=r(2585);let s=t.OscLinkProvider=class{constructor(e,t,r){this._bufferService=e,this._optionsService=t,this._oscLinkService=r}provideLinks(e,t){var r;const n=this._bufferService.buffer.lines.get(e-1);if(!n)return void t(void 0);const i=[],a=this._optionsService.rawOptions.linkHandler,s=new o.CellData,c=n.getTrimmedLength();let u=-1,d=-1,p=!1;for(let o=0;o<c;o++)if(-1!==d||n.hasContent(o)){if(n.loadCell(o,s),s.hasExtendedAttrs()&&s.extended.urlId){if(-1===d){d=o,u=s.extended.urlId;continue}p=s.extended.urlId!==u}else-1!==d&&(p=!0);if(p||-1!==d&&o===c-1){const t=null===(r=this._oscLinkService.getLinkData(u))||void 0===r?void 0:r.uri;if(t){const r={start:{x:d+1,y:e},end:{x:o+(p||o!==c-1?0:1),y:e}};let n=!1;if(!(null==a?void 0:a.allowNonHttpProtocols))try{const e=new URL(t);["http:","https:"].includes(e.protocol)||(n=!0)}catch(h){n=!0}n||i.push({text:t,range:r,activate:(e,t)=>a?a.activate(e,t,r):l(0,t),hover:(e,t)=>{var n;return null===(n=null==a?void 0:a.hover)||void 0===n?void 0:n.call(a,e,t,r)},leave:(e,t)=>{var n;return null===(n=null==a?void 0:a.leave)||void 0===n?void 0:n.call(a,e,t,r)}})}p=!1,s.hasExtendedAttrs()&&s.extended.urlId?(d=o,u=s.extended.urlId):(d=-1,u=-1)}}t(i)}};function l(e,t){if(confirm(`Do you want to navigate to ${t}?\n\nWARNING: This link could potentially be dangerous`)){const e=window.open();if(e){try{e.opener=null}catch(r){}e.location.href=t}}}t.OscLinkProvider=s=n([i(0,a.IBufferService),i(1,a.IOptionsService),i(2,a.IOscLinkService)],s)},6193:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenderDebouncer=void 0,t.RenderDebouncer=class{constructor(e,t){this._parentWindow=e,this._renderCallback=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,r){this._rowCount=r,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t,this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return void this._runRefreshCallbacks();const 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(const e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}}},5596:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ScreenDprMonitor=void 0;const n=r(844);class i extends n.Disposable{constructor(e){super(),this._parentWindow=e,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this.register((0,n.toDisposable)(()=>{this.clearListener()}))}setListener(e){this._listener&&this.clearListener(),this._listener=e,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}_updateDpr(){var e;this._outerListener&&(null===(e=this._resolutionMediaMatchList)||void 0===e||e.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}t.ScreenDprMonitor=i},3236:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Terminal=void 0;const n=r(3614),i=r(3656),o=r(6465),a=r(9042),s=r(3730),l=r(1680),c=r(3107),u=r(5744),d=r(2950),p=r(1296),h=r(428),f=r(4269),g=r(5114),m=r(8934),v=r(3230),y=r(9312),b=r(4725),q=r(6731),V=r(8055),S=r(8969),E=r(8460),x=r(844),C=r(6114),w=r(8437),R=r(2584),A=r(7399),T=r(5941),k=r(9074),N=r(2585),P=r(5435),O=r(4567),F="undefined"!=typeof window?window.document:null;class _ extends S.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(e={}){super(e),this.browser=C,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new x.MutableDisposable),this._onCursorMove=this.register(new E.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new E.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new E.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new E.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new E.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new E.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new E.EventEmitter),this._onBlur=this.register(new E.EventEmitter),this._onA11yCharEmitter=this.register(new E.EventEmitter),this._onA11yTabEmitter=this.register(new E.EventEmitter),this._onWillOpen=this.register(new E.EventEmitter),this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(o.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(s.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(k.DecorationService),this._instantiationService.setService(N.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((e,t)=>this.refresh(e,t))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(e=>this._reportWindowsOptions(e))),this.register(this._inputHandler.onColor(e=>this._handleColorEvent(e))),this.register((0,E.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,E.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,E.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,E.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(e=>this._afterResize(e.cols,e.rows))),this.register((0,x.toDisposable)(()=>{var e,t;this._customKeyEventHandler=void 0,null===(t=null===(e=this.element)||void 0===e?void 0:e.parentNode)||void 0===t||t.removeChild(this.element)}))}_handleColorEvent(e){if(this._themeService)for(const t of e){let e,r="";switch(t.index){case 256:e="foreground",r="10";break;case 257:e="background",r="11";break;case 258:e="cursor",r="12";break;default:e="ansi",r="4;"+t.index}switch(t.type){case 0:const n=V.color.toColorRGB("ansi"===e?this._themeService.colors.ansi[t.index]:this._themeService.colors[e]);this.coreService.triggerDataEvent(`${R.C0.ESC}]${r};${(0,T.toRgbString)(n)}${R.C1_ESCAPED.ST}`);break;case 1:if("ansi"===e)this._themeService.modifyColors(e=>e.ansi[t.index]=V.rgba.toColor(...t.color));else{const r=e;this._themeService.modifyColors(e=>e[r]=V.rgba.toColor(...t.color))}break;case 2:this._themeService.restoreColor(t.index)}}}_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(O.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(R.C0.ESC+"[I"),this.updateCursorStyle(e),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var e;return null===(e=this.textarea)||void 0===e?void 0:e.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(R.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;const r=Math.min(this.buffer.x,this.cols-1),n=this._renderService.dimensions.css.cell.height,i=t.getWidth(r),o=this._renderService.dimensions.css.cell.width*i,a=this.buffer.y*this._renderService.dimensions.css.cell.height,s=r*this._renderService.dimensions.css.cell.width;this.textarea.style.left=s+"px",this.textarea.style.top=a+"px",this.textarea.style.width=o+"px",this.textarea.style.height=n+"px",this.textarea.style.lineHeight=n+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,i.addDisposableDomListener)(this.element,"copy",e=>{this.hasSelection()&&(0,n.copyHandler)(e,this._selectionService)}));const e=e=>(0,n.handlePasteEvent)(e,this.textarea,this.coreService,this.optionsService);this.register((0,i.addDisposableDomListener)(this.textarea,"paste",e)),this.register((0,i.addDisposableDomListener)(this.element,"paste",e)),C.isFirefox?this.register((0,i.addDisposableDomListener)(this.element,"mousedown",e=>{2===e.button&&(0,n.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,i.addDisposableDomListener)(this.element,"contextmenu",e=>{(0,n.rightClickHandler)(e,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),C.isLinux&&this.register((0,i.addDisposableDomListener)(this.element,"auxclick",e=>{1===e.button&&(0,n.moveTextAreaUnderMouseCursor)(e,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,i.addDisposableDomListener)(this.textarea,"keyup",e=>this._keyUp(e),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,"keydown",e=>this._keyDown(e),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,"keypress",e=>this._keyPress(e),!0)),this.register((0,i.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,i.addDisposableDomListener)(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this.register((0,i.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,i.addDisposableDomListener)(this.textarea,"input",e=>this._inputEvent(e),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var t;if(!e)throw new Error("Terminal requires a parent element.");e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=e.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);const r=F.createDocumentFragment();this._viewportElement=F.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),r.appendChild(this._viewportElement),this._viewportScrollArea=F.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=F.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=F.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),r.appendChild(this.screenElement),this.textarea=F.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",a.promptLabel),C.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this._instantiationService.createInstance(g.CoreBrowserService,this.textarea,null!==(t=this._document.defaultView)&&void 0!==t?t:window),this._instantiationService.setService(b.ICoreBrowserService,this._coreBrowserService),this.register((0,i.addDisposableDomListener)(this.textarea,"focus",e=>this._handleTextAreaFocus(e))),this.register((0,i.addDisposableDomListener)(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(h.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(b.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(q.ThemeService),this._instantiationService.setService(b.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(f.CharacterJoinerService),this._instantiationService.setService(b.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(v.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(b.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange(e=>this._onRender.fire(e))),this.onResize(e=>this._renderService.resize(e.cols,e.rows)),this._compositionView=F.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(d.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(r);try{this._onWillOpen.fire(this.element)}catch(n){}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this._mouseService=this._instantiationService.createInstance(m.MouseService),this._instantiationService.setService(b.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(l.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent,1)),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.handleCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.handleResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.handleBlur())),this.register(this.onFocus(()=>this._renderService.handleFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(y.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(b.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines(e=>this.scrollLines(e.amount,e.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw(e=>this._renderService.handleSelectionChanged(e.start,e.end,e.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection(e=>{this.textarea.value=e,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event(e=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,i.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(c.BufferDecorationRenderer,this.screenElement)),this.register((0,i.addDisposableDomListener)(this.element,"mousedown",e=>this._selectionService.handleMouseDown(e))),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(O.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",e=>this._handleScreenReaderModeOptionChange(e))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",e=>{!this._overviewRulerRenderer&&e&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(u.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(p.DomRenderer,this.element,this.screenElement,this._viewportElement,this.linkifier2)}bindMouse(){const e=this,t=this.element;function r(t){const r=e._mouseService.getMouseReportCoords(t,e.screenElement);if(!r)return!1;let n,i;switch(t.overrideType||t.type){case"mousemove":i=32,void 0===t.buttons?(n=3,void 0!==t.button&&(n=t.button<3?t.button:3)):n=1&t.buttons?0:4&t.buttons?1:2&t.buttons?2:3;break;case"mouseup":i=0,n=t.button<3?t.button:3;break;case"mousedown":i=1,n=t.button<3?t.button:3;break;case"wheel":if(0===e.viewport.getLinesScrolled(t))return!1;i=t.deltaY<0?0:1,n=4;break;default:return!1}return!(void 0===i||void 0===n||n>4)&&e.coreMouseService.triggerMouseEvent({col:r.col,row:r.row,x:r.x,y:r.y,button:n,action:i,ctrl:t.ctrlKey,alt:t.altKey,shift:t.shiftKey})}const n={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o={mouseup:e=>(r(e),e.buttons||(this._document.removeEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.removeEventListener("mousemove",n.mousedrag)),this.cancel(e)),wheel:e=>(r(e),this.cancel(e,!0)),mousedrag:e=>{e.buttons&&r(e)},mousemove:e=>{e.buttons||r(e)}};this.register(this.coreMouseService.onProtocolChange(e=>{e?("debug"===this.optionsService.rawOptions.logLevel&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(e)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&e?n.mousemove||(t.addEventListener("mousemove",o.mousemove),n.mousemove=o.mousemove):(t.removeEventListener("mousemove",n.mousemove),n.mousemove=null),16&e?n.wheel||(t.addEventListener("wheel",o.wheel,{passive:!1}),n.wheel=o.wheel):(t.removeEventListener("wheel",n.wheel),n.wheel=null),2&e?n.mouseup||(t.addEventListener("mouseup",o.mouseup),n.mouseup=o.mouseup):(this._document.removeEventListener("mouseup",n.mouseup),t.removeEventListener("mouseup",n.mouseup),n.mouseup=null),4&e?n.mousedrag||(n.mousedrag=o.mousedrag):(this._document.removeEventListener("mousemove",n.mousedrag),n.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,i.addDisposableDomListener)(t,"mousedown",e=>{if(e.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(e))return r(e),n.mouseup&&this._document.addEventListener("mouseup",n.mouseup),n.mousedrag&&this._document.addEventListener("mousemove",n.mousedrag),this.cancel(e)})),this.register((0,i.addDisposableDomListener)(t,"wheel",e=>{if(!n.wheel){if(!this.buffer.hasScrollback){const t=this.viewport.getLinesScrolled(e);if(0===t)return;const r=R.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(e.deltaY<0?"A":"B");let n="";for(let e=0;e<Math.abs(t);e++)n+=r;return this.coreService.triggerDataEvent(n,!0),this.cancel(e,!0)}return this.viewport.handleWheel(e)?this.cancel(e):void 0}},{passive:!1})),this.register((0,i.addDisposableDomListener)(t,"touchstart",e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(e),this.cancel(e)},{passive:!0})),this.register((0,i.addDisposableDomListener)(t,"touchmove",e=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(e)?void 0:this.cancel(e)},{passive:!1}))}refresh(e,t){var r;null===(r=this._renderService)||void 0===r||r.refreshRows(e,t)}updateCursorStyle(e){var t;(null===(t=this._selectionService)||void 0===t?void 0:t.shouldColumnSelect(e))?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t,r=0){var n;1===r?(super.scrollLines(e,t,r),this.refresh(0,this.rows-1)):null===(n=this.viewport)||void 0===n||n.scrollLines(e)}paste(e){(0,n.paste)(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}registerLinkProvider(e){return this.linkifier2.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const 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}select(e,t,r){this._selectionService.setSelection(e,t,r)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;null===(e=this._selectionService)||void 0===e||e.clearSelection()}selectAll(){var e;null===(e=this._selectionService)||void 0===e||e.selectAll()}selectLines(e,t){var r;null===(r=this._selectionService)||void 0===r||r.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;const 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(),!1;t||"Dead"!==e.key&&"AltGraph"!==e.key||(this._unprocessedDeadKey=!0);const r=(0,A.evaluateKeyboardEvent)(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),3===r.type||2===r.type){const t=this.rows-1;return this.scrollLines(2===r.type?-t:t),this.cancel(e,!0)}return 1===r.type&&this.selectAll(),!!this._isThirdLevelShift(this.browser,e)||(r.cancel&&this.cancel(e,!0),!r.key||!!(e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&1===e.key.length&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(r.key!==R.C0.ETX&&r.key!==R.C0.CR||(this.textarea.value=""),this._onKey.fire({key:r.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(r.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey?this.cancel(e,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(e,t){const r=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"keypress"===t.type?r:r&&(!t.keyCode||t.keyCode>47)}_keyUp(e){var t;this._keyDownSeen=!1,this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(16===(t=e).keyCode||17===t.keyCode||18===t.keyCode||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null===e.which||void 0===e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(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&&"insertText"===e.inputType&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){e!==this.cols||t!==this.rows?super.resize(e,t):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(e,t){var r,n;null===(r=this._charSizeService)||void 0===r||r.measure(),null===(n=this.viewport)||void 0===n||n.syncScrollArea(!0)}clear(){var e;if(0!==this.buffer.ybase||0!==this.buffer.y){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(w.DEFAULT_ATTR_DATA));this._onScroll.fire({position:this.buffer.ydisp,source:0}),null===(e=this.viewport)||void 0===e||e.reset(),this.refresh(0,this.rows-1)}}reset(){var e,t;this.options.rows=this.rows,this.options.cols=this.cols;const r=this._customKeyEventHandler;this._setup(),super.reset(),null===(e=this._selectionService)||void 0===e||e.reset(),this._decorationService.reset(),null===(t=this.viewport)||void 0===t||t.reset(),this._customKeyEventHandler=r,this.refresh(0,this.rows-1)}clearTextureAtlas(){var e;null===(e=this._renderService)||void 0===e||e.clearTextureAtlas()}_reportFocus(){var e;(null===(e=this.element)||void 0===e?void 0:e.classList.contains("focus"))?this.coreService.triggerDataEvent(R.C0.ESC+"[I"):this.coreService.triggerDataEvent(R.C0.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case P.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:const e=this._renderService.dimensions.css.canvas.width.toFixed(0),t=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${R.C0.ESC}[4;${t};${e}t`);break;case P.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:const r=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${R.C0.ESC}[6;${n};${r}t`)}}cancel(e,t){if(this.options.cancelEvents||t)return e.preventDefault(),e.stopPropagation(),!1}}t.Terminal=_},9924:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TimeBasedDebouncer=void 0,t.TimeBasedDebouncer=class{constructor(e,t=1e3){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,r){this._rowCount=r,e=void 0!==e?e:0,t=void 0!==t?t:this._rowCount-1,this._rowStart=void 0!==this._rowStart?Math.min(this._rowStart,e):e,this._rowEnd=void 0!==this._rowEnd?Math.max(this._rowEnd,t):t;const n=Date.now();if(n-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=n,this._innerRefresh();else if(!this._additionalRefreshRequested){const e=n-this._lastRefreshMs,t=this._debounceThresholdMS-e;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},t)}}_innerRefresh(){if(void 0===this._rowStart||void 0===this._rowEnd||void 0===this._rowCount)return;const 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)}}},1680:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;const o=r(3656),a=r(4725),s=r(8460),l=r(844),c=r(2585);let u=t.Viewport=class extends l.Disposable{constructor(e,t,r,n,i,a,l,c){super(),this._viewportElement=e,this._scrollArea=t,this._bufferService=r,this._optionsService=n,this._charSizeService=i,this._renderService=a,this._coreBrowserService=l,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new s.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,o.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(e=>this._renderDimensions=e)),this._handleThemeChange(c.colors),this.register(c.onChangeColors(e=>this._handleThemeChange(e))),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.syncScrollArea())),setTimeout(()=>this.syncScrollArea())}_handleThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame(()=>this.syncScrollArea())}_refresh(e){if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderService.dimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.css.canvas.height);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(e)}_handleScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:t,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||-1===this._smoothScrollState.origin||-1===this._smoothScrollState.target)return;const e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,t){const r=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&r<this._lastRecordedBufferHeight)||(e.cancelable&&e.preventDefault(),!1)}handleWheel(e){const t=this._getPixelsScrolled(e);return 0!==t&&(this._optionsService.rawOptions.smoothScrollDuration?(this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,-1===this._smoothScrollState.target?this._smoothScrollState.target=this._viewportElement.scrollTop+t:this._smoothScrollState.target+=t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()):this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}scrollLines(e){if(0!==e)if(this._optionsService.rawOptions.smoothScrollDuration){const t=e*this._currentRowHeight;this._smoothScrollState.startTime=Date.now(),this._smoothScrollPercent()<1?(this._smoothScrollState.origin=this._viewportElement.scrollTop,this._smoothScrollState.target=this._smoothScrollState.origin+t,this._smoothScrollState.target=Math.max(Math.min(this._smoothScrollState.target,this._viewportElement.scrollHeight),0),this._smoothScroll()):this._clearSmoothScrollState()}else this._onRequestScrollLines.fire({amount:e,suppressScrollEvent:!1})}_getPixelsScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_LINE?t*=this._currentRowHeight:e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._currentRowHeight*this._bufferService.rows),t}getBufferElements(e,t){var r;let n,i="";const o=[],a=null!=t?t:this._bufferService.buffer.lines.length,s=this._bufferService.buffer.lines;for(let l=e;l<a;l++){const e=s.get(l);if(!e)continue;const t=null===(r=s.get(l+1))||void 0===r?void 0:r.isWrapped;if(i+=e.translateToString(!t),!t||l===s.length-1){const e=document.createElement("div");e.textContent=i,o.push(e),i.length>0&&(n=e),i=""}}return{bufferElements:o,cursorElement:n}}getLinesScrolled(e){if(0===e.deltaY||e.shiftKey)return 0;let t=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(t/=this._currentRowHeight+0,this._wheelPartialScroll+=t,t=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t}_applyScrollModifier(e,t){const r=this._optionsService.rawOptions.fastScrollModifier;return"alt"===r&&t.altKey||"ctrl"===r&&t.ctrlKey||"shift"===r&&t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(e){this._lastTouchY=e.touches[0].pageY}handleTouchMove(e){const t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))}};t.Viewport=u=n([i(2,c.IBufferService),i(3,c.IOptionsService),i(4,a.ICharSizeService),i(5,a.IRenderService),i(6,a.ICoreBrowserService),i(7,a.IThemeService)],u)},3107:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferDecorationRenderer=void 0;const o=r(3656),a=r(4725),s=r(844),l=r(2585);let c=t.BufferDecorationRenderer=class extends s.Disposable{constructor(e,t,r,n){super(),this._screenElement=e,this._bufferService=t,this._decorationService=r,this._renderService=n,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((0,o.addDisposableDomListener)(window,"resize",()=>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(e=>this._removeDecoration(e))),this.register((0,s.toDisposable)(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){void 0===this._animationFrame&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var t,r;const n=document.createElement("div");n.classList.add("xterm-decoration"),n.classList.toggle("xterm-decoration-top-layer","top"===(null===(t=null==e?void 0:e.options)||void 0===t?void 0:t.layer)),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=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const i=null!==(r=e.options.x)&&void 0!==r?r:0;return i&&i>this._bufferService.cols&&(n.style.display="none"),this._refreshXPosition(e,n),n}_refreshStyle(e){const 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 r=this._decorationElements.get(e);r||(r=this._createElement(e),e.element=r,this._decorationElements.set(e,r),this._container.appendChild(r),e.onDispose(()=>{this._decorationElements.delete(e),r.remove()})),r.style.top=t*this._renderService.dimensions.css.cell.height+"px",r.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(r)}}_refreshXPosition(e,t=e.element){var r;if(!t)return;const n=null!==(r=e.options.x)&&void 0!==r?r:0;"right"===(e.options.anchor||"left")?t.style.right=n?n*this._renderService.dimensions.css.cell.width+"px":"":t.style.left=n?n*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(e){var t;null===(t=this._decorationElements.get(e))||void 0===t||t.remove(),this._decorationElements.delete(e),e.dispose()}};t.BufferDecorationRenderer=c=n([i(1,l.IBufferService),i(2,l.IDecorationService),i(3,a.IRenderService)],c)},5871:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorZoneStore=void 0,t.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(const 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))return void this._addLineToZone(t,e.marker.line)}if(this._zonePoolIndex<this._zonePool.length)return 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,void this._zones.push(this._zonePool[this._zonePoolIndex++]);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,r){return t>=e.startBufferLine-this._linePadding[r||"full"]&&t<=e.endBufferLine+this._linePadding[r||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}}},5744:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OverviewRulerRenderer=void 0;const o=r(5871),a=r(3656),s=r(4725),l=r(844),c=r(2585),u={full:0,left:0,center:0,right:0},d={full:0,left:0,center:0,right:0},p={full:0,left:0,center:0,right:0};let h=t.OverviewRulerRenderer=class extends l.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(e,t,r,n,i,a,s){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=r,this._decorationService=n,this._renderService=i,this._optionsService=a,this._coreBrowseService=s,this._colorZoneStore=new o.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),null===(c=this._viewportElement.parentElement)||void 0===c||c.insertBefore(this._canvas,this._viewportElement);const u=this._canvas.getContext("2d");if(!u)throw new Error("Ctx cannot be null");this._ctx=u,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,l.toDisposable)(()=>{var e;null===(e=this._canvas)||void 0===e||e.remove()}))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",()=>this._queueRefresh(!0))),this.register((0,a.addDisposableDomListener)(this._coreBrowseService.window,"resize",()=>this._queueRefresh(!0))),this._queueRefresh(!0)}_refreshDrawConstants(){const e=Math.floor(this._canvas.width/3),t=Math.ceil(this._canvas.width/3);d.full=this._canvas.width,d.left=e,d.center=t,d.right=e,this._refreshDrawHeightConstants(),p.full=0,p.left=0,p.center=d.left,p.right=d.left+d.center}_refreshDrawHeightConstants(){u.full=Math.round(2*this._coreBrowseService.dpr);const e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowseService.dpr);u.left=t,u.center=t,u.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*u.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._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const t of this._decorationService.decorations)this._colorZoneStore.addDecoration(t);this._ctx.lineWidth=1;const e=this._colorZoneStore.zones;for(const t of e)"full"!==t.position&&this._renderColorZone(t);for(const t of e)"full"===t.position&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(p[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-u[e.position||"full"]/2),d[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+u[e.position||"full"]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,void 0===this._animationFrame&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};t.OverviewRulerRenderer=h=n([i(2,c.IBufferService),i(3,c.IDecorationService),i(4,s.IRenderService),i(5,c.IOptionsService),i(6,s.ICoreBrowserService)],h)},2950:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;const o=r(4725),a=r(2585),s=r(2584);let l=t.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(e,t,r,n,i,o){this._textarea=e,this._compositionView=t,this._bufferService=r,this._optionsService=n,this._coreService=i,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let t;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const t=this._textarea.value,r=t.replace(e,"");this._dataAlreadySent=r,t.length>e.length?this._coreService.triggerDataEvent(r,!0):t.length<e.length?this._coreService.triggerDataEvent(`${s.C0.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){const e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=t+"px",this._compositionView.style.lineHeight=t+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";const i=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(i.width,1)+"px",this._textarea.style.height=Math.max(i.height,1)+"px",this._textarea.style.lineHeight=i.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};t.CompositionHelper=l=n([i(2,a.IBufferService),i(3,a.IOptionsService),i(4,a.ICoreService),i(5,o.IRenderService)],l)},9806:(e,t)=>{function r(e,t,r){const n=r.getBoundingClientRect(),i=e.getComputedStyle(r),o=parseInt(i.getPropertyValue("padding-left")),a=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-n.left-o,t.clientY-n.top-a]}Object.defineProperty(t,"__esModule",{value:!0}),t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=r,t.getCoords=function(e,t,n,i,o,a,s,l,c){if(!a)return;const u=r(e,t,n);return u?(u[0]=Math.ceil((u[0]+(c?s/2:0))/s),u[1]=Math.ceil(u[1]/l),u[0]=Math.min(Math.max(u[0],1),i+(c?1:0)),u[1]=Math.min(Math.max(u[1],1),o),u):void 0}},9504:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;const n=r(2584);function i(e,t,r,n){const i=e-o(e,r),s=t-o(t,r);return c(Math.abs(i-s)-function(e,t,r){let n=0;const i=e-o(e,r),s=t-o(t,r);for(let o=0;o<Math.abs(i-s);o++){const s="A"===a(e,t)?-1:1,l=r.buffer.lines.get(i+s*o);(null==l?void 0:l.isWrapped)&&n++}return n}(e,t,r),l(a(e,t),n))}function o(e,t){let r=0,n=t.buffer.lines.get(e),i=null==n?void 0:n.isWrapped;for(;i&&e>=0&&e<t.rows;)r++,n=t.buffer.lines.get(--e),i=null==n?void 0:n.isWrapped;return r}function a(e,t){return e>t?"A":"B"}function s(e,t,r,n,i,o){let a=e,s=t,l="";for(;a!==r||s!==n;)a+=i?1:-1,i&&a>o.cols-1?(l+=o.buffer.translateBufferLineToString(s,!1,e,a),a=0,e=0,s++):!i&&a<0&&(l+=o.buffer.translateBufferLineToString(s,!1,0,e+1),a=o.cols-1,e=a,s--);return l+o.buffer.translateBufferLineToString(s,!1,e,a)}function l(e,t){const r=t?"O":"[";return n.C0.ESC+r+e}function c(e,t){e=Math.floor(e);let r="";for(let n=0;n<e;n++)r+=t;return r}t.moveToCellSequence=function(e,t,r,n){const a=r.buffer.x,u=r.buffer.y;if(!r.buffer.hasScrollback)return d=a,(0===i(p=u,t,h=r,f=n).length?"":c(s(d,p,d,p-o(p,h),!1,h).length,l("D",f)))+i(u,t,r,n)+function(e,t,r,n,a,u){let d;d=i(t,n,a,u).length>0?n-o(n,a):t;const p=n,h=function(e,t,r,n,a,s){let l;return l=i(r,n,a,s).length>0?n-o(n,a):t,e<r&&l<=n||e>=r&&l<n?"C":"D"}(e,t,r,n,a,u);return c(s(e,d,r,p,"C"===h,a).length,l(h,u))}(a,u,e,t,r,n);var d,p,h,f;let g;if(u===t)return g=a>e?"D":"C",c(Math.abs(a-e),l(g,n));g=u>t?"D":"C";const m=Math.abs(u-t);return c(function(e,t){return t.cols-e}(u>t?e:a,r)+(m-1)*r.cols+1+((u>t?a:e)-1),l(g,n))}},1296:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;const o=r(3787),a=r(2550),s=r(2223),l=r(6171),c=r(4725),u=r(8055),d=r(8460),p=r(844),h=r(2585),f="xterm-dom-renderer-owner-",g="xterm-rows",m="xterm-fg-",v="xterm-bg-",y="xterm-focus",b="xterm-selection";let q=1,V=t.DomRenderer=class extends p.Disposable{constructor(e,t,r,n,i,s,c,u,h,m){super(),this._element=e,this._screenElement=t,this._viewportElement=r,this._linkifier2=n,this._charSizeService=s,this._optionsService=c,this._bufferService=u,this._coreBrowserService=h,this._themeService=m,this._terminalClass=q++,this._rowElements=[],this.onRequestRedraw=this.register(new d.EventEmitter).event,this._rowContainer=document.createElement("div"),this._rowContainer.classList.add(g),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add(b),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,l.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=i.createInstance(o.DomRendererRowFactory,document),this._element.classList.add(f+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this.register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this.register((0,p.toDisposable)(()=>{this._element.classList.remove(f+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new a.WidthCache(document),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const 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(const r of this._rowElements)r.style.width=`${this.dimensions.css.canvas.width}px`,r.style.height=`${this.dimensions.css.cell.height}px`,r.style.lineHeight=`${this.dimensions.css.cell.height}px`,r.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const t=`${this._terminalSelector} .${g} 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=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${g} { 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} .${g} .xterm-dim { color: ${u.color.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;}`,t+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { border-bottom-style: hidden; }}",t+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink:not(.xterm-cursor-block) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${g}.${y} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${g} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${b} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${b} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${b} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(const[r,n]of e.ansi.entries())t+=`${this._terminalSelector} .${m}${r} { color: ${n.css}; }${this._terminalSelector} .${m}${r}.xterm-dim { color: ${u.color.multiplyOpacity(n,.5).css}; }${this._terminalSelector} .${v}${r} { background-color: ${n.css}; }`;t+=`${this._terminalSelector} .${m}${s.INVERTED_DEFAULT_COLOR} { color: ${u.color.opaque(e.background).css}; }${this._terminalSelector} .${m}${s.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${u.color.multiplyOpacity(u.color.opaque(e.background),.5).css}; }${this._terminalSelector} .${v}${s.INVERTED_DEFAULT_COLOR} { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){const 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 r=this._rowElements.length;r<=t;r++){const e=document.createElement("div");this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions()}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(y)}handleFocus(){this._rowContainer.classList.add(y),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,r){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,r),this.renderRows(0,this._bufferService.rows-1),!e||!t)return;const n=e[1]-this._bufferService.buffer.ydisp,i=t[1]-this._bufferService.buffer.ydisp,o=Math.max(n,0),a=Math.min(i,this._bufferService.rows-1);if(o>=this._bufferService.rows||a<0)return;const s=document.createDocumentFragment();if(r){const r=e[0]>t[0];s.appendChild(this._createSelectionElement(o,r?t[0]:e[0],r?e[0]:t[0],a-o+1))}else{const r=n===o?e[0]:0,l=o===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,r,l));const c=a-o-1;if(s.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,c)),o!==a){const e=i===a?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,r,n=1){const i=document.createElement("div");return i.style.height=n*this.dimensions.css.cell.height+"px",i.style.top=e*this.dimensions.css.cell.height+"px",i.style.left=t*this.dimensions.css.cell.width+"px",i.style.width=this.dimensions.css.cell.width*(r-t)+"px",i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const e of this._rowElements)e.replaceChildren()}renderRows(e,t){const r=this._bufferService.buffer,n=r.ybase+r.y,i=Math.min(r.x,this._bufferService.cols-1),o=this._optionsService.rawOptions.cursorBlink,a=this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){const e=l+r.ydisp,t=this._rowElements[l],c=r.lines.get(e);if(!t||!c)break;t.replaceChildren(...this._rowFactory.createRow(c,e,e===n,a,s,i,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${f}${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,r,n,i,o){r<0&&(e=0),n<0&&(t=0);const a=this._bufferService.rows-1;r=Math.max(Math.min(r,a),0),n=Math.max(Math.min(n,a),0),i=Math.min(i,this._bufferService.cols);const s=this._bufferService.buffer,l=s.ybase+s.y,c=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let h=r;h<=n;++h){const a=h+s.ydisp,f=this._rowElements[h],g=s.lines.get(a);if(!f||!g)break;f.replaceChildren(...this._rowFactory.createRow(g,a,a===l,d,p,c,u,this.dimensions.css.cell.width,this._widthCache,o?h===r?e:0:-1,o?(h===n?t:i)-1:-1))}}};t.DomRenderer=V=n([i(4,h.IInstantiationService),i(5,c.ICharSizeService),i(6,h.IOptionsService),i(7,h.IBufferService),i(8,c.ICoreBrowserService),i(9,c.IThemeService)],V)},3787:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=void 0;const o=r(2223),a=r(643),s=r(511),l=r(2585),c=r(8055),u=r(4725),d=r(4269),p=r(6171),h=r(3734);let f=t.DomRendererRowFactory=class{constructor(e,t,r,n,i,o,a){this._document=e,this._characterJoinerService=t,this._optionsService=r,this._coreBrowserService=n,this._coreService=i,this._decorationService=o,this._themeService=a,this._workCell=new s.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,r){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=r}createRow(e,t,r,n,i,s,l,u,p,f,m){const v=[],y=this._characterJoinerService.getJoinedCharacters(t),b=this._themeService.colors;let q,V=e.getNoBgTrimmedLength();r&&V<s+1&&(V=s+1);let S=0,E="",x=0,C=0,w=0,R=!1,A=0,T=!1,k=0;const N=[],P=-1!==f&&-1!==m;for(let O=0;O<V;O++){e.loadCell(O,this._workCell);let V=this._workCell.getWidth();if(0===V)continue;let F=!1,_=O,D=this._workCell;if(y.length>0&&O===y[0][0]){F=!0;const t=y.shift();D=new d.JoinedCellData(this._workCell,e.translateToString(!0,t[0],t[1]),t[1]-t[0]),_=t[1]-1,V=D.getWidth()}const I=this._isCellInSelection(O,t),U=r&&O===s,L=P&&O>=f&&O<=m;let B=!1;this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{B=!0});let W=D.getChars()||a.WHITESPACE_CELL_CHAR;if(" "===W&&(D.isUnderline()||D.isOverline())&&(W=" "),k=V*u-p.get(W,D.isBold(),D.isItalic()),q){if(S&&(I&&T||!I&&!T&&D.bg===x)&&(I&&T&&b.selectionForeground||D.fg===C)&&D.extended.ext===w&&L===R&&k===A&&!U&&!F&&!B){E+=W,S++;continue}S&&(q.textContent=E),q=this._document.createElement("span"),S=0,E=""}else q=this._document.createElement("span");if(x=D.bg,C=D.fg,w=D.extended.ext,R=L,A=k,T=I,F&&s>=O&&s<=_&&(s=O),!this._coreService.isCursorHidden&&U)if(N.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&N.push("xterm-cursor-blink"),N.push("bar"===n?"xterm-cursor-bar":"underline"===n?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){case"outline":N.push("xterm-cursor-outline");break;case"block":N.push("xterm-cursor-block");break;case"bar":N.push("xterm-cursor-bar");break;case"underline":N.push("xterm-cursor-underline")}if(D.isBold()&&N.push("xterm-bold"),D.isItalic()&&N.push("xterm-italic"),D.isDim()&&N.push("xterm-dim"),E=D.isInvisible()?a.WHITESPACE_CELL_CHAR:D.getChars()||a.WHITESPACE_CELL_CHAR,D.isUnderline()&&(N.push(`xterm-underline-${D.extended.underlineStyle}`)," "===E&&(E=" "),!D.isUnderlineColorDefault()))if(D.isUnderlineColorRGB())q.style.textDecorationColor=`rgb(${h.AttributeData.toColorRGB(D.getUnderlineColor()).join(",")})`;else{let e=D.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&D.isBold()&&e<8&&(e+=8),q.style.textDecorationColor=b.ansi[e].css}D.isOverline()&&(N.push("xterm-overline")," "===E&&(E=" ")),D.isStrikethrough()&&N.push("xterm-strikethrough"),L&&(q.style.textDecoration="underline");let M=D.getFgColor(),j=D.getFgColorMode(),K=D.getBgColor(),H=D.getBgColorMode();const z=!!D.isInverse();if(z){const e=M;M=K,K=e;const t=j;j=H,H=t}let X,G,Z,Y=!1;switch(this._decorationService.forEachDecorationAtCell(O,t,void 0,e=>{"top"!==e.options.layer&&Y||(e.backgroundColorRGB&&(H=50331648,K=e.backgroundColorRGB.rgba>>8&16777215,X=e.backgroundColorRGB),e.foregroundColorRGB&&(j=50331648,M=e.foregroundColorRGB.rgba>>8&16777215,G=e.foregroundColorRGB),Y="top"===e.options.layer)}),!Y&&I&&(X=this._coreBrowserService.isFocused?b.selectionBackgroundOpaque:b.selectionInactiveBackgroundOpaque,K=X.rgba>>8&16777215,H=50331648,Y=!0,b.selectionForeground&&(j=50331648,M=b.selectionForeground.rgba>>8&16777215,G=b.selectionForeground)),Y&&N.push("xterm-decoration-top"),H){case 16777216:case 33554432:Z=b.ansi[K],N.push(`xterm-bg-${K}`);break;case 50331648:Z=c.rgba.toColor(K>>16,K>>8&255,255&K),this._addStyle(q,`background-color:#${g((K>>>0).toString(16),"0",6)}`);break;default:z?(Z=b.foreground,N.push(`xterm-bg-${o.INVERTED_DEFAULT_COLOR}`)):Z=b.background}switch(X||D.isDim()&&(X=c.color.multiplyOpacity(Z,.5)),j){case 16777216:case 33554432:D.isBold()&&M<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(M+=8),this._applyMinimumContrast(q,Z,b.ansi[M],D,X,void 0)||N.push(`xterm-fg-${M}`);break;case 50331648:const e=c.rgba.toColor(M>>16&255,M>>8&255,255&M);this._applyMinimumContrast(q,Z,e,D,X,G)||this._addStyle(q,`color:#${g(M.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(q,Z,b.foreground,D,X,void 0)||z&&N.push(`xterm-fg-${o.INVERTED_DEFAULT_COLOR}`)}N.length&&(q.className=N.join(" "),N.length=0),U||F||B?q.textContent=E:S++,k!==this.defaultSpacing&&(q.style.letterSpacing=`${k}px`),v.push(q),O=_}return q&&S&&(q.textContent=E),v}_applyMinimumContrast(e,t,r,n,i,o){if(1===this._optionsService.rawOptions.minimumContrastRatio||(0,p.excludeFromContrastRatioDemands)(n.getCode()))return!1;const a=this._getContrastCache(n);let s;if(i||o||(s=a.getColor(t.rgba,r.rgba)),void 0===s){const e=this._optionsService.rawOptions.minimumContrastRatio/(n.isDim()?2:1);s=c.color.ensureContrastRatio(i||t,o||r,e),a.setColor((i||t).rgba,(o||r).rgba,null!=s?s:null)}return!!s&&(this._addStyle(e,`color:${s.css}`),!0)}_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){const r=this._selectionStart,n=this._selectionEnd;return!(!r||!n)&&(this._columnSelectMode?r[0]<=n[0]?e>=r[0]&&t>=r[1]&&e<n[0]&&t<=n[1]:e<r[0]&&t>=r[1]&&e>=n[0]&&t<=n[1]:t>r[1]&&t<n[1]||r[1]===n[1]&&t===r[1]&&e>=r[0]&&e<n[0]||r[1]<n[1]&&t===n[1]&&e<n[0]||r[1]<n[1]&&t===r[1]&&e>=r[0])}};function g(e,t,r){for(;e.length<r;)e=t+e;return e}t.DomRendererRowFactory=f=n([i(1,u.ICharacterJoinerService),i(2,l.IOptionsService),i(3,u.ICoreBrowserService),i(4,l.ICoreService),i(5,l.IDecorationService),i(6,u.IThemeService)],f)},2550:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WidthCache=void 0,t.WidthCache=class{constructor(e){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.style.position="absolute",this._container.style.top="-50000px",this._container.style.width="50000px",this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const t=e.createElement("span"),r=e.createElement("span");r.style.fontWeight="bold";const n=e.createElement("span");n.style.fontStyle="italic";const i=e.createElement("span");i.style.fontWeight="bold",i.style.fontStyle="italic",this._measureElements=[t,r,n,i],this._container.appendChild(t),this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(i),e.body.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,r,n){e===this._font&&t===this._fontSize&&r===this._weight&&n===this._weightBold||(this._font=e,this._fontSize=t,this._weight=r,this._weightBold=n,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${r}`,this._measureElements[1].style.fontWeight=`${n}`,this._measureElements[2].style.fontWeight=`${r}`,this._measureElements[3].style.fontWeight=`${n}`,this.clear())}get(e,t,r){let n=0;if(!t&&!r&&1===e.length&&(n=e.charCodeAt(0))<256)return-9999!==this._flat[n]?this._flat[n]:this._flat[n]=this._measure(e,0);let i=e;t&&(i+="B"),r&&(i+="I");let o=this._holey.get(i);if(void 0===o){let n=0;t&&(n|=1),r&&(n|=2),o=this._measure(e,n),this._holey.set(i,o)}return o}_measure(e,t){const r=this._measureElements[t];return r.textContent=e.repeat(32),r.offsetWidth/32}}},2223:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TEXT_BASELINE=t.DIM_OPACITY=t.INVERTED_DEFAULT_COLOR=void 0;const n=r(6114);t.INVERTED_DEFAULT_COLOR=257,t.DIM_OPACITY=.5,t.TEXT_BASELINE=n.isFirefox||n.isLegacyEdge?"bottom":"ideographic"},6171:(e,t)=>{function r(e){return 57508<=e&&e<=57558}Object.defineProperty(t,"__esModule",{value:!0}),t.createRenderDimensions=t.excludeFromContrastRatioDemands=t.isRestrictedPowerlineGlyph=t.isPowerlineGlyph=t.throwIfFalsy=void 0,t.throwIfFalsy=function(e){if(!e)throw new Error("value must not be falsy");return e},t.isPowerlineGlyph=r,t.isRestrictedPowerlineGlyph=function(e){return 57520<=e&&e<=57527},t.excludeFromContrastRatioDemands=function(e){return r(e)||9472<=(t=e)&&t<=9631;var t},t.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}}},456:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionModel=void 0,t.SelectionModel=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.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const 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]){const 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(){const e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(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)}}},428:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;const o=r(2585),a=r(8460),s=r(844);let l=t.CharSizeService=class extends s.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(e,t,r){super(),this._optionsService=r,this.width=0,this.height=0,this._onCharSizeChange=this.register(new a.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event,this._measureStrategy=new c(e,t,this._optionsService),this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],()=>this.measure()))}measure(){const e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};t.CharSizeService=l=n([i(2,o.IOptionsService)],l);class c{constructor(e,t,r){this._document=e,this._parentElement=t,this._optionsService=r,this._result={width:0,height:0},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(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const e={height:Number(this._measureElement.offsetHeight),width:Number(this._measureElement.offsetWidth)};return 0!==e.width&&0!==e.height&&(this._result.width=e.width/32,this._result.height=Math.ceil(e.height)),this._result}}},4269:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerService=t.JoinedCellData=void 0;const o=r(3734),a=r(643),s=r(511),l=r(2585);class c extends o.AttributeData{constructor(e,t,r){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=r}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()]}}t.JoinedCellData=c;let u=t.CharacterJoinerService=class e{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}register(e){const 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(0===this._characterJoiners.length)return[];const t=this._bufferService.buffer.lines.get(e);if(!t||0===t.length)return[];const r=[],n=t.translateToString(!0);let i=0,o=0,s=0,l=t.getFg(0),c=t.getBg(0);for(let u=0;u<t.getTrimmedLength();u++)if(t.loadCell(u,this._workCell),0!==this._workCell.getWidth()){if(this._workCell.fg!==l||this._workCell.bg!==c){if(u-i>1){const e=this._getJoinedRanges(n,s,o,t,i);for(let t=0;t<e.length;t++)r.push(e[t])}i=u,s=o,l=this._workCell.fg,c=this._workCell.bg}o+=this._workCell.getChars().length||a.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-i>1){const e=this._getJoinedRanges(n,s,o,t,i);for(let t=0;t<e.length;t++)r.push(e[t])}return r}_getJoinedRanges(t,r,n,i,o){const a=t.substring(r,n);let s=[];try{s=this._characterJoiners[0].handler(a)}catch(l){}for(let c=1;c<this._characterJoiners.length;c++)try{const t=this._characterJoiners[c].handler(a);for(let r=0;r<t.length;r++)e._mergeRanges(s,t[r])}catch(l){}return this._stringRangesToCellRanges(s,i,o),s}_stringRangesToCellRanges(e,t,r){let n=0,i=!1,o=0,s=e[n];if(s){for(let l=r;l<this._bufferService.cols;l++){const r=t.getWidth(l),c=t.getString(l).length||a.WHITESPACE_CELL_CHAR.length;if(0!==r){if(!i&&s[0]<=o&&(s[0]=l,i=!0),s[1]<=o){if(s[1]=l,s=e[++n],!s)break;s[0]<=o?(s[0]=l,i=!0):i=!1}o+=c}}s&&(s[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let r=!1;for(let n=0;n<e.length;n++){const i=e[n];if(r){if(t[1]<=i[0])return e[n-1][1]=t[1],e;if(t[1]<=i[1])return e[n-1][1]=Math.max(t[1],i[1]),e.splice(n,1),e;e.splice(n,1),n--}else{if(t[1]<=i[0])return e.splice(n,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),r=!0)}}return r?e[e.length-1][1]=t[1]:e.push(t),e}};t.CharacterJoinerService=u=n([i(0,l.IBufferService)],u)},5114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0,t.CoreBrowserService=class{constructor(e,t){this._textarea=e,this.window=t,this._isFocused=!1,this._cachedIsFocused=void 0,this._textarea.addEventListener("focus",()=>this._isFocused=!0),this._textarea.addEventListener("blur",()=>this._isFocused=!1)}get dpr(){return this.window.devicePixelRatio}get isFocused(){return void 0===this._cachedIsFocused&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}}},8934:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;const o=r(4725),a=r(9806);let s=t.MouseService=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,r,n,i){return(0,a.getCoords)(window,e,t,r,n,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){const r=(0,a.getCoordsRelativeToElement)(window,e,t);if(this._charSizeService.hasValidSize)return r[0]=Math.min(Math.max(r[0],0),this._renderService.dimensions.css.canvas.width-1),r[1]=Math.min(Math.max(r[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(r[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(r[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(r[0]),y:Math.floor(r[1])}}};t.MouseService=s=n([i(0,o.IRenderService),i(1,o.ICharSizeService)],s)},3230:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;const o=r(3656),a=r(6193),s=r(5596),l=r(4725),c=r(8460),u=r(844),d=r(7226),p=r(2585);let h=t.RenderService=class extends u.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(e,t,r,n,i,l,p,h){if(super(),this._rowCount=e,this._charSizeService=n,this._renderer=this.register(new u.MutableDisposable),this._pausedResizeTask=new d.DebouncedIdleTask,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new c.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new c.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new c.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new c.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new a.RenderDebouncer(p.window,(e,t)=>this._renderRows(e,t)),this.register(this._renderDebouncer),this._screenDprMonitor=new s.ScreenDprMonitor(p.window),this._screenDprMonitor.setListener(()=>this.handleDevicePixelRatioChange()),this.register(this._screenDprMonitor),this.register(l.onResize(()=>this._fullRefresh())),this.register(l.buffers.onBufferActivate(()=>{var e;return null===(e=this._renderer.value)||void 0===e?void 0:e.clear()})),this.register(r.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this.register(i.onDecorationRegistered(()=>this._fullRefresh())),this.register(i.onDecorationRemoved(()=>this._fullRefresh())),this.register(r.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this.register(r.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this.register((0,o.addDisposableDomListener)(p.window,"resize",()=>this.handleDevicePixelRatioChange())),this.register(h.onChangeColors(()=>this._fullRefresh())),"IntersectionObserver"in p.window){const e=new p.window.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});e.observe(t),this.register({dispose:()=>e.disconnect()})}}_handleIntersectionChange(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!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,r=!1){this._isPaused?this._needsFullRefresh=!0:(r||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))}_renderRows(e,t){this._renderer.value&&(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.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&(null===(t=(e=this._renderer.value).clearTextureAtlas)||void 0===t||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;null===(e=this._renderer.value)||void 0===e||e.handleCharSizeChanged()}handleBlur(){var e;null===(e=this._renderer.value)||void 0===e||e.handleBlur()}handleFocus(){var e;null===(e=this._renderer.value)||void 0===e||e.handleFocus()}handleSelectionChanged(e,t,r){var n;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=r,null===(n=this._renderer.value)||void 0===n||n.handleSelectionChanged(e,t,r)}handleCursorMove(){var e;null===(e=this._renderer.value)||void 0===e||e.handleCursorMove()}clear(){var e;null===(e=this._renderer.value)||void 0===e||e.clear()}};t.RenderService=h=n([i(2,p.IOptionsService),i(3,l.ICharSizeService),i(4,p.IDecorationService),i(5,p.IBufferService),i(6,l.ICoreBrowserService),i(7,l.IThemeService)],h)},9312:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;const o=r(9806),a=r(9504),s=r(456),l=r(4725),c=r(8460),u=r(844),d=r(6114),p=r(4841),h=r(511),f=r(2585),g=String.fromCharCode(160),m=new RegExp(g,"g");let v=t.SelectionService=class extends u.Disposable{constructor(e,t,r,n,i,o,a,l,d){super(),this._element=e,this._screenElement=t,this._linkifier=r,this._bufferService=n,this._coreService=i,this._mouseService=o,this._optionsService=a,this._renderService=l,this._coreBrowserService=d,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new h.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new c.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new c.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new c.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new c.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this.register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new s.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,u.toDisposable)(()=>{this._removeMouseDownListeners()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])}get selectionText(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";const r=this._bufferService.buffer,n=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";const i=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let a=e[1];a<=t[1];a++){const e=r.translateBufferLineToString(a,!0,i,o);n.push(e)}}else{const i=e[1]===t[1]?t[0]:void 0;n.push(r.translateBufferLineToString(e[1],!0,e[0],i));for(let o=e[1]+1;o<=t[1]-1;o++){const e=r.lines.get(o),t=r.translateBufferLineToString(o,!0);(null==e?void 0:e.isWrapped)?n[n.length-1]+=t:n.push(t)}if(e[1]!==t[1]){const e=r.lines.get(t[1]),i=r.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?n[n.length-1]+=i:n.push(i)}}return n.map(e=>e.replace(m," ")).join(d.isWindows?"\r\n":"\n")}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),d.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})}_isClickInSelection(e){const t=this._getMouseBufferCoords(e),r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!!(r&&n&&t)&&this._areCoordsInSelection(t,r,n)}isCellInSelection(e,t){const r=this._model.finalSelectionStart,n=this._model.finalSelectionEnd;return!(!r||!n)&&this._areCoordsInSelection([e,t],r,n)}_areCoordsInSelection(e,t,r){return e[1]>t[1]&&e[1]<r[1]||t[1]===r[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<r[0]||t[1]<r[1]&&e[1]===r[1]&&e[0]<r[0]||t[1]<r[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var r,n;const i=null===(n=null===(r=this._linkifier.currentLink)||void 0===r?void 0:r.link)||void 0===n?void 0:n.range;if(i)return this._model.selectionStart=[i.start.x-1,i.start.y-1],this._model.selectionStartLength=(0,p.getRangeLength)(i,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const o=this._getMouseBufferCoords(e);return!!o&&(this._selectWordAt(o,t),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){const t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=(0,o.getCoordsRelativeToElement)(this._coreBrowserService.window,e,this._screenElement)[1];const r=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=r?0:(t>r&&(t-=r),t=Math.min(Math.max(t,-50),50),t/=50,t/Math.abs(t)+Math.round(14*t))}shouldForceSelection(e){return d.isMac?e.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:e.shiftKey}handleMouseDown(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._handleIncrementalClick(e):1===e.detail?this._handleSingleClick(e):2===e.detail?this._handleDoubleClick(e):3===e.detail&&this._handleTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))}_handleSingleClick(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}_handleDoubleClick(e){this._selectWordAtCursor(e,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(e){const t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))}shouldColumnSelect(e){return e.altKey&&!(d.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;const t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd)return void this.refresh(!0);2===this._activeSelectionMode?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:1===this._activeSelectionMode&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),3!==this._activeSelectionMode&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const r=this._bufferService.buffer;if(this._model.selectionEnd[1]<r.lines.length){const e=r.lines.get(this._model.selectionEnd[1]);e&&0===e.hasWidth(this._model.selectionEnd[0])&&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});const e=this._bufferService.buffer;this._dragScrollAmount>0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){const t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const t=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(t&&void 0!==t[0]&&void 0!==t[1]){const e=(0,a.moveToCellSequence)(t[0]-1,t[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(e,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,r=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);r?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,r)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,r)}_fireOnSelectionChange(e,t,r){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=r,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(e=>this._handleTrim(e))}_convertViewportColToCharacterIndex(e,t){let r=t;for(let n=0;t>=n;n++){const i=e.loadCell(n,this._workCell).getChars().length;0===this._workCell.getWidth()?r--:i>1&&t!==n&&(r+=i-1)}return r}setSelection(e,t,r){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=r,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,r=!0,n=!0){if(e[0]>=this._bufferService.cols)return;const i=this._bufferService.buffer,o=i.lines.get(e[1]);if(!o)return;const a=i.translateBufferLineToString(e[1],!1);let s=this._convertViewportColToCharacterIndex(o,e[0]),l=s;const c=e[0]-s;let u=0,d=0,p=0,h=0;if(" "===a.charAt(s)){for(;s>0&&" "===a.charAt(s-1);)s--;for(;l<a.length&&" "===a.charAt(l+1);)l++}else{let t=e[0],r=e[0];0===o.getWidth(t)&&(u++,t--),2===o.getWidth(r)&&(d++,r++);const n=o.getString(r).length;for(n>1&&(h+=n-1,l+=n-1);t>0&&s>0&&!this._isCharWordSeparator(o.loadCell(t-1,this._workCell));){o.loadCell(t-1,this._workCell);const e=this._workCell.getChars().length;0===this._workCell.getWidth()?(u++,t--):e>1&&(p+=e-1,s-=e-1),s--,t--}for(;r<o.length&&l+1<a.length&&!this._isCharWordSeparator(o.loadCell(r+1,this._workCell));){o.loadCell(r+1,this._workCell);const e=this._workCell.getChars().length;2===this._workCell.getWidth()?(d++,r++):e>1&&(h+=e-1,l+=e-1),l++,r++}}l++;let f=s+c-u+p,g=Math.min(this._bufferService.cols,l-s+u+d-p-h);if(t||""!==a.slice(s,l).trim()){if(r&&0===f&&32!==o.getCodePoint(0)){const t=i.lines.get(e[1]-1);if(t&&o.isWrapped&&32!==t.getCodePoint(this._bufferService.cols-1)){const t=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(t){const e=this._bufferService.cols-t.start;f-=e,g+=e}}}if(n&&f+g===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){const t=i.lines.get(e[1]+1);if((null==t?void 0:t.isWrapped)&&32!==t.getCodePoint(0)){const t=this._getWordAt([0,e[1]+1],!1,!1,!0);t&&(g+=t.length)}}return{start:f,length:g}}}_selectWordAt(e,t){const r=this._getWordAt(e,t);if(r){for(;r.start<0;)r.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[r.start,e[1]],this._model.selectionStartLength=r.length}}_selectToWordAt(e){const t=this._getWordAt(e,!0);if(t){let r=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,r--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,r++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,r]}}_isCharWordSeparator(e){return 0!==e.getWidth()&&this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){const t=this._bufferService.buffer.getWrappedRangeForLine(e),r={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,p.getRangeLength)(r,this._bufferService.cols)}};t.SelectionService=v=n([i(3,f.IBufferService),i(4,f.ICoreService),i(5,l.IMouseService),i(6,f.IOptionsService),i(7,l.IRenderService),i(8,l.ICoreBrowserService)],v)},4725:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IThemeService=t.ICharacterJoinerService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;const n=r(8343);t.ICharSizeService=(0,n.createDecorator)("CharSizeService"),t.ICoreBrowserService=(0,n.createDecorator)("CoreBrowserService"),t.IMouseService=(0,n.createDecorator)("MouseService"),t.IRenderService=(0,n.createDecorator)("RenderService"),t.ISelectionService=(0,n.createDecorator)("SelectionService"),t.ICharacterJoinerService=(0,n.createDecorator)("CharacterJoinerService"),t.IThemeService=(0,n.createDecorator)("ThemeService")},6731:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.ThemeService=t.DEFAULT_ANSI_COLORS=void 0;const o=r(7239),a=r(8055),s=r(8460),l=r(844),c=r(2585),u=a.css.toColor("#ffffff"),d=a.css.toColor("#000000"),p=a.css.toColor("#ffffff"),h=a.css.toColor("#000000"),f={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const e=[a.css.toColor("#2e3436"),a.css.toColor("#cc0000"),a.css.toColor("#4e9a06"),a.css.toColor("#c4a000"),a.css.toColor("#3465a4"),a.css.toColor("#75507b"),a.css.toColor("#06989a"),a.css.toColor("#d3d7cf"),a.css.toColor("#555753"),a.css.toColor("#ef2929"),a.css.toColor("#8ae234"),a.css.toColor("#fce94f"),a.css.toColor("#729fcf"),a.css.toColor("#ad7fa8"),a.css.toColor("#34e2e2"),a.css.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let r=0;r<216;r++){const n=t[r/36%6|0],i=t[r/6%6|0],o=t[r%6];e.push({css:a.channels.toCss(n,i,o),rgba:a.channels.toRgba(n,i,o)})}for(let r=0;r<24;r++){const t=8+10*r;e.push({css:a.channels.toCss(t,t,t),rgba:a.channels.toRgba(t,t,t)})}return e})());let g=t.ThemeService=class extends l.Disposable{get colors(){return this._colors}constructor(e){super(),this._optionsService=e,this._contrastCache=new o.ColorContrastCache,this._halfContrastCache=new o.ColorContrastCache,this._onChangeColors=this.register(new s.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:u,background:d,cursor:p,cursorAccent:h,selectionForeground:void 0,selectionBackgroundTransparent:f,selectionBackgroundOpaque:a.color.blend(d,f),selectionInactiveBackgroundTransparent:f,selectionInactiveBackgroundOpaque:a.color.blend(d,f),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this.register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}_setTheme(e={}){const r=this._colors;if(r.foreground=m(e.foreground,u),r.background=m(e.background,d),r.cursor=m(e.cursor,p),r.cursorAccent=m(e.cursorAccent,h),r.selectionBackgroundTransparent=m(e.selectionBackground,f),r.selectionBackgroundOpaque=a.color.blend(r.background,r.selectionBackgroundTransparent),r.selectionInactiveBackgroundTransparent=m(e.selectionInactiveBackground,r.selectionBackgroundTransparent),r.selectionInactiveBackgroundOpaque=a.color.blend(r.background,r.selectionInactiveBackgroundTransparent),r.selectionForeground=e.selectionForeground?m(e.selectionForeground,a.NULL_COLOR):void 0,r.selectionForeground===a.NULL_COLOR&&(r.selectionForeground=void 0),a.color.isOpaque(r.selectionBackgroundTransparent)){const e=.3;r.selectionBackgroundTransparent=a.color.opacity(r.selectionBackgroundTransparent,e)}if(a.color.isOpaque(r.selectionInactiveBackgroundTransparent)){const e=.3;r.selectionInactiveBackgroundTransparent=a.color.opacity(r.selectionInactiveBackgroundTransparent,e)}if(r.ansi=t.DEFAULT_ANSI_COLORS.slice(),r.ansi[0]=m(e.black,t.DEFAULT_ANSI_COLORS[0]),r.ansi[1]=m(e.red,t.DEFAULT_ANSI_COLORS[1]),r.ansi[2]=m(e.green,t.DEFAULT_ANSI_COLORS[2]),r.ansi[3]=m(e.yellow,t.DEFAULT_ANSI_COLORS[3]),r.ansi[4]=m(e.blue,t.DEFAULT_ANSI_COLORS[4]),r.ansi[5]=m(e.magenta,t.DEFAULT_ANSI_COLORS[5]),r.ansi[6]=m(e.cyan,t.DEFAULT_ANSI_COLORS[6]),r.ansi[7]=m(e.white,t.DEFAULT_ANSI_COLORS[7]),r.ansi[8]=m(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),r.ansi[9]=m(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),r.ansi[10]=m(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),r.ansi[11]=m(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),r.ansi[12]=m(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),r.ansi[13]=m(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),r.ansi[14]=m(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),r.ansi[15]=m(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){const n=Math.min(r.ansi.length-16,e.extendedAnsi.length);for(let i=0;i<n;i++)r.ansi[i+16]=m(e.extendedAnsi[i],t.DEFAULT_ANSI_COLORS[i+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(void 0!==e)switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}else for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t]}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};function m(e,t){if(void 0!==e)try{return a.css.toColor(e)}catch(r){}return t}t.ThemeService=g=n([i(0,c.IOptionsService)],g)},6349:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularList=void 0;const n=r(8460),i=r(844);class o extends i.Disposable{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this.register(new n.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new n.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new n.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;const t=new Array(e);for(let r=0;r<Math.min(e,this.length);r++)t[r]=this._array[this._getCyclicIndex(r)];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,...r){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let n=this._length-1;n>=e;n--)this._array[this._getCyclicIndex(n+r.length)]=this._array[this._getCyclicIndex(n)];for(let n=0;n<r.length;n++)this._array[this._getCyclicIndex(e+n)]=r[n];if(r.length&&this.onInsertEmitter.fire({index:e,amount:r.length}),this._length+r.length>this._maxLength){const e=this._length+r.length-this._maxLength;this._startIndex+=e,this._length=this._maxLength,this.onTrimEmitter.fire(e)}else this._length+=r.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,r){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+r<0)throw new Error("Cannot shift elements in list beyond index 0");if(r>0){for(let i=t-1;i>=0;i--)this.set(e+i+r,this.get(e+i));const n=e+t+r-this._length;if(n>0)for(this._length+=n;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let n=0;n<t;n++)this.set(e+n+r,this.get(e+n))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}}t.CircularList=o},1439:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clone=void 0,t.clone=function e(t,r=5){if("object"!=typeof t)return t;const n=Array.isArray(t)?[]:{};for(const i in t)n[i]=r<=1?t[i]:t[i]&&e(t[i],r-1);return n}},8055:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.contrastRatio=t.toPaddedHex=t.rgba=t.rgb=t.css=t.color=t.channels=t.NULL_COLOR=void 0;const n=r(6114);let i=0,o=0,a=0,s=0;var l,c,u,d,p,h;function f(e){const t=e.toString(16);return t.length<2?"0"+t:t}function g(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}t.NULL_COLOR={css:"#00000000",rgba:0},(h=l||(t.channels=l={})).toCss=function(e,t,r,n){return void 0!==n?`#${f(e)}${f(t)}${f(r)}${f(n)}`:`#${f(e)}${f(t)}${f(r)}`},h.toRgba=function(e,t,r,n=255){return(e<<24|t<<16|r<<8|n)>>>0},function(e){function t(e,t){return s=Math.round(255*t),[i,o,a]=p.toChannels(e.rgba),{css:l.toCss(i,o,a,s),rgba:l.toRgba(i,o,a,s)}}e.blend=function(e,t){if(s=(255&t.rgba)/255,1===s)return{css:t.css,rgba:t.rgba};const r=t.rgba>>24&255,n=t.rgba>>16&255,c=t.rgba>>8&255,u=e.rgba>>24&255,d=e.rgba>>16&255,p=e.rgba>>8&255;return i=u+Math.round((r-u)*s),o=d+Math.round((n-d)*s),a=p+Math.round((c-p)*s),{css:l.toCss(i,o,a),rgba:l.toRgba(i,o,a)}},e.isOpaque=function(e){return!(255&~e.rgba)},e.ensureContrastRatio=function(e,t,r){const n=p.ensureContrastRatio(e.rgba,t.rgba,r);if(n)return p.toColor(n>>24&255,n>>16&255,n>>8&255)},e.opaque=function(e){const t=(255|e.rgba)>>>0;return[i,o,a]=p.toChannels(t),{css:l.toCss(i,o,a),rgba:t}},e.opacity=t,e.multiplyOpacity=function(e,r){return s=255&e.rgba,t(e,s*r/255)},e.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}}(c||(t.color=c={})),function(e){let t,r;if(!n.isNode){const e=document.createElement("canvas");e.width=1,e.height=1;const n=e.getContext("2d",{willReadFrequently:!0});n&&(t=n,t.globalCompositeOperation="copy",r=t.createLinearGradient(0,0,1,1))}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return i=parseInt(e.slice(1,2).repeat(2),16),o=parseInt(e.slice(2,3).repeat(2),16),a=parseInt(e.slice(3,4).repeat(2),16),p.toColor(i,o,a);case 5:return i=parseInt(e.slice(1,2).repeat(2),16),o=parseInt(e.slice(2,3).repeat(2),16),a=parseInt(e.slice(3,4).repeat(2),16),s=parseInt(e.slice(4,5).repeat(2),16),p.toColor(i,o,a,s);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}const n=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return i=parseInt(n[1]),o=parseInt(n[2]),a=parseInt(n[3]),s=Math.round(255*(void 0===n[5]?1:parseFloat(n[5]))),p.toColor(i,o,a,s);if(!t||!r)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=r,t.fillStyle=e,"string"!=typeof t.fillStyle)throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[i,o,a,s]=t.getImageData(0,0,1,1).data,255!==s)throw new Error("css.toColor: Unsupported css format");return{rgba:l.toRgba(i,o,a,s),css:e}}}(u||(t.css=u={})),function(e){function t(e,t,r){const n=e/255,i=t/255,o=r/255;return.2126*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))+.7152*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(d||(t.rgb=d={})),function(e){function t(e,t,r){const n=e>>24&255,i=e>>16&255,o=e>>8&255;let a=t>>24&255,s=t>>16&255,l=t>>8&255,c=g(d.relativeLuminance2(a,s,l),d.relativeLuminance2(n,i,o));for(;c<r&&(a>0||s>0||l>0);)a-=Math.max(0,Math.ceil(.1*a)),s-=Math.max(0,Math.ceil(.1*s)),l-=Math.max(0,Math.ceil(.1*l)),c=g(d.relativeLuminance2(a,s,l),d.relativeLuminance2(n,i,o));return(a<<24|s<<16|l<<8|255)>>>0}function r(e,t,r){const n=e>>24&255,i=e>>16&255,o=e>>8&255;let a=t>>24&255,s=t>>16&255,l=t>>8&255,c=g(d.relativeLuminance2(a,s,l),d.relativeLuminance2(n,i,o));for(;c<r&&(a<255||s<255||l<255);)a=Math.min(255,a+Math.ceil(.1*(255-a))),s=Math.min(255,s+Math.ceil(.1*(255-s))),l=Math.min(255,l+Math.ceil(.1*(255-l))),c=g(d.relativeLuminance2(a,s,l),d.relativeLuminance2(n,i,o));return(a<<24|s<<16|l<<8|255)>>>0}e.ensureContrastRatio=function(e,n,i){const o=d.relativeLuminance(e>>8),a=d.relativeLuminance(n>>8);if(g(o,a)<i){if(a<o){const a=t(e,n,i),s=g(o,d.relativeLuminance(a>>8));if(s<i){const t=r(e,n,i);return s>g(o,d.relativeLuminance(t>>8))?a:t}return a}const s=r(e,n,i),l=g(o,d.relativeLuminance(s>>8));if(l<i){const r=t(e,n,i);return l>g(o,d.relativeLuminance(r>>8))?s:r}return s}},e.reduceLuminance=t,e.increaseLuminance=r,e.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,r,n){return{css:l.toCss(e,t,r,n),rgba:l.toRgba(e,t,r,n)}}}(p||(t.rgba=p={})),t.toPaddedHex=f,t.contrastRatio=g},8969:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CoreTerminal=void 0;const n=r(844),i=r(2585),o=r(4348),a=r(7866),s=r(744),l=r(7302),c=r(6975),u=r(8460),d=r(1753),p=r(1480),h=r(7994),f=r(9282),g=r(5435),m=r(5981),v=r(2660);let y=!1;class b extends n.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new u.EventEmitter),this._onScroll.event(e=>{var t;null===(t=this._onScrollApi)||void 0===t||t.fire(e.position)})),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(e){for(const t in e)this.optionsService.options[t]=e[t]}constructor(e){super(),this._windowsWrappingHeuristics=this.register(new n.MutableDisposable),this._onBinary=this.register(new u.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new u.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new u.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new u.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new u.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new u.EventEmitter),this._instantiationService=new o.InstantiationService,this.optionsService=this.register(new l.OptionsService(e)),this._instantiationService.setService(i.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(s.BufferService)),this._instantiationService.setService(i.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(a.LogService)),this._instantiationService.setService(i.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(c.CoreService)),this._instantiationService.setService(i.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(d.CoreMouseService)),this._instantiationService.setService(i.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(p.UnicodeService)),this._instantiationService.setService(i.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(h.CharsetService),this._instantiationService.setService(i.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(v.OscLinkService),this._instantiationService.setService(i.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new g.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,u.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,u.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,u.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,u.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom(()=>this.scrollToBottom())),this.register(this.coreService.onUserInput(()=>this._writeBuffer.handleUserInput())),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],()=>this._handleWindowsPtyOptionChange())),this.register(this._bufferService.onScroll(e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(e=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=this.register(new m.WriteBuffer((e,t)=>this._inputHandler.parse(e,t))),this.register((0,u.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(e,t){this._writeBuffer.write(e,t)}writeSync(e,t){this._logService.logLevel<=i.LogLevelEnum.WARN&&!y&&(this._logService.warn("writeSync is unreliable and will be removed soon."),y=!0),this._writeBuffer.writeSync(e,t)}resize(e,t){isNaN(e)||isNaN(t)||(e=Math.max(e,s.MINIMUM_COLS),t=Math.max(t,s.MINIMUM_ROWS),this._bufferService.resize(e,t))}scroll(e,t=!1){this._bufferService.scroll(e,t)}scrollLines(e,t,r){this._bufferService.scrollLines(e,t,r)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){const t=e-this._bufferService.buffer.ydisp;0!==t&&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;const t=this.optionsService.rawOptions.windowsPty;t&&void 0!==t.buildNumber&&void 0!==t.buildNumber?e=!!("conpty"===t.backend&&t.buildNumber<21376):this.optionsService.rawOptions.windowsMode&&(e=!0),e?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const e=[];e.push(this.onLineFeed(f.updateWindowsModeWrappedState.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>((0,f.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsWrappingHeuristics.value=(0,n.toDisposable)(()=>{for(const t of e)t.dispose()})}}}t.CoreTerminal=b},8460:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.forwardEvent=t.EventEmitter=void 0,t.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=e=>(this._listeners.push(e),{dispose:()=>{if(!this._disposed)for(let t=0;t<this._listeners.length;t++)if(this._listeners[t]===e)return void this._listeners.splice(t,1)}})),this._event}fire(e,t){const r=[];for(let n=0;n<this._listeners.length;n++)r.push(this._listeners[n]);for(let n=0;n<r.length;n++)r[n].call(void 0,e,t)}dispose(){this.clearListeners(),this._disposed=!0}clearListeners(){this._listeners&&(this._listeners.length=0)}},t.forwardEvent=function(e,t){return e(e=>t.fire(e))}},5435:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.InputHandler=t.WindowsOptionsReportType=void 0;const o=r(2584),a=r(7116),s=r(2015),l=r(844),c=r(482),u=r(8437),d=r(8460),p=r(643),h=r(511),f=r(3734),g=r(2585),m=r(6242),v=r(6351),y=r(5941),b={"(":0,")":1,"*":2,"+":3,"-":1,".":2},q=131072;function V(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 S,E;(E=S||(t.WindowsOptionsReportType=S={}))[E.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",E[E.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS";let x=0;class C extends l.Disposable{getAttrData(){return this._curAttrData}constructor(e,t,r,n,i,l,p,f,g=new s.EscapeSequenceParser){super(),this._bufferService=e,this._charsetService=t,this._coreService=r,this._logService=n,this._optionsService=i,this._oscLinkService=l,this._coreMouseService=p,this._unicodeService=f,this._parser=g,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new c.StringToUtf32,this._utf8Decoder=new c.Utf8ToUtf32,this._workCell=new h.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new d.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new d.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new d.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new d.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new d.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new d.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new d.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new d.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new d.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new d.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new d.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new d.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new d.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new w(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(e=>this._activeBuffer=e.activeBuffer)),this._parser.setCsiHandlerFallback((e,t)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(e),params:t.toArray()})}),this._parser.setEscHandlerFallback(e=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(e)})}),this._parser.setExecuteHandlerFallback(e=>{this._logService.debug("Unknown EXECUTE code: ",{code:e})}),this._parser.setOscHandlerFallback((e,t,r)=>{this._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:r})}),this._parser.setDcsHandlerFallback((e,t,r)=>{"HOOK"===t&&(r=r.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(e),action:t,payload:r})}),this._parser.setPrintHandler((e,t,r)=>this.print(e,t,r)),this._parser.registerCsiHandler({final:"@"},e=>this.insertChars(e)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},e=>this.scrollLeft(e)),this._parser.registerCsiHandler({final:"A"},e=>this.cursorUp(e)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},e=>this.scrollRight(e)),this._parser.registerCsiHandler({final:"B"},e=>this.cursorDown(e)),this._parser.registerCsiHandler({final:"C"},e=>this.cursorForward(e)),this._parser.registerCsiHandler({final:"D"},e=>this.cursorBackward(e)),this._parser.registerCsiHandler({final:"E"},e=>this.cursorNextLine(e)),this._parser.registerCsiHandler({final:"F"},e=>this.cursorPrecedingLine(e)),this._parser.registerCsiHandler({final:"G"},e=>this.cursorCharAbsolute(e)),this._parser.registerCsiHandler({final:"H"},e=>this.cursorPosition(e)),this._parser.registerCsiHandler({final:"I"},e=>this.cursorForwardTab(e)),this._parser.registerCsiHandler({final:"J"},e=>this.eraseInDisplay(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},e=>this.eraseInDisplay(e,!0)),this._parser.registerCsiHandler({final:"K"},e=>this.eraseInLine(e,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},e=>this.eraseInLine(e,!0)),this._parser.registerCsiHandler({final:"L"},e=>this.insertLines(e)),this._parser.registerCsiHandler({final:"M"},e=>this.deleteLines(e)),this._parser.registerCsiHandler({final:"P"},e=>this.deleteChars(e)),this._parser.registerCsiHandler({final:"S"},e=>this.scrollUp(e)),this._parser.registerCsiHandler({final:"T"},e=>this.scrollDown(e)),this._parser.registerCsiHandler({final:"X"},e=>this.eraseChars(e)),this._parser.registerCsiHandler({final:"Z"},e=>this.cursorBackwardTab(e)),this._parser.registerCsiHandler({final:"`"},e=>this.charPosAbsolute(e)),this._parser.registerCsiHandler({final:"a"},e=>this.hPositionRelative(e)),this._parser.registerCsiHandler({final:"b"},e=>this.repeatPrecedingCharacter(e)),this._parser.registerCsiHandler({final:"c"},e=>this.sendDeviceAttributesPrimary(e)),this._parser.registerCsiHandler({prefix:">",final:"c"},e=>this.sendDeviceAttributesSecondary(e)),this._parser.registerCsiHandler({final:"d"},e=>this.linePosAbsolute(e)),this._parser.registerCsiHandler({final:"e"},e=>this.vPositionRelative(e)),this._parser.registerCsiHandler({final:"f"},e=>this.hVPosition(e)),this._parser.registerCsiHandler({final:"g"},e=>this.tabClear(e)),this._parser.registerCsiHandler({final:"h"},e=>this.setMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"h"},e=>this.setModePrivate(e)),this._parser.registerCsiHandler({final:"l"},e=>this.resetMode(e)),this._parser.registerCsiHandler({prefix:"?",final:"l"},e=>this.resetModePrivate(e)),this._parser.registerCsiHandler({final:"m"},e=>this.charAttributes(e)),this._parser.registerCsiHandler({final:"n"},e=>this.deviceStatus(e)),this._parser.registerCsiHandler({prefix:"?",final:"n"},e=>this.deviceStatusPrivate(e)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},e=>this.softReset(e)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},e=>this.setCursorStyle(e)),this._parser.registerCsiHandler({final:"r"},e=>this.setScrollRegion(e)),this._parser.registerCsiHandler({final:"s"},e=>this.saveCursor(e)),this._parser.registerCsiHandler({final:"t"},e=>this.windowOptions(e)),this._parser.registerCsiHandler({final:"u"},e=>this.restoreCursor(e)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},e=>this.insertColumns(e)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},e=>this.deleteColumns(e)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},e=>this.selectProtected(e)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},e=>this.requestMode(e,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},e=>this.requestMode(e,!1)),this._parser.setExecuteHandler(o.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(o.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(o.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(o.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(o.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(o.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(o.C1.IND,()=>this.index()),this._parser.setExecuteHandler(o.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(o.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new m.OscHandler(e=>(this.setTitle(e),this.setIconName(e),!0))),this._parser.registerOscHandler(1,new m.OscHandler(e=>this.setIconName(e))),this._parser.registerOscHandler(2,new m.OscHandler(e=>this.setTitle(e))),this._parser.registerOscHandler(4,new m.OscHandler(e=>this.setOrReportIndexedColor(e))),this._parser.registerOscHandler(8,new m.OscHandler(e=>this.setHyperlink(e))),this._parser.registerOscHandler(10,new m.OscHandler(e=>this.setOrReportFgColor(e))),this._parser.registerOscHandler(11,new m.OscHandler(e=>this.setOrReportBgColor(e))),this._parser.registerOscHandler(12,new m.OscHandler(e=>this.setOrReportCursorColor(e))),this._parser.registerOscHandler(104,new m.OscHandler(e=>this.restoreIndexedColor(e))),this._parser.registerOscHandler(110,new m.OscHandler(e=>this.restoreFgColor(e))),this._parser.registerOscHandler(111,new m.OscHandler(e=>this.restoreBgColor(e))),this._parser.registerOscHandler(112,new m.OscHandler(e=>this.restoreCursorColor(e))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(const o in a.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:o},()=>this.selectCharset("("+o)),this._parser.registerEscHandler({intermediates:")",final:o},()=>this.selectCharset(")"+o)),this._parser.registerEscHandler({intermediates:"*",final:o},()=>this.selectCharset("*"+o)),this._parser.registerEscHandler({intermediates:"+",final:o},()=>this.selectCharset("+"+o)),this._parser.registerEscHandler({intermediates:"-",final:o},()=>this.selectCharset("-"+o)),this._parser.registerEscHandler({intermediates:".",final:o},()=>this.selectCharset("."+o)),this._parser.registerEscHandler({intermediates:"/",final:o},()=>this.selectCharset("/"+o));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(e=>(this._logService.error("Parsing error: ",e),e)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new v.DcsHandler((e,t)=>this.requestStatusString(e,t)))}_preserveStack(e,t,r,n){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=r,this._parseStack.position=n}_logSlowResolvingAsync(e){this._logService.logLevel<=g.LogLevelEnum.WARN&&Promise.race([e,new Promise((e,t)=>setTimeout(()=>t("#SLOW_TIMEOUT"),5e3))]).catch(e=>{if("#SLOW_TIMEOUT"!==e)throw e})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let r,n=this._activeBuffer.x,i=this._activeBuffer.y,o=0;const a=this._parseStack.paused;if(a){if(r=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(r),r;n=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>q&&(o=this._parseStack.position+q)}if(this._logService.logLevel<=g.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+("string"==typeof e?` "${e}"`:` "${Array.prototype.map.call(e,e=>String.fromCharCode(e)).join("")}"`),"string"==typeof e?e.split("").map(e=>e.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<q&&(this._parseBuffer=new Uint32Array(Math.min(e.length,q))),a||this._dirtyRowTracker.clearRange(),e.length>q)for(let s=o;s<e.length;s+=q){const t=s+q<e.length?s+q:e.length,o="string"==typeof e?this._stringDecoder.decode(e.substring(s,t),this._parseBuffer):this._utf8Decoder.decode(e.subarray(s,t),this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,o))return this._preserveStack(n,i,o,s),this._logSlowResolvingAsync(r),r}else if(!a){const t="string"==typeof e?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(r=this._parser.parse(this._parseBuffer,t))return this._preserveStack(n,i,t,0),this._logSlowResolvingAsync(r),r}this._activeBuffer.x===n&&this._activeBuffer.y===i||this._onCursorMove.fire(),this._onRequestRefreshRows.fire(this._dirtyRowTracker.start,this._dirtyRowTracker.end)}print(e,t,r){let n,i;const o=this._charsetService.charset,a=this._optionsService.rawOptions.screenReaderMode,s=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,u=this._coreService.modes.insertMode,d=this._curAttrData;let h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&r-t>0&&2===h.getWidth(this._activeBuffer.x-1)&&h.setCellFromCodePoint(this._activeBuffer.x-1,0,1,d.fg,d.bg,d.extended);for(let f=t;f<r;++f){if(n=e[f],i=this._unicodeService.wcwidth(n),n<127&&o){const e=o[String.fromCharCode(n)];e&&(n=e.charCodeAt(0))}if(a&&this._onA11yChar.fire((0,c.stringFromCodePoint)(n)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),i||!this._activeBuffer.x){if(this._activeBuffer.x+i-1>=s)if(l){for(;this._activeBuffer.x<s;)h.setCellFromCodePoint(this._activeBuffer.x++,0,1,d.fg,d.bg,d.extended);this._activeBuffer.x=0,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),h=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=s-1,2===i)continue;if(u&&(h.insertCells(this._activeBuffer.x,i,this._activeBuffer.getNullCell(d),d),2===h.getWidth(s-1)&&h.setCellFromCodePoint(s-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,d.fg,d.bg,d.extended)),h.setCellFromCodePoint(this._activeBuffer.x++,n,i,d.fg,d.bg,d.extended),i>0)for(;--i;)h.setCellFromCodePoint(this._activeBuffer.x++,0,0,d.fg,d.bg,d.extended)}else h.getWidth(this._activeBuffer.x-1)?h.addCodepointToCell(this._activeBuffer.x-1,n):h.addCodepointToCell(this._activeBuffer.x-2,n)}r-t>0&&(h.loadCell(this._activeBuffer.x-1,this._workCell),2===this._workCell.getWidth()||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x<s&&r-t>0&&0===h.getWidth(this._activeBuffer.x)&&!h.hasContent(this._activeBuffer.x)&&h.setCellFromCodePoint(this._activeBuffer.x,0,1,d.fg,d.bg,d.extended),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return"t"!==e.final||e.prefix||e.intermediates?this._parser.registerCsiHandler(e,t):this._parser.registerCsiHandler(e,e=>!V(e.params[0],this._optionsService.rawOptions.windowOptions)||t(e))}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new v.DcsHandler(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new m.OscHandler(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(0===this._activeBuffer.x&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&(null===(e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))||void 0===e?void 0:e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const 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;const 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){const 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){const 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){const t=e.params[0];return 0===t?delete this._activeBuffer.tabs[this._activeBuffer.x]:3===t&&(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){const t=e.params[0];return 1===t&&(this._curAttrData.bg|=536870912),2!==t&&0!==t||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,r,n=!1,i=!1){const o=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);o.replaceCells(t,r,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),i),n&&(o.isWrapped=!1)}_resetBufferLine(e,t=!1){const r=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);r&&(r.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),r.isWrapped=!1)}eraseInDisplay(e,t=!1){let r;switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r++,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);r<this._bufferService.rows;r++)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(r);break;case 1:for(r=this._activeBuffer.y,this._dirtyRowTracker.markDirty(r),this._eraseInBufferLine(r,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(r+1).isWrapped=!1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 2:for(r=this._bufferService.rows,this._dirtyRowTracker.markDirty(r-1);r--;)this._resetBufferLine(r,t);this._dirtyRowTracker.markDirty(0);break;case 3:const e=this._activeBuffer.lines.length-this._bufferService.rows;e>0&&(this._activeBuffer.lines.trimStart(e),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-e,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-e,0),this._onScroll.fire(0))}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,0===this._activeBuffer.x,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const r=this._activeBuffer.ybase+this._activeBuffer.y,n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-n+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}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;const r=this._activeBuffer.ybase+this._activeBuffer.y;let n;for(n=this._bufferService.rows-1-this._activeBuffer.scrollBottom,n=this._bufferService.rows-1+this._activeBuffer.ybase-n;t--;)this._activeBuffer.lines.splice(r,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}insertChars(e){this._restrictCursor();const 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._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();const 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._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(u.DEFAULT_ATTR_DATA));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;const t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);e.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),e.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;const t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);e.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),e.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;const t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);e.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),e.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;const t=e.params[0]||1;for(let r=this._activeBuffer.scrollTop;r<=this._activeBuffer.scrollBottom;++r){const e=this._activeBuffer.lines.get(this._activeBuffer.ybase+r);e.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),e.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();const 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._eraseAttrData()),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){if(!this._parser.precedingCodepoint)return!0;const t=e.params[0]||1,r=new Uint32Array(t);for(let n=0;n<t;++n)r[n]=this._parser.precedingCodepoint;return this.print(r,0,r.length),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(e){return 0===(this._optionsService.rawOptions.termName+"").indexOf(e)}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,a.DEFAULT_CHARSET),this._charsetService.setgCharset(1,a.DEFAULT_CHARSET),this._charsetService.setgCharset(2,a.DEFAULT_CHARSET),this._charsetService.setgCharset(3,a.DEFAULT_CHARSET);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),1049===e.params[t]&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(0,this._bufferService.rows-1),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1}return!0}requestMode(e,t){const r=this._coreService.decPrivateModes,{activeProtocol:n,activeEncoding:i}=this._coreMouseService,a=this._coreService,{buffers:s,cols:l}=this._bufferService,{active:c,alt:u}=s,d=this._optionsService.rawOptions,p=e=>e?1:2,h=e.params[0];return f=h,g=t?2===h?4:4===h?p(a.modes.insertMode):12===h?3:20===h?p(d.convertEol):0:1===h?p(r.applicationCursorKeys):3===h?d.windowOptions.setWinLines?80===l?2:132===l?1:0:0:6===h?p(r.origin):7===h?p(r.wraparound):8===h?3:9===h?p("X10"===n):12===h?p(d.cursorBlink):25===h?p(!a.isCursorHidden):45===h?p(r.reverseWraparound):66===h?p(r.applicationKeypad):67===h?4:1e3===h?p("VT200"===n):1002===h?p("DRAG"===n):1003===h?p("ANY"===n):1004===h?p(r.sendFocus):1005===h?4:1006===h?p("SGR"===i):1015===h?4:1016===h?p("SGR_PIXELS"===i):1048===h?1:47===h||1047===h||1049===h?p(c===u):2004===h?p(r.bracketedPasteMode):0,a.triggerDataEvent(`${o.C0.ESC}[${t?"":"?"}${f};${g}$y`),!0;var f,g}_updateAttrColor(e,t,r,n,i){return 2===t?(e|=50331648,e&=-16777216,e|=f.AttributeData.fromColorRGB([r,n,i])):5===t&&(e&=-50331904,e|=33554432|255&r),e}_extractColor(e,t,r){const n=[0,0,-1,0,0,0];let i=0,o=0;do{if(n[o+i]=e.params[t+o],e.hasSubParams(t+o)){const r=e.getSubParams(t+o);let a=0;do{5===n[1]&&(i=1),n[o+a+1+i]=r[a]}while(++a<r.length&&a+o+1+i<n.length);break}if(5===n[1]&&o+i>=2||2===n[1]&&o+i>=5)break;n[1]&&(i=1)}while(++o+t<e.length&&o+i<n.length);for(let a=2;a<n.length;++a)-1===n[a]&&(n[a]=0);switch(n[0]){case 38:r.fg=this._updateAttrColor(r.fg,n[1],n[3],n[4],n[5]);break;case 48:r.bg=this._updateAttrColor(r.bg,n[1],n[3],n[4],n[5]);break;case 58:r.extended=r.extended.clone(),r.extended.underlineColor=this._updateAttrColor(r.extended.underlineColor,n[1],n[3],n[4],n[5])}return o}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=u.DEFAULT_ATTR_DATA.fg,e.bg=u.DEFAULT_ATTR_DATA.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(1===e.length&&0===e.params[0])return this._processSGR0(this._curAttrData),!0;const t=e.length;let r;const n=this._curAttrData;for(let i=0;i<t;i++)r=e.params[i],r>=30&&r<=37?(n.fg&=-50331904,n.fg|=16777216|r-30):r>=40&&r<=47?(n.bg&=-50331904,n.bg|=16777216|r-40):r>=90&&r<=97?(n.fg&=-50331904,n.fg|=16777224|r-90):r>=100&&r<=107?(n.bg&=-50331904,n.bg|=16777224|r-100):0===r?this._processSGR0(n):1===r?n.fg|=134217728:3===r?n.bg|=67108864:4===r?(n.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,n)):5===r?n.fg|=536870912:7===r?n.fg|=67108864:8===r?n.fg|=1073741824:9===r?n.fg|=2147483648:2===r?n.bg|=134217728:21===r?this._processUnderline(2,n):22===r?(n.fg&=-134217729,n.bg&=-134217729):23===r?n.bg&=-67108865:24===r?(n.fg&=-268435457,this._processUnderline(0,n)):25===r?n.fg&=-536870913:27===r?n.fg&=-67108865:28===r?n.fg&=-1073741825:29===r?n.fg&=2147483647:39===r?(n.fg&=-67108864,n.fg|=16777215&u.DEFAULT_ATTR_DATA.fg):49===r?(n.bg&=-67108864,n.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):38===r||48===r||58===r?i+=this._extractColor(e,i,n):53===r?n.bg|=1073741824:55===r?n.bg&=-1073741825:59===r?(n.extended=n.extended.clone(),n.extended.underlineColor=-1,n.updateExtended()):100===r?(n.fg&=-67108864,n.fg|=16777215&u.DEFAULT_ATTR_DATA.fg,n.bg&=-67108864,n.bg|=16777215&u.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",r);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${e};${t}R`)}return!0}deviceStatusPrivate(e){if(6===e.params[0]){const e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${e};${t}R`)}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(e){const t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const r=t%2==1;return this._optionsService.options.cursorBlink=r,!0}setScrollRegion(e){const t=e.params[0]||1;let r;return(e.length<2||(r=e.params[1])>this._bufferService.rows||0===r)&&(r=this._bufferService.rows),r>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=r-1,this._setCursor(0,0)),!0}windowOptions(e){if(!V(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;const t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(S.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(S.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){const t=[],r=e.split(";");for(;r.length>1;){const e=r.shift(),n=r.shift();if(/^\d+$/.exec(e)){const r=parseInt(e);if(R(r))if("?"===n)t.push({type:0,index:r});else{const e=(0,y.parseColor)(n);e&&t.push({type:1,index:r,color:e})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){const t=e.split(";");return!(t.length<2)&&(t[1]?this._createHyperlink(t[0],t[1]):!t[0]&&this._finishHyperlink())}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();const r=e.split(":");let n;const i=r.findIndex(e=>e.startsWith("id="));return-1!==i&&(n=r[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:n,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){const r=e.split(";");for(let n=0;n<r.length&&!(t>=this._specialColors.length);++n,++t)if("?"===r[n])this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{const e=(0,y.parseColor)(r[n]);e&&this._onColor.fire([{type:1,index:this._specialColors[t],color:e}])}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;const t=[],r=e.split(";");for(let n=0;n<r.length;++n)if(/^\d+$/.exec(r[n])){const e=parseInt(r[n]);R(e)&&t.push({type:2,index:e})}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,a.DEFAULT_CHARSET),!0}selectCharset(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(b[e[0]],a.CHARSETS[e[1]]||a.DEFAULT_CHARSET),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=u.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=u.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){const e=new h.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){const r=this._activeBuffer.ybase+this._activeBuffer.y+t,n=this._activeBuffer.lines.get(r);n&&(n.fill(e),n.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){const r=this._bufferService.buffer,n=this._optionsService.rawOptions;return(e=>(this._coreService.triggerDataEvent(`${o.C0.ESC}${e}${o.C0.ESC}\\`),!0))('"q'===e?`P1$r${this._curAttrData.isProtected()?1:0}"q`:'"p'===e?'P1$r61;1"p':"r"===e?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:"m"===e?"P1$r0m":" q"===e?`P1$r${{block:2,underline:4,bar:6}[n.cursorStyle]-(n.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}}t.InputHandler=C;let w=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&&(x=e,e=t,t=x),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function R(e){return 0<=e&&e<256}w=n([i(0,g.IBufferService)],w)},844:(e,t)=>{function r(e){for(const t of e)t.dispose();e.length=0}Object.defineProperty(t,"__esModule",{value:!0}),t.getDisposeArrayDisposable=t.disposeArray=t.toDisposable=t.MutableDisposable=t.Disposable=void 0,t.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const e of this._disposables)e.dispose();this._disposables.length=0}register(e){return this._disposables.push(e),e}unregister(e){const t=this._disposables.indexOf(e);-1!==t&&this._disposables.splice(t,1)}},t.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){var t;this._isDisposed||e===this._value||(null===(t=this._value)||void 0===t||t.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){var e;this._isDisposed=!0,null===(e=this._value)||void 0===e||e.dispose(),this._value=void 0}},t.toDisposable=function(e){return{dispose:e}},t.disposeArray=r,t.getDisposeArrayDisposable=function(e){return{dispose:()=>r(e)}}},1505:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FourKeyMap=t.TwoKeyMap=void 0;class r{constructor(){this._data={}}set(e,t,r){this._data[e]||(this._data[e]={}),this._data[e][t]=r}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}}t.TwoKeyMap=r,t.FourKeyMap=class{constructor(){this._data=new r}set(e,t,n,i,o){this._data.get(e,t)||this._data.set(e,t,new r),this._data.get(e,t).set(n,i,o)}get(e,t,r,n){var i;return null===(i=this._data.get(e,t))||void 0===i?void 0:i.get(r,n)}clear(){this._data.clear()}}},6114:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isChromeOS=t.isLinux=t.isWindows=t.isIphone=t.isIpad=t.isMac=t.getSafariVersion=t.isSafari=t.isLegacyEdge=t.isFirefox=t.isNode=void 0,t.isNode="undefined"==typeof navigator;const r=t.isNode?"node":navigator.userAgent,n=t.isNode?"node":navigator.platform;t.isFirefox=r.includes("Firefox"),t.isLegacyEdge=r.includes("Edge"),t.isSafari=/^((?!chrome|android).)*safari/i.test(r),t.getSafariVersion=function(){if(!t.isSafari)return 0;const e=r.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])},t.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(n),t.isIpad="iPad"===n,t.isIphone="iPhone"===n,t.isWindows=["Windows","Win16","Win32","WinCE"].includes(n),t.isLinux=n.indexOf("Linux")>=0,t.isChromeOS=/\bCrOS\b/.test(r)},6106:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SortedList=void 0;let r=0;t.SortedList=class{constructor(e){this._getKey=e,this._array=[]}clear(){this._array.length=0}insert(e){0!==this._array.length?(r=this._search(this._getKey(e)),this._array.splice(r,0,e)):this._array.push(e)}delete(e){if(0===this._array.length)return!1;const t=this._getKey(e);if(void 0===t)return!1;if(r=this._search(t),-1===r)return!1;if(this._getKey(this._array[r])!==t)return!1;do{if(this._array[r]===e)return this._array.splice(r,1),!0}while(++r<this._array.length&&this._getKey(this._array[r])===t);return!1}*getKeyIterator(e){if(0!==this._array.length&&(r=this._search(e),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===e))do{yield this._array[r]}while(++r<this._array.length&&this._getKey(this._array[r])===e)}forEachByKey(e,t){if(0!==this._array.length&&(r=this._search(e),!(r<0||r>=this._array.length)&&this._getKey(this._array[r])===e))do{t(this._array[r])}while(++r<this._array.length&&this._getKey(this._array[r])===e)}values(){return[...this._array].values()}_search(e){let t=0,r=this._array.length-1;for(;r>=t;){let n=t+r>>1;const i=this._getKey(this._array[n]);if(i>e)r=n-1;else{if(!(i<e)){for(;n>0&&this._getKey(this._array[n-1])===e;)n--;return n}t=n+1}}return t}}},7226:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DebouncedIdleTask=t.IdleTaskQueue=t.PriorityTaskQueue=void 0;const n=r(6114);class i{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),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,r=0,n=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),r=Math.max(t,r),i=e.timeRemaining(),1.5*r>i)return void this._start();n=i}this.clear()}}class o extends i{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){const t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}t.PriorityTaskQueue=o,t.IdleTaskQueue=!n.isNode&&"requestIdleCallback"in window?class extends i{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}}:o,t.DebouncedIdleTask=class{constructor(){this._queue=new t.IdleTaskQueue}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}}},9282:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.updateWindowsModeWrappedState=void 0;const n=r(643);t.updateWindowsModeWrappedState=function(e){const t=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1),r=null==t?void 0:t.get(e.cols-1),i=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);i&&r&&(i.isWrapped=r[n.CHAR_DATA_CODE_INDEX]!==n.NULL_CELL_CODE&&r[n.CHAR_DATA_CODE_INDEX]!==n.WHITESPACE_CELL_CODE)}},3734:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ExtendedAttrs=t.AttributeData=void 0;class r{constructor(){this.fg=0,this.bg=0,this.extended=new n}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){const e=new r;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return!(50331648&~this.fg)}isBgRGB(){return!(50331648&~this.bg)}isFgPalette(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)}isBgPalette(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)}isFgDefault(){return!(50331648&this.fg)}isBgDefault(){return!(50331648&this.bg)}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&~this.extended.underlineColor):this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?!(50331648&this.extended.underlineColor):this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}t.AttributeData=r;class n{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(e){this._ext&=-67108864,this._ext|=67108863&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}clone(){return new n(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}}t.ExtendedAttrs=n},9092:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Buffer=t.MAX_BUFFER_SIZE=void 0;const n=r(6349),i=r(7226),o=r(3734),a=r(8437),s=r(4634),l=r(511),c=r(643),u=r(4863),d=r(7116);t.MAX_BUFFER_SIZE=4294967295,t.Buffer=class{constructor(e,t,r){this._hasScrollback=e,this._optionsService=t,this._bufferService=r,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=a.DEFAULT_ATTR_DATA.clone(),this.savedCharset=d.DEFAULT_CHARSET,this.markers=[],this._nullCell=l.CellData.fromCharData([0,c.NULL_CELL_CHAR,c.NULL_CELL_WIDTH,c.NULL_CELL_CODE]),this._whitespaceCell=l.CellData.fromCharData([0,c.WHITESPACE_CELL_CHAR,c.WHITESPACE_CELL_WIDTH,c.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new i.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new n.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new o.ExtendedAttrs),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new o.ExtendedAttrs),this._whitespaceCell}getBlankLine(e,t){return new a.BufferLine(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;const r=e+this._optionsService.rawOptions.scrollback;return r>t.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:r}fillViewportRows(e){if(0===this.lines.length){void 0===e&&(e=a.DEFAULT_ATTR_DATA);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new n.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){const r=this.getNullCell(a.DEFAULT_ATTR_DATA);let n=0;const i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let t=0;t<this.lines.length;t++)n+=+this.lines.get(t).resize(e,r);let o=0;if(this._rows<t)for(let n=this._rows;n<t;n++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||void 0!==this._optionsService.rawOptions.windowsPty.backend||void 0!==this._optionsService.rawOptions.windowsPty.buildNumber?this.lines.push(new a.BufferLine(e,r)):this.ybase>0&&this.lines.length<=this.ybase+this.y+o+1?(this.ybase--,o++,this.ydisp>0&&this.ydisp--):this.lines.push(new a.BufferLine(e,r)));else for(let e=this._rows;e>t;e--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){const e=this.lines.length-i;e>0&&(this.lines.trimStart(e),this.ybase=Math.max(this.ybase-e,0),this.ydisp=Math.max(this.ydisp-e,0),this.savedY=Math.max(this.savedY-e,0)),this.lines.maxLength=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),o&&(this.y+=o),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 o=0;o<this.lines.length;o++)n+=+this.lines.get(o).resize(e,r);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),n>.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(){const e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&"conpty"===e.backend&&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){const r=(0,s.reflowLargerGetLinesToRemove)(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(a.DEFAULT_ATTR_DATA));if(r.length>0){const n=(0,s.reflowLargerCreateNewLayout)(this.lines,r);(0,s.reflowLargerApplyNewLayout)(this.lines,n.layout),this._reflowLargerAdjustViewport(e,t,n.countRemoved)}}_reflowLargerAdjustViewport(e,t,r){const n=this.getNullCell(a.DEFAULT_ATTR_DATA);let i=r;for(;i-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new a.BufferLine(e,n))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-r,0)}_reflowSmaller(e,t){const r=this.getNullCell(a.DEFAULT_ATTR_DATA),n=[];let i=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=e)continue;const c=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),c.unshift(l);const u=this.ybase+this.y;if(u>=o&&u<o+c.length)continue;const d=c[c.length-1].getTrimmedLength(),p=(0,s.reflowSmallerGetNewLineLengths)(c,this._cols,e),h=p.length-c.length;let f;f=0===this.ybase&&this.y!==this.lines.length-1?Math.max(0,this.y-this.lines.maxLength+h):Math.max(0,this.lines.length-this.lines.maxLength+h);const g=[];for(let e=0;e<h;e++){const e=this.getBlankLine(a.DEFAULT_ATTR_DATA,!0);g.push(e)}g.length>0&&(n.push({start:o+c.length+i,newLines:g}),i+=g.length),c.push(...g);let m=p.length-1,v=p[m];0===v&&(m--,v=p[m]);let y=c.length-h-1,b=d;for(;y>=0;){const e=Math.min(b,v);if(void 0===c[m])break;if(c[m].copyCellsFrom(c[y],b-e,v-e,e,!0),v-=e,0===v&&(m--,v=p[m]),b-=e,0===b){y--;const e=Math.max(y,0);b=(0,s.getWrappedLineTrimmedLength)(c,e,this._cols)}}for(let t=0;t<c.length;t++)p[t]<e&&c[t].setCell(p[t],r);let q=h-f;for(;q-- >0;)0===this.ybase?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+i)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+h,this.ybase+t-1)}if(n.length>0){const e=[],t=[];for(let n=0;n<this.lines.length;n++)t.push(this.lines.get(n));const r=this.lines.length;let o=r-1,a=0,s=n[a];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+i);let l=0;for(let d=Math.min(this.lines.maxLength-1,r+i-1);d>=0;d--)if(s&&s.start>o+l){for(let e=s.newLines.length-1;e>=0;e--)this.lines.set(d--,s.newLines[e]);d++,e.push({index:o+1,amount:s.newLines.length}),l+=s.newLines.length,s=n[++a]}else this.lines.set(d,t[o--]);let c=0;for(let n=e.length-1;n>=0;n--)e[n].index+=c,this.lines.onInsertEmitter.fire(e[n]),c+=e[n].amount;const u=Math.max(0,r+i-this.lines.maxLength);u>0&&this.lines.onTrimEmitter.fire(u)}}translateBufferLineToString(e,t,r=0,n){const i=this.lines.get(e);return i?i.translateToString(t,r,n):""}getWrappedRangeForLine(e){let t=e,r=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;r+1<this.lines.length&&this.lines.get(r+1).isWrapped;)r++;return{first:t,last:r}}setupTabStops(e){for(null!=e?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(null==e&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose(),this.markers.splice(e--,1);this._isClearing=!1}addMarker(e){const t=new u.Marker(e);return this.markers.push(t),t.register(this.lines.onTrim(e=>{t.line-=e,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(e=>{t.line>=e.index&&(t.line+=e.amount)})),t.register(this.lines.onDelete(e=>{t.line>=e.index&&t.line<e.index+e.amount&&t.dispose(),t.line>e.index&&(t.line-=e.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}}},8437:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;const n=r(3734),i=r(511),o=r(643),a=r(482);t.DEFAULT_ATTR_DATA=Object.freeze(new n.AttributeData);let s=0;class l{constructor(e,t,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const n=t||i.CellData.fromCharData([0,o.NULL_CELL_CHAR,o.NULL_CELL_WIDTH,o.NULL_CELL_CODE]);for(let i=0;i<e;++i)this.setCell(i,n);this.length=e}get(e){const t=this._data[3*e+0],r=2097151&t;return[this._data[3*e+1],2097152&t?this._combined[e]:r?(0,a.stringFromCodePoint)(r):"",t>>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):r]}set(e,t){this._data[3*e+1]=t[o.CHAR_DATA_ATTR_INDEX],t[o.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[o.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[o.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[o.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?(0,a.stringFromCodePoint)(2097151&t):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,t){return s=3*e,t.content=this._data[s+0],t.fg=this._data[s+1],t.bg=this._data[s+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg}setCellFromCodePoint(e,t,r,n,i,o){268435456&i&&(this._extendedAttrs[e]=o),this._data[3*e+0]=t|r<<22,this._data[3*e+1]=n,this._data[3*e+2]=i}addCodepointToCell(e,t){let r=this._data[3*e+0];2097152&r?this._combined[e]+=(0,a.stringFromCodePoint)(t):(2097151&r?(this._combined[e]=(0,a.stringFromCodePoint)(2097151&r)+(0,a.stringFromCodePoint)(t),r&=-2097152,r|=2097152):r=t|1<<22,this._data[3*e+0]=r)}insertCells(e,t,r,o){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==o?void 0:o.fg)||0,(null==o?void 0:o.bg)||0,(null==o?void 0:o.extended)||new n.ExtendedAttrs),t<this.length-e){const n=new i.CellData;for(let r=this.length-e-t-1;r>=0;--r)this.setCell(e+t+r,this.loadCell(e+r,n));for(let i=0;i<t;++i)this.setCell(e+i,r)}else for(let n=e;n<this.length;++n)this.setCell(n,r);2===this.getWidth(this.length-1)&&this.setCellFromCodePoint(this.length-1,0,1,(null==o?void 0:o.fg)||0,(null==o?void 0:o.bg)||0,(null==o?void 0:o.extended)||new n.ExtendedAttrs)}deleteCells(e,t,r,o){if(e%=this.length,t<this.length-e){const n=new i.CellData;for(let r=0;r<this.length-e-t;++r)this.setCell(e+r,this.loadCell(e+t+r,n));for(let e=this.length-t;e<this.length;++e)this.setCell(e,r)}else for(let n=e;n<this.length;++n)this.setCell(n,r);e&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==o?void 0:o.fg)||0,(null==o?void 0:o.bg)||0,(null==o?void 0:o.extended)||new n.ExtendedAttrs),0!==this.getWidth(e)||this.hasContent(e)||this.setCellFromCodePoint(e,0,1,(null==o?void 0:o.fg)||0,(null==o?void 0:o.bg)||0,(null==o?void 0:o.extended)||new n.ExtendedAttrs)}replaceCells(e,t,r,i,o=!1){if(o)for(e&&2===this.getWidth(e-1)&&!this.isProtected(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new n.ExtendedAttrs),t<this.length&&2===this.getWidth(t-1)&&!this.isProtected(t)&&this.setCellFromCodePoint(t,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new n.ExtendedAttrs);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,r),e++;else for(e&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new n.ExtendedAttrs),t<this.length&&2===this.getWidth(t-1)&&this.setCellFromCodePoint(t,0,1,(null==i?void 0:i.fg)||0,(null==i?void 0:i.bg)||0,(null==i?void 0:i.extended)||new n.ExtendedAttrs);e<t&&e<this.length;)this.setCell(e++,r)}resize(e,t){if(e===this.length)return 4*this._data.length*2<this._data.buffer.byteLength;const r=3*e;if(e>this.length){if(this._data.buffer.byteLength>=4*r)this._data=new Uint32Array(this._data.buffer,0,r);else{const e=new Uint32Array(r);e.set(this._data),this._data=e}for(let r=this.length;r<e;++r)this.setCell(r,t)}else{this._data=this._data.subarray(0,r);const t=Object.keys(this._combined);for(let r=0;r<t.length;r++){const n=parseInt(t[r],10);n>=e&&delete this._combined[n]}const n=Object.keys(this._extendedAttrs);for(let r=0;r<n.length;r++){const t=parseInt(n[r],10);t>=e&&delete this._extendedAttrs[t]}}return this.length=e,4*r*2<this._data.buffer.byteLength}cleanupMemory(){if(4*this._data.length*2<this._data.buffer.byteLength){const e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t)for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,e);else{this._combined={},this._extendedAttrs={};for(let t=0;t<this.length;++t)this.setCell(t,e)}}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(const t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(const t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){const e=new l(0);e._data=new Uint32Array(this._data),e.length=this.length;for(const t in this._combined)e._combined[t]=this._combined[t];for(const t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(4194303&this._data[3*e+0]||50331648&this._data[3*e+2])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,t,r,n,i){const o=e._data;if(i)for(let s=n-1;s>=0;s--){for(let e=0;e<3;e++)this._data[3*(r+s)+e]=o[3*(t+s)+e];268435456&o[3*(t+s)+2]&&(this._extendedAttrs[r+s]=e._extendedAttrs[t+s])}else for(let s=0;s<n;s++){for(let e=0;e<3;e++)this._data[3*(r+s)+e]=o[3*(t+s)+e];268435456&o[3*(t+s)+2]&&(this._extendedAttrs[r+s]=e._extendedAttrs[t+s])}const a=Object.keys(e._combined);for(let s=0;s<a.length;s++){const n=parseInt(a[s],10);n>=t&&(this._combined[n-t+r]=e._combined[n])}}translateToString(e=!1,t=0,r=this.length){e&&(r=Math.min(r,this.getTrimmedLength()));let n="";for(;t<r;){const e=this._data[3*t+0],r=2097151&e;n+=2097152&e?this._combined[t]:r?(0,a.stringFromCodePoint)(r):o.WHITESPACE_CELL_CHAR,t+=e>>22||1}return n}}t.BufferLine=l},4841:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getRangeLength=void 0,t.getRangeLength=function(e,t){if(e.start.y>e.end.y)throw 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)}},4634:(e,t)=>{function r(e,t,r){if(t===e.length-1)return e[t].getTrimmedLength();const n=!e[t].hasContent(r-1)&&1===e[t].getWidth(r-1),i=2===e[t+1].getWidth(0);return n&&i?r-1:r}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,n,i,o){const a=[];for(let s=0;s<e.length-1;s++){let l=s,c=e.get(++l);if(!c.isWrapped)continue;const u=[e.get(s)];for(;l<e.length&&c.isWrapped;)u.push(c),c=e.get(++l);if(i>=s&&i<l){s+=u.length-1;continue}let d=0,p=r(u,d,t),h=1,f=0;for(;h<u.length;){const e=r(u,h,t),i=e-f,a=n-p,s=Math.min(i,a);u[d].copyCellsFrom(u[h],f,p,s,!1),p+=s,p===n&&(d++,p=0),f+=s,f===e&&(h++,f=0),0===p&&0!==d&&2===u[d-1].getWidth(n-1)&&(u[d].copyCellsFrom(u[d-1],n-1,p++,1,!1),u[d-1].setCell(n-1,o))}u[d].replaceCells(p,n,o);let g=0;for(let e=u.length-1;e>0&&(e>d||0===u[e].getTrimmedLength());e--)g++;g>0&&(a.push(s+u.length-g),a.push(g)),s+=u.length-1}return a},t.reflowLargerCreateNewLayout=function(e,t){const r=[];let n=0,i=t[n],o=0;for(let a=0;a<e.length;a++)if(i===a){const r=t[++n];e.onDeleteEmitter.fire({index:a-o,amount:r}),a+=r-1,o+=r,i=t[++n]}else r.push(a);return{layout:r,countRemoved:o}},t.reflowLargerApplyNewLayout=function(e,t){const r=[];for(let n=0;n<t.length;n++)r.push(e.get(t[n]));for(let n=0;n<r.length;n++)e.set(n,r[n]);e.length=t.length},t.reflowSmallerGetNewLineLengths=function(e,t,n){const i=[],o=e.map((n,i)=>r(e,i,t)).reduce((e,t)=>e+t);let a=0,s=0,l=0;for(;l<o;){if(o-l<n){i.push(o-l);break}a+=n;const c=r(e,s,t);a>c&&(a-=c,s++);const u=2===e[s].getWidth(a-1);u&&a--;const d=u?n-1:n;i.push(d),l+=d}return i},t.getWrappedLineTrimmedLength=r},5295:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;const n=r(8460),i=r(844),o=r(9092);class a extends i.Disposable{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this.register(new n.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",()=>this.resize(this._bufferService.cols,this._bufferService.rows))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",()=>this.setupTabStops()))}reset(){this._normal=new o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(e,t){this._normal.resize(e,t),this._alt.resize(e,t),this.setupTabStops(e)}setupTabStops(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)}}t.BufferSet=a},511:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;const n=r(482),i=r(643),o=r(3734);class a extends o.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new o.ExtendedAttrs,this.combinedData=""}static fromCharData(e){const t=new a;return t.setFromCharData(e),t}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,n.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[i.CHAR_DATA_ATTR_INDEX],this.bg=0;let t=!1;if(e[i.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[i.CHAR_DATA_CHAR_INDEX].length){const r=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=r&&r<=56319){const n=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(r-55296)+n-56320+65536|e[i.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[i.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[i.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[i.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}t.CellData=a},643:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_EXT=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=0,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.DEFAULT_EXT=0,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;const n=r(8460),i=r(844);class o{get id(){return this._id}constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=o._nextId++,this._onDispose=this.register(new n.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,i.disposeArray)(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}}t.Marker=o,o._nextId=1},7116:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},t.CHARSETS.A={"#":"£"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},t.CHARSETS.C=t.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},t.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},t.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},t.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},t.CHARSETS.E=t.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},t.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},t.CHARSETS.H=t.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},t.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(e,t)=>{var r,n,i,o;Object.defineProperty(t,"__esModule",{value:!0}),t.C1_ESCAPED=t.C1=t.C0=void 0,(o=r||(t.C0=r={})).NUL="\0",o.SOH="",o.STX="",o.ETX="",o.EOT="",o.ENQ="",o.ACK="",o.BEL="",o.BS="\b",o.HT="\t",o.LF="\n",o.VT="\v",o.FF="\f",o.CR="\r",o.SO="",o.SI="",o.DLE="",o.DC1="",o.DC2="",o.DC3="",o.DC4="",o.NAK="",o.SYN="",o.ETB="",o.CAN="",o.EM="",o.SUB="",o.ESC="",o.FS="",o.GS="",o.RS="",o.US="",o.SP=" ",o.DEL="",function(e){e.PAD="€",e.HOP="",e.BPH="‚",e.NBH="ƒ",e.IND="„",e.NEL="…",e.SSA="†",e.ESA="‡",e.HTS="ˆ",e.HTJ="‰",e.VTS="Š",e.PLD="‹",e.PLU="Œ",e.RI="",e.SS2="Ž",e.SS3="",e.DCS="",e.PU1="‘",e.PU2="’",e.STS="“",e.CCH="”",e.MW="•",e.SPA="–",e.EPA="—",e.SOS="˜",e.SGCI="™",e.SCI="š",e.CSI="›",e.ST="œ",e.OSC="",e.PM="ž",e.APC="Ÿ"}(n||(t.C1=n={})),function(e){e.ST=`${r.ESC}\\`}(i||(t.C1_ESCAPED=i={}))},7399:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;const n=r(2584),i={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(e,t,r,o){const a={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?a.key=t?n.C0.ESC+"OA":n.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?a.key=t?n.C0.ESC+"OD":n.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?a.key=t?n.C0.ESC+"OC":n.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(a.key=t?n.C0.ESC+"OB":n.C0.ESC+"[B");break;case 8:if(e.altKey){a.key=n.C0.ESC+n.C0.DEL;break}a.key=n.C0.DEL;break;case 9:if(e.shiftKey){a.key=n.C0.ESC+"[Z";break}a.key=n.C0.HT,a.cancel=!0;break;case 13:a.key=e.altKey?n.C0.ESC+n.C0.CR:n.C0.CR,a.cancel=!0;break;case 27:a.key=n.C0.ESC,e.altKey&&(a.key=n.C0.ESC+n.C0.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;s?(a.key=n.C0.ESC+"[1;"+(s+1)+"D",a.key===n.C0.ESC+"[1;3D"&&(a.key=n.C0.ESC+(r?"b":"[1;5D"))):a.key=t?n.C0.ESC+"OD":n.C0.ESC+"[D";break;case 39:if(e.metaKey)break;s?(a.key=n.C0.ESC+"[1;"+(s+1)+"C",a.key===n.C0.ESC+"[1;3C"&&(a.key=n.C0.ESC+(r?"f":"[1;5C"))):a.key=t?n.C0.ESC+"OC":n.C0.ESC+"[C";break;case 38:if(e.metaKey)break;s?(a.key=n.C0.ESC+"[1;"+(s+1)+"A",r||a.key!==n.C0.ESC+"[1;3A"||(a.key=n.C0.ESC+"[1;5A")):a.key=t?n.C0.ESC+"OA":n.C0.ESC+"[A";break;case 40:if(e.metaKey)break;s?(a.key=n.C0.ESC+"[1;"+(s+1)+"B",r||a.key!==n.C0.ESC+"[1;3B"||(a.key=n.C0.ESC+"[1;5B")):a.key=t?n.C0.ESC+"OB":n.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(a.key=n.C0.ESC+"[2~");break;case 46:a.key=s?n.C0.ESC+"[3;"+(s+1)+"~":n.C0.ESC+"[3~";break;case 36:a.key=s?n.C0.ESC+"[1;"+(s+1)+"H":t?n.C0.ESC+"OH":n.C0.ESC+"[H";break;case 35:a.key=s?n.C0.ESC+"[1;"+(s+1)+"F":t?n.C0.ESC+"OF":n.C0.ESC+"[F";break;case 33:e.shiftKey?a.type=2:e.ctrlKey?a.key=n.C0.ESC+"[5;"+(s+1)+"~":a.key=n.C0.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:e.ctrlKey?a.key=n.C0.ESC+"[6;"+(s+1)+"~":a.key=n.C0.ESC+"[6~";break;case 112:a.key=s?n.C0.ESC+"[1;"+(s+1)+"P":n.C0.ESC+"OP";break;case 113:a.key=s?n.C0.ESC+"[1;"+(s+1)+"Q":n.C0.ESC+"OQ";break;case 114:a.key=s?n.C0.ESC+"[1;"+(s+1)+"R":n.C0.ESC+"OR";break;case 115:a.key=s?n.C0.ESC+"[1;"+(s+1)+"S":n.C0.ESC+"OS";break;case 116:a.key=s?n.C0.ESC+"[15;"+(s+1)+"~":n.C0.ESC+"[15~";break;case 117:a.key=s?n.C0.ESC+"[17;"+(s+1)+"~":n.C0.ESC+"[17~";break;case 118:a.key=s?n.C0.ESC+"[18;"+(s+1)+"~":n.C0.ESC+"[18~";break;case 119:a.key=s?n.C0.ESC+"[19;"+(s+1)+"~":n.C0.ESC+"[19~";break;case 120:a.key=s?n.C0.ESC+"[20;"+(s+1)+"~":n.C0.ESC+"[20~";break;case 121:a.key=s?n.C0.ESC+"[21;"+(s+1)+"~":n.C0.ESC+"[21~";break;case 122:a.key=s?n.C0.ESC+"[23;"+(s+1)+"~":n.C0.ESC+"[23~";break;case 123:a.key=s?n.C0.ESC+"[24;"+(s+1)+"~":n.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(r&&!o||!e.altKey||e.metaKey)!r||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?a.key=e.key:e.key&&e.ctrlKey&&("_"===e.key&&(a.key=n.C0.US),"@"===e.key&&(a.key=n.C0.NUL)):65===e.keyCode&&(a.type=1);else{const t=i[e.keyCode],r=null==t?void 0:t[e.shiftKey?1:0];if(r)a.key=n.C0.ESC+r;else if(e.keyCode>=65&&e.keyCode<=90){const t=e.ctrlKey?e.keyCode-64:e.keyCode+32;let r=String.fromCharCode(t);e.shiftKey&&(r=r.toUpperCase()),a.key=n.C0.ESC+r}else if(32===e.keyCode)a.key=n.C0.ESC+(e.ctrlKey?n.C0.NUL:" ");else if("Dead"===e.key&&e.code.startsWith("Key")){let t=e.code.slice(3,4);e.shiftKey||(t=t.toLowerCase()),a.key=n.C0.ESC+t,a.cancel=!0}}else e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?a.key=n.C0.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?a.key=n.C0.DEL:219===e.keyCode?a.key=n.C0.ESC:220===e.keyCode?a.key=n.C0.FS:221===e.keyCode&&(a.key=n.C0.GS)}return a}},482:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t=0,r=e.length){let n="";for(let i=t;i<r;++i){let t=e[i];t>65535?(t-=65536,n+=String.fromCharCode(55296+(t>>10))+String.fromCharCode(t%1024+56320)):n+=String.fromCharCode(t)}return n},t.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){const r=e.length;if(!r)return 0;let n=0,i=0;if(this._interim){const r=e.charCodeAt(i++);56320<=r&&r<=57343?t[n++]=1024*(this._interim-55296)+r-56320+65536:(t[n++]=this._interim,t[n++]=r),this._interim=0}for(let o=i;o<r;++o){const i=e.charCodeAt(o);if(55296<=i&&i<=56319){if(++o>=r)return this._interim=i,n;const a=e.charCodeAt(o);56320<=a&&a<=57343?t[n++]=1024*(i-55296)+a-56320+65536:(t[n++]=i,t[n++]=a)}else 65279!==i&&(t[n++]=i)}return n}},t.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){const r=e.length;if(!r)return 0;let n,i,o,a,s=0,l=0,c=0;if(this.interim[0]){let n=!1,i=this.interim[0];i&=192==(224&i)?31:224==(240&i)?15:7;let o,a=0;for(;(o=63&this.interim[++a])&&a<4;)i<<=6,i|=o;const l=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,u=l-a;for(;c<u;){if(c>=r)return 0;if(o=e[c++],128!=(192&o)){c--,n=!0;break}this.interim[a++]=o,i<<=6,i|=63&o}n||(2===l?i<128?c--:t[s++]=i:3===l?i<2048||i>=55296&&i<=57343||65279===i||(t[s++]=i):i<65536||i>1114111||(t[s++]=i)),this.interim.fill(0)}const u=r-4;let d=c;for(;d<r;){for(;!(!(d<u)||128&(n=e[d])||128&(i=e[d+1])||128&(o=e[d+2])||128&(a=e[d+3]));)t[s++]=n,t[s++]=i,t[s++]=o,t[s++]=a,d+=4;if(n=e[d++],n<128)t[s++]=n;else if(192==(224&n)){if(d>=r)return this.interim[0]=n,s;if(i=e[d++],128!=(192&i)){d--;continue}if(l=(31&n)<<6|63&i,l<128){d--;continue}t[s++]=l}else if(224==(240&n)){if(d>=r)return this.interim[0]=n,s;if(i=e[d++],128!=(192&i)){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=i,s;if(o=e[d++],128!=(192&o)){d--;continue}if(l=(15&n)<<12|(63&i)<<6|63&o,l<2048||l>=55296&&l<=57343||65279===l)continue;t[s++]=l}else if(240==(248&n)){if(d>=r)return this.interim[0]=n,s;if(i=e[d++],128!=(192&i)){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=i,s;if(o=e[d++],128!=(192&o)){d--;continue}if(d>=r)return this.interim[0]=n,this.interim[1]=i,this.interim[2]=o,s;if(a=e[d++],128!=(192&a)){d--;continue}if(l=(7&n)<<18|(63&i)<<12|(63&o)<<6|63&a,l<65536||l>1114111)continue;t[s++]=l}}return s}}},225:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;const r=[[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]],n=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let i;t.UnicodeV6=class{constructor(){if(this.version="6",!i){i=new Uint8Array(65536),i.fill(1),i[0]=0,i.fill(0,1,32),i.fill(0,127,160),i.fill(2,4352,4448),i[9001]=2,i[9002]=2,i.fill(2,11904,42192),i[12351]=1,i.fill(2,44032,55204),i.fill(2,63744,64256),i.fill(2,65040,65050),i.fill(2,65072,65136),i.fill(2,65280,65377),i.fill(2,65504,65511);for(let e=0;e<r.length;++e)i.fill(0,r[e][0],r[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?i[e]:function(e,t){let r,n=0,i=t.length-1;if(e<t[0][0]||e>t[i][1])return!1;for(;i>=n;)if(r=n+i>>1,e>t[r][1])n=r+1;else{if(!(e<t[r][0]))return!0;i=r-1}return!1}(e,n)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}}},5981:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;const n=r(8460),i=r(844);class o extends i.Disposable{constructor(e){super(),this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new n.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(e,t){if(void 0!==t&&this._syncCalls>t)return void(this._syncCalls=0);if(this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let r;for(this._isSyncWriting=!0;r=this._writeBuffer.shift();){this._action(r);const e=this._callbacks.shift();e&&e()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t),void this._innerWrite();setTimeout(()=>this._innerWrite())}this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)}_innerWrite(e=0,t=!0){const r=e||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const e=this._writeBuffer[this._bufferOffset],n=this._action(e,t);if(n){const e=e=>Date.now()-r>=12?setTimeout(()=>this._innerWrite(0,e)):this._innerWrite(r,e);return void n.catch(e=>(queueMicrotask(()=>{throw e}),Promise.resolve(!1))).then(e)}const i=this._callbacks[this._bufferOffset];if(i&&i(),this._bufferOffset++,this._pendingData-=e.length,Date.now()-r>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}t.WriteBuffer=o},5941:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.toRgbString=t.parseColor=void 0;const r=/^([\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})$/,n=/^[\da-f]+$/;function i(e,t){const r=e.toString(16),n=r.length<2?"0"+r:r;switch(t){case 4:return r[0];case 8:return n;case 12:return(n+n).slice(0,3);default:return n+n}}t.parseColor=function(e){if(!e)return;let t=e.toLowerCase();if(0===t.indexOf("rgb:")){t=t.slice(4);const e=r.exec(t);if(e){const t=e[1]?15:e[4]?255:e[7]?4095:65535;return[Math.round(parseInt(e[1]||e[4]||e[7]||e[10],16)/t*255),Math.round(parseInt(e[2]||e[5]||e[8]||e[11],16)/t*255),Math.round(parseInt(e[3]||e[6]||e[9]||e[12],16)/t*255)]}}else if(0===t.indexOf("#")&&(t=t.slice(1),n.exec(t)&&[3,6,9,12].includes(t.length))){const e=t.length/3,r=[0,0,0];for(let n=0;n<3;++n){const i=parseInt(t.slice(e*n,e*n+e),16);r[n]=1===e?i<<4:2===e?i:3===e?i>>4:i>>8}return r}},t.toRgbString=function(e,t=16){const[r,n,o]=e;return`rgb:${i(r,t)}/${i(n,t)}/${i(o,t)}`}},5770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;const n=r(482),i=r(8742),o=r(5770),a=[];t.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=a,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=a}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const r=this._handlers[e];return r.push(t),{dispose:()=>{const e=r.indexOf(t);-1!==e&&r.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=a,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||a,this._active.length)for(let r=this._active.length-1;r>=0;r--)this._active[r].hook(t);else this._handlerFb(this._ident,"HOOK",t)}put(e,t,r){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r);else this._handlerFb(this._ident,"PUT",(0,n.utf32ToString)(e,t,r))}unhook(e,t=!0){if(this._active.length){let r=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===r){for(;n>=0&&(r=this._active[n].unhook(e),!0!==r);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].unhook(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}else this._handlerFb(this._ident,"UNHOOK",e);this._active=a,this._ident=0}};const s=new i.Params;s.addParam(0),t.DcsHandler=class{constructor(e){this._handler=e,this._data="",this._params=s,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():s,this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=(0,n.utf32ToString)(e,t,r),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(e=>(this._params=s,this._data="",this._hitLimit=!1,e));return this._params=s,this._data="",this._hitLimit=!1,t}}},2015:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;const n=r(844),i=r(8742),o=r(6242),a=r(6351);class s{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,r,n){this.table[t<<8|e]=r<<4|n}addMany(e,t,r,n){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=r<<4|n}}t.TransitionTable=s;const l=160;t.VT500_TRANSITION_TABLE=function(){const e=new s(4095),t=Array.apply(null,Array(256)).map((e,t)=>t),r=(e,r)=>t.slice(e,r),n=r(32,127),i=r(0,24);i.push(25),i.push.apply(i,r(28,32));const o=r(0,14);let a;for(a in e.setDefault(1,0),e.addMany(n,0,2,0),o)e.addMany([24,26,153,154],a,3,0),e.addMany(r(128,144),a,3,0),e.addMany(r(144,152),a,3,0),e.add(156,a,0,0),e.add(27,a,11,1),e.add(157,a,4,8),e.addMany([152,158,159],a,0,7),e.add(155,a,11,3),e.add(144,a,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(n,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(r(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(n,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(r(64,127),3,7,0),e.addMany(r(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(r(48,60),4,8,4),e.addMany(r(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(r(32,64),6,0,6),e.add(127,6,0,6),e.addMany(r(64,127),6,0,0),e.addMany(r(32,48),3,9,5),e.addMany(r(32,48),5,9,5),e.addMany(r(48,64),5,0,6),e.addMany(r(64,127),5,7,0),e.addMany(r(32,48),4,9,5),e.addMany(r(32,48),1,9,2),e.addMany(r(32,48),2,9,2),e.addMany(r(48,127),2,10,0),e.addMany(r(48,80),1,10,0),e.addMany(r(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(r(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(r(28,32),9,0,9),e.addMany(r(32,48),9,9,12),e.addMany(r(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(r(32,128),11,0,11),e.addMany(r(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(r(28,32),10,0,10),e.addMany(r(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(r(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(r(28,32),12,0,12),e.addMany(r(32,48),12,9,12),e.addMany(r(48,64),12,0,11),e.addMany(r(64,127),12,12,13),e.addMany(r(64,127),10,12,13),e.addMany(r(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(n,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(l,0,2,0),e.add(l,8,5,8),e.add(l,6,0,6),e.add(l,11,0,11),e.add(l,13,13,13),e}();class c extends n.Disposable{constructor(e=t.VT500_TRANSITION_TABLE){super(),this._transitions=e,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new i.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(e,t,r)=>{},this._executeHandlerFb=e=>{},this._csiHandlerFb=(e,t)=>{},this._escHandlerFb=e=>{},this._errorHandlerFb=e=>e,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,n.toDisposable)(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this.register(new o.OscParser),this._dcsParser=this.register(new a.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let r=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(r=e.prefix.charCodeAt(0),r&&60>r||r>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 t=0;t<e.intermediates.length;++t){const n=e.intermediates.charCodeAt(t);if(32>n||n>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");r<<=8,r|=n}}if(1!==e.final.length)throw new Error("final must be a single byte");const n=e.final.charCodeAt(0);if(t[0]>n||n>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return r<<=8,r|=n,r}identToString(e){const t=[];for(;e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){const r=this._identifier(e,[48,126]);void 0===this._escHandlers[r]&&(this._escHandlers[r]=[]);const n=this._escHandlers[r];return n.push(t),{dispose:()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){const r=this._identifier(e);void 0===this._csiHandlers[r]&&(this._csiHandlers[r]=[]);const n=this._csiHandlers[r];return n.push(t),{dispose:()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,0!==this._parseStack.state&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,r,n,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=r,this._parseStack.transition=n,this._parseStack.chunkPos=i}parse(e,t,r){let n,i=0,o=0,a=0;if(this._parseStack.state)if(2===this._parseStack.state)this._parseStack.state=0,a=this._parseStack.chunkPos+1;else{if(void 0===r||1===this._parseStack.state)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const t=this._parseStack.handlers;let o=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(!1===r&&o>-1)for(;o>=0&&(n=t[o](this._params),!0!==n);o--)if(n instanceof Promise)return this._parseStack.handlerPos=o,n;this._parseStack.handlers=[];break;case 4:if(!1===r&&o>-1)for(;o>=0&&(n=t[o](),!0!==n);o--)if(n instanceof Promise)return this._parseStack.handlerPos=o,n;this._parseStack.handlers=[];break;case 6:if(i=e[this._parseStack.chunkPos],n=this._dcsParser.unhook(24!==i&&26!==i,r),n)return n;27===i&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(i=e[this._parseStack.chunkPos],n=this._oscParser.end(24!==i&&26!==i,r),n)return n;27===i&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,a=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let s=a;s<t;++s){switch(i=e[s],o=this._transitions.table[this.currentState<<8|(i<160?i:l)],o>>4){case 2:for(let n=s+1;;++n){if(n>=t||(i=e[n])<32||i>126&&i<l){this._printHandler(e,s,n),s=n-1;break}if(++n>=t||(i=e[n])<32||i>126&&i<l){this._printHandler(e,s,n),s=n-1;break}if(++n>=t||(i=e[n])<32||i>126&&i<l){this._printHandler(e,s,n),s=n-1;break}if(++n>=t||(i=e[n])<32||i>126&&i<l){this._printHandler(e,s,n),s=n-1;break}}break;case 3:this._executeHandlers[i]?this._executeHandlers[i]():this._executeHandlerFb(i),this.precedingCodepoint=0;break;case 0:break;case 1:if(this._errorHandler({position:s,code:i,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:const r=this._csiHandlers[this._collect<<8|i];let a=r?r.length-1:-1;for(;a>=0&&(n=r[a](this._params),!0!==n);a--)if(n instanceof Promise)return this._preserveStack(3,r,a,o,s),n;a<0&&this._csiHandlerFb(this._collect<<8|i,this._params),this.precedingCodepoint=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(++s<t&&(i=e[s])>47&&i<60);s--;break;case 9:this._collect<<=8,this._collect|=i;break;case 10:const c=this._escHandlers[this._collect<<8|i];let u=c?c.length-1:-1;for(;u>=0&&(n=c[u](),!0!==n);u--)if(n instanceof Promise)return this._preserveStack(4,c,u,o,s),n;u<0&&this._escHandlerFb(this._collect<<8|i),this.precedingCodepoint=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 n=s+1;;++n)if(n>=t||24===(i=e[n])||26===i||27===i||i>127&&i<l){this._dcsParser.put(e,s,n),s=n-1;break}break;case 14:if(n=this._dcsParser.unhook(24!==i&&26!==i),n)return this._preserveStack(6,[],0,o,s),n;27===i&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0;break;case 4:this._oscParser.start();break;case 5:for(let n=s+1;;n++)if(n>=t||(i=e[n])<32||i>127&&i<l){this._oscParser.put(e,s,n),s=n-1;break}break;case 6:if(n=this._oscParser.end(24!==i&&26!==i),n)return this._preserveStack(5,[],0,o,s),n;27===i&&(o|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0}this.currentState=15&o}}}t.EscapeSequenceParser=c},6242:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OscHandler=t.OscParser=void 0;const n=r(5770),i=r(482),o=[];t.OscParser=class{constructor(){this._state=0,this._active=o,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);const r=this._handlers[e];return r.push(t),{dispose:()=>{const e=r.indexOf(t);-1!==e&&r.splice(e,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=o}reset(){if(2===this._state)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=o,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||o,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")}_put(e,t,r){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(e,t,r);else this._handlerFb(this._id,"PUT",(0,i.utf32ToString)(e,t,r))}start(){this.reset(),this._state=1}put(e,t,r){if(3!==this._state){if(1===this._state)for(;t<r;){const r=e[t++];if(59===r){this._state=2,this._start();break}if(r<48||57<r)return void(this._state=3);-1===this._id&&(this._id=0),this._id=10*this._id+r-48}2===this._state&&r-t>0&&this._put(e,t,r)}}end(e,t=!0){if(0!==this._state){if(3!==this._state)if(1===this._state&&this._start(),this._active.length){let r=!1,n=this._active.length-1,i=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,r=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&!1===r){for(;n>=0&&(r=this._active[n].end(e),!0!==r);n--)if(r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,r;n--}for(;n>=0;n--)if(r=this._active[n].end(!1),r instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,r}else this._handlerFb(this._id,"END",e);this._active=o,this._id=-1,this._state=0}}},t.OscHandler=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,r){this._hitLimit||(this._data+=(0,i.utf32ToString)(e,t,r),this._data.length>n.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(e=>(this._data="",this._hitLimit=!1,e));return this._data="",this._hitLimit=!1,t}}},8742:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;const r=2147483647;class n{static fromArray(e){const t=new n;if(!e.length)return t;for(let r=Array.isArray(e[0])?1:0;r<e.length;++r){const n=e[r];if(Array.isArray(n))for(let e=0;e<n.length;++e)t.addSubParam(n[e]);else t.addParam(n)}return t}constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const e=new n(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){const e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);const r=this._subParamsIdx[t]>>8,n=255&this._subParamsIdx[t];n-r>0&&e.push(Array.prototype.slice.call(this._subParams,r,n))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>r?r:e}}addSubParam(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>r?r:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0}getSubParams(e){const t=this._subParamsIdx[e]>>8,r=255&this._subParamsIdx[e];return r-t>0?this._subParams.subarray(t,r):null}getSubParamsAll(){const e={};for(let t=0;t<this.length;++t){const r=this._subParamsIdx[t]>>8,n=255&this._subParamsIdx[t];n-r>0&&(e[t]=this._subParams.slice(r,n))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const n=this._digitIsSub?this._subParams:this.params,i=n[t-1];n[t-1]=~i?Math.min(10*i+e,r):e}}t.Params=n},5741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0,t.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){const r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=()=>this._wrappedAddonDispose(r),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let r=0;r<this._addons.length;r++)if(this._addons[r]===e){t=r;break}if(-1===t)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)}}},8771:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferApiView=void 0;const n=r(3785),i=r(511);t.BufferApiView=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){const t=this._buffer.lines.get(e);if(t)return new n.BufferLineApiView(t)}getNullCell(){return new i.CellData}}},3785:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLineApiView=void 0;const n=r(511);t.BufferLineApiView=class{constructor(e){this._line=e}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(e,t){if(!(e<0||e>=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new n.CellData)}translateToString(e,t,r){return this._line.translateToString(e,t,r)}}},8285:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BufferNamespaceApi=void 0;const n=r(8771),i=r(8460),o=r(844);class a extends o.Disposable{constructor(e){super(),this._core=e,this._onBufferChange=this.register(new i.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new n.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new n.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}t.BufferNamespaceApi=a},7975:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParserApi=void 0,t.ParserApi=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,e=>t(e.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(e,r)=>t(e,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}}},7090:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeApi=void 0,t.UnicodeApi=class{constructor(e){this._core=e}register(e){this._core.unicodeService.register(e)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(e){this._core.unicodeService.activeVersion=e}}},744:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;const o=r(8460),a=r(844),s=r(5295),l=r(2585);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;let c=t.BufferService=class extends a.Disposable{get buffer(){return this.buffers.active}constructor(e){super(),this.isUserScrolling=!1,this._onResize=this.register(new o.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new o.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,t.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,t.MINIMUM_ROWS),this.buffers=this.register(new s.BufferSet(e,this))}resize(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){const r=this.buffer;let n;n=this._cachedBlankLine,n&&n.length===this.cols&&n.getFg(0)===e.fg&&n.getBg(0)===e.bg||(n=r.getBlankLine(e,t),this._cachedBlankLine=n),n.isWrapped=t;const i=r.ybase+r.scrollTop,o=r.ybase+r.scrollBottom;if(0===r.scrollTop){const e=r.lines.isFull;o===r.lines.length-1?e?r.lines.recycle().copyFrom(n):r.lines.push(n.clone()):r.lines.splice(o+1,0,n.clone()),e?this.isUserScrolling&&(r.ydisp=Math.max(r.ydisp-1,0)):(r.ybase++,this.isUserScrolling||r.ydisp++)}else{const e=o-i+1;r.lines.shiftElements(i+1,e-1,-1),r.lines.set(o,n.clone())}this.isUserScrolling||(r.ydisp=r.ybase),this._onScroll.fire(r.ydisp)}scrollLines(e,t,r){const n=this.buffer;if(e<0){if(0===n.ydisp)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);const i=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),i!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};t.BufferService=c=n([i(0,l.IOptionsService)],c)},7994:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0,t.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(e){this.glevel=e,this.charset=this._charsets[e]}setgCharset(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)}}},1753:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;const o=r(2585),a=r(8460),s=r(844),l={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>32!==e.action},DRAG:{events:23,restrict:e=>32!==e.action||3!==e.button},ANY:{events:31,restrict:e=>!0}};function c(e,t){let r=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(r|=64,r|=e.action):(r|=3&e.button,4&e.button&&(r|=64),8&e.button&&(r|=128),32===e.action?r|=32:0!==e.action||t||(r|=3)),r}const u=String.fromCharCode,d={DEFAULT:e=>{const t=[c(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`${u(t[0])}${u(t[1])}${u(t[2])}`},SGR:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${c(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{const t=0===e.action&&4!==e.button?"m":"M";return`[<${c(e,!0)};${e.x};${e.y}${t}`}};let p=t.CoreMouseService=class extends s.Disposable{constructor(e,t){super(),this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new a.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const r of Object.keys(l))this.addProtocol(r,l[r]);for(const r of Object.keys(d))this.addEncoding(r,d[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return 0!==this._protocols[this._activeProtocol].events}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}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._equalEvents(this._lastEvent,e,"SGR_PIXELS"===this._activeEncoding))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;const t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}}_equalEvents(e,t,r){if(r){if(e.x!==t.x)return!1;if(e.y!==t.y)return!1}else{if(e.col!==t.col)return!1;if(e.row!==t.row)return!1}return e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift}};t.CoreMouseService=p=n([i(0,o.IBufferService),i(1,o.ICoreService)],p)},6975:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;const o=r(1439),a=r(8460),s=r(844),l=r(2585),c=Object.freeze({insertMode:!1}),u=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let d=t.CoreService=class extends s.Disposable{constructor(e,t,r){super(),this._bufferService=e,this._logService=t,this._optionsService=r,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new a.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new a.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new a.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new a.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,o.clone)(c),this.decPrivateModes=(0,o.clone)(u)}reset(){this.modes=(0,o.clone)(c),this.decPrivateModes=(0,o.clone)(u)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;const r=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&r.ybase!==r.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`,()=>e.split("").map(e=>e.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`,()=>e.split("").map(e=>e.charCodeAt(0))),this._onBinary.fire(e))}};t.CoreService=d=n([i(0,l.IBufferService),i(1,l.ILogService),i(2,l.IOptionsService)],d)},9074:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DecorationService=void 0;const n=r(8055),i=r(8460),o=r(844),a=r(6106);let s=0,l=0;class c extends o.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new a.SortedList(e=>null==e?void 0:e.marker.line),this._onDecorationRegistered=this.register(new i.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new i.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,o.toDisposable)(()=>this.reset()))}registerDecoration(e){if(e.marker.isDisposed)return;const t=new u(e);if(t){const e=t.marker.onDispose(()=>t.dispose());t.onDispose(()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),e.dispose())}),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,r){var n,i,o;let a=0,s=0;for(const l of this._decorations.getKeyIterator(t))a=null!==(n=l.options.x)&&void 0!==n?n:0,s=a+(null!==(i=l.options.width)&&void 0!==i?i:1),e>=a&&e<s&&(!r||(null!==(o=l.options.layer)&&void 0!==o?o:"bottom")===r)&&(yield l)}forEachDecorationAtCell(e,t,r,n){this._decorations.forEachByKey(t,t=>{var i,o,a;s=null!==(i=t.options.x)&&void 0!==i?i:0,l=s+(null!==(o=t.options.width)&&void 0!==o?o:1),e>=s&&e<l&&(!r||(null!==(a=t.options.layer)&&void 0!==a?a:"bottom")===r)&&n(t)})}}t.DecorationService=c;class u extends o.Disposable{get isDisposed(){return this._isDisposed}get backgroundColorRGB(){return null===this._cachedBg&&(this.options.backgroundColor?this._cachedBg=n.css.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return null===this._cachedFg&&(this.options.foregroundColor?this._cachedFg=n.css.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}constructor(e){super(),this.options=e,this.onRenderEmitter=this.register(new i.EventEmitter),this.onRender=this.onRenderEmitter.event,this._onDispose=this.register(new i.EventEmitter),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}dispose(){this._onDispose.fire(),super.dispose()}}},4348:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InstantiationService=t.ServiceCollection=void 0;const n=r(2585),i=r(8343);class o{constructor(...e){this._entries=new Map;for(const[t,r]of e)this.set(t,r)}set(e,t){const r=this._entries.get(e);return this._entries.set(e,t),r}forEach(e){for(const[t,r]of this._entries.entries())e(t,r)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}}t.ServiceCollection=o,t.InstantiationService=class{constructor(){this._services=new o,this._services.set(n.IInstantiationService,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){const r=(0,i.getServiceDependencies)(e).sort((e,t)=>e.index-t.index),n=[];for(const i of r){const t=this._services.get(i.id);if(!t)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${i.id}.`);n.push(t)}const o=r.length>0?r[0].index:t.length;if(t.length!==o)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${o+1} conflicts with ${t.length} static arguments`);return new e(...[...t,...n])}}},7866:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.traceCall=t.setTraceLogger=t.LogService=void 0;const o=r(844),a=r(2585),s={trace:a.LogLevelEnum.TRACE,debug:a.LogLevelEnum.DEBUG,info:a.LogLevelEnum.INFO,warn:a.LogLevelEnum.WARN,error:a.LogLevelEnum.ERROR,off:a.LogLevelEnum.OFF};let l,c=t.LogService=class extends o.Disposable{get logLevel(){return this._logLevel}constructor(e){super(),this._optionsService=e,this._logLevel=a.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel())),l=this}_updateLogLevel(){this._logLevel=s[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,r){this._evalLazyOptionalParams(r),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...r)}trace(e,...t){var r,n;this._logLevel<=a.LogLevelEnum.TRACE&&this._log(null!==(n=null===(r=this._optionsService.options.logger)||void 0===r?void 0:r.trace.bind(this._optionsService.options.logger))&&void 0!==n?n:console.log,e,t)}debug(e,...t){var r,n;this._logLevel<=a.LogLevelEnum.DEBUG&&this._log(null!==(n=null===(r=this._optionsService.options.logger)||void 0===r?void 0:r.debug.bind(this._optionsService.options.logger))&&void 0!==n?n:console.log,e,t)}info(e,...t){var r,n;this._logLevel<=a.LogLevelEnum.INFO&&this._log(null!==(n=null===(r=this._optionsService.options.logger)||void 0===r?void 0:r.info.bind(this._optionsService.options.logger))&&void 0!==n?n:console.info,e,t)}warn(e,...t){var r,n;this._logLevel<=a.LogLevelEnum.WARN&&this._log(null!==(n=null===(r=this._optionsService.options.logger)||void 0===r?void 0:r.warn.bind(this._optionsService.options.logger))&&void 0!==n?n:console.warn,e,t)}error(e,...t){var r,n;this._logLevel<=a.LogLevelEnum.ERROR&&this._log(null!==(n=null===(r=this._optionsService.options.logger)||void 0===r?void 0:r.error.bind(this._optionsService.options.logger))&&void 0!==n?n:console.error,e,t)}};t.LogService=c=n([i(0,a.IOptionsService)],c),t.setTraceLogger=function(e){l=e},t.traceCall=function(e,t,r){if("function"!=typeof r.value)throw new Error("not supported");const n=r.value;r.value=function(...e){if(l.logLevel!==a.LogLevelEnum.TRACE)return n.apply(this,e);l.trace(`GlyphRenderer#${n.name}(${e.map(e=>JSON.stringify(e)).join(", ")})`);const t=n.apply(this,e);return l.trace(`GlyphRenderer#${n.name} return`,t),t}}},7302:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionsService=t.DEFAULT_OPTIONS=void 0;const n=r(8460),i=r(844),o=r(6114);t.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:o.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const a=["normal","bold","100","200","300","400","500","600","700","800","900"];class s extends i.Disposable{constructor(e){super(),this._onOptionChange=this.register(new n.EventEmitter),this.onOptionChange=this._onOptionChange.event;const r=Object.assign({},t.DEFAULT_OPTIONS);for(const t in e)if(t in r)try{const n=e[t];r[t]=this._sanitizeAndValidateOption(t,n)}catch(i){}this.rawOptions=r,this.options=Object.assign({},r),this._setupOptions()}onSpecificOptionChange(e,t){return this.onOptionChange(r=>{r===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(r=>{-1!==e.indexOf(r)&&t()})}_setupOptions(){const e=e=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);return this.rawOptions[e]},r=(e,r)=>{if(!(e in t.DEFAULT_OPTIONS))throw new Error(`No option with key "${e}"`);r=this._sanitizeAndValidateOption(e,r),this.rawOptions[e]!==r&&(this.rawOptions[e]=r,this._onOptionChange.fire(e))};for(const t in this.rawOptions){const n={get:e.bind(this,t),set:r.bind(this,t)};Object.defineProperty(this.options,t,n)}}_sanitizeAndValidateOption(e,r){switch(e){case"cursorStyle":if(r||(r=t.DEFAULT_OPTIONS[e]),!function(e){return"block"===e||"underline"===e||"bar"===e}(r))throw new Error(`"${r}" is not a valid value for ${e}`);break;case"wordSeparator":r||(r=t.DEFAULT_OPTIONS[e]);break;case"fontWeight":case"fontWeightBold":if("number"==typeof r&&1<=r&&r<=1e3)break;r=a.includes(r)?r:t.DEFAULT_OPTIONS[e];break;case"cursorWidth":r=Math.floor(r);case"lineHeight":case"tabStopWidth":if(r<1)throw new Error(`${e} cannot be less than 1, value: ${r}`);break;case"minimumContrastRatio":r=Math.max(1,Math.min(21,Math.round(10*r)/10));break;case"scrollback":if((r=Math.min(r,4294967295))<0)throw new Error(`${e} cannot be less than 0, value: ${r}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(r<=0)throw new Error(`${e} cannot be less than or equal to 0, value: ${r}`);break;case"rows":case"cols":if(!r&&0!==r)throw new Error(`${e} must be numeric, value: ${r}`);break;case"windowsPty":r=null!=r?r:{}}return r}}t.OptionsService=s},2660:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a},i=this&&this.__param||function(e,t){return function(r,n){t(r,n,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.OscLinkService=void 0;const o=r(2585);let a=t.OscLinkService=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){const t=this._bufferService.buffer;if(void 0===e.id){const r=t.addMarker(t.ybase+t.y),n={data:e,id:this._nextId++,lines:[r]};return r.onDispose(()=>this._removeMarkerFromLink(n,r)),this._dataByLinkId.set(n.id,n),n.id}const r=e,n=this._getEntryIdKey(r),i=this._entriesWithId.get(n);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;const o=t.addMarker(t.ybase+t.y),a={id:this._nextId++,key:this._getEntryIdKey(r),data:r,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(a,o)),this._entriesWithId.set(a.key,a),this._dataByLinkId.set(a.id,a),a.id}addLineToLink(e,t){const r=this._dataByLinkId.get(e);if(r&&r.lines.every(e=>e.line!==t)){const e=this._bufferService.buffer.addMarker(t);r.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(r,e))}}getLinkData(e){var t;return null===(t=this._dataByLinkId.get(e))||void 0===t?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){const r=e.lines.indexOf(t);-1!==r&&(e.lines.splice(r,1),0===e.lines.length&&(void 0!==e.data.id&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};t.OscLinkService=a=n([i(0,o.IBufferService)],a)},8343:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDecorator=t.getServiceDependencies=t.serviceRegistry=void 0;const r="di$target",n="di$dependencies";t.serviceRegistry=new Map,t.getServiceDependencies=function(e){return e[n]||[]},t.createDecorator=function(e){if(t.serviceRegistry.has(e))return t.serviceRegistry.get(e);const i=function(e,t,o){if(3!==arguments.length)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");var a,s,l;a=i,l=o,(s=e)[r]===s?s[n].push({id:a,index:l}):(s[n]=[{id:a,index:l}],s[r]=s)};return i.toString=()=>e,t.serviceRegistry.set(e,i),i}},2585:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IDecorationService=t.IUnicodeService=t.IOscLinkService=t.IOptionsService=t.ILogService=t.LogLevelEnum=t.IInstantiationService=t.ICharsetService=t.ICoreService=t.ICoreMouseService=t.IBufferService=void 0;const n=r(8343);var i,o;t.IBufferService=(0,n.createDecorator)("BufferService"),t.ICoreMouseService=(0,n.createDecorator)("CoreMouseService"),t.ICoreService=(0,n.createDecorator)("CoreService"),t.ICharsetService=(0,n.createDecorator)("CharsetService"),t.IInstantiationService=(0,n.createDecorator)("InstantiationService"),(o=i||(t.LogLevelEnum=i={}))[o.TRACE=0]="TRACE",o[o.DEBUG=1]="DEBUG",o[o.INFO=2]="INFO",o[o.WARN=3]="WARN",o[o.ERROR=4]="ERROR",o[o.OFF=5]="OFF",t.ILogService=(0,n.createDecorator)("LogService"),t.IOptionsService=(0,n.createDecorator)("OptionsService"),t.IOscLinkService=(0,n.createDecorator)("OscLinkService"),t.IUnicodeService=(0,n.createDecorator)("UnicodeService"),t.IDecorationService=(0,n.createDecorator)("DecorationService")},1480:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeService=void 0;const n=r(8460),i=r(225);t.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new n.EventEmitter,this.onChange=this._onChange.event;const e=new i.UnicodeV6;this.register(e),this._active=e.version,this._activeProvider=e}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0;const r=e.length;for(let n=0;n<r;++n){let i=e.charCodeAt(n);if(55296<=i&&i<=56319){if(++n>=r)return t+this.wcwidth(i);const o=e.charCodeAt(n);56320<=o&&o<=57343?i=1024*(i-55296)+o-56320+65536:t+=this.wcwidth(o)}t+=this.wcwidth(i)}return t}}}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n].call(o.exports,o,o.exports,r),o.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.Terminal=void 0;const t=r(9042),i=r(3236),o=r(844),a=r(5741),s=r(8285),l=r(7975),c=r(7090),u=["cols","rows"];class d extends o.Disposable{constructor(e){super(),this._core=this.register(new i.Terminal(e)),this._addonManager=this.register(new a.AddonManager),this._publicOptions=Object.assign({},this._core.options);const t=e=>this._core.options[e],r=(e,t)=>{this._checkReadonlyOptions(e),this._core.options[e]=t};for(const n in this._core.options){const e={get:t.bind(this,n),set:r.bind(this,n)};Object.defineProperty(this._publicOptions,n,e)}}_checkReadonlyOptions(e){if(u.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 l.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new c.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new s.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const e=this._core.coreService.decPrivateModes;let t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any"}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(const t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(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){var t,r,n;return this._checkProposedApi(),this._verifyPositiveIntegers(null!==(t=e.x)&&void 0!==t?t:0,null!==(r=e.width)&&void 0!==r?r:0,null!==(n=e.height)&&void 0!==n?n:0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,r){this._verifyIntegers(e,t,r),this._core.select(e,t,r)}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\n",t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return t}_verifyIntegers(...e){for(const t of e)if(t===1/0||isNaN(t)||t%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(const t of e)if(t&&(t===1/0||isNaN(t)||t%1!=0||t<0))throw new Error("This API only accepts positive integers")}}e.Terminal=d})(),n})(),e.exports=r()}(xterm);var xtermExports=xterm.exports,xtermAddonAttach={exports:{}};!function(e,t){self,e.exports=(()=>{var e={};return(()=>{var t=e;function r(e,t,r){return e.addEventListener(t,r),{dispose:()=>{r&&e.removeEventListener(t,r)}}}Object.defineProperty(t,"__esModule",{value:!0}),t.AttachAddon=void 0,t.AttachAddon=class{constructor(e,t){this._disposables=[],this._socket=e,this._socket.binaryType="arraybuffer",this._bidirectional=!(t&&!1===t.bidirectional)}activate(e){this._disposables.push(r(this._socket,"message",t=>{const r=t.data;e.write("string"==typeof r?r:new Uint8Array(r))})),this._bidirectional&&(this._disposables.push(e.onData(e=>this._sendData(e))),this._disposables.push(e.onBinary(e=>this._sendBinary(e)))),this._disposables.push(r(this._socket,"close",()=>this.dispose())),this._disposables.push(r(this._socket,"error",()=>this.dispose()))}dispose(){for(const e of this._disposables)e.dispose()}_sendData(e){this._checkOpenSocket()&&this._socket.send(e)}_sendBinary(e){if(!this._checkOpenSocket())return;const t=new Uint8Array(e.length);for(let r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);this._socket.send(t)}_checkOpenSocket(){switch(this._socket.readyState){case WebSocket.OPEN:return!0;case WebSocket.CONNECTING:throw new Error("Attach addon was loaded before socket was open");case WebSocket.CLOSING:return!1;case WebSocket.CLOSED:throw new Error("Attach addon socket is closed");default:throw new Error("Unexpected socket state")}}}})(),e})()}(xtermAddonAttach);var xtermAddonAttachExports=xtermAddonAttach.exports,xtermAddonFit={exports:{}};!function(e,t){self,e.exports=(()=>{var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{constructor(){}activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const 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)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const r=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,n=window.getComputedStyle(this._terminal.element.parentElement),i=parseInt(n.getPropertyValue("height")),o=Math.max(0,parseInt(n.getPropertyValue("width"))),a=window.getComputedStyle(this._terminal.element),s=i-(parseInt(a.getPropertyValue("padding-top"))+parseInt(a.getPropertyValue("padding-bottom"))),l=o-(parseInt(a.getPropertyValue("padding-right"))+parseInt(a.getPropertyValue("padding-left")))-r;return{cols:Math.max(2,Math.floor(l/t.css.cell.width)),rows:Math.max(1,Math.floor(s/t.css.cell.height))}}}})(),e})()}(xtermAddonFit);var xtermAddonFitExports=xtermAddonFit.exports,xtermAddonWebLinks={exports:{}};!function(e,t){self,e.exports=(()=>{var e={6:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LinkComputer=t.WebLinkProvider=void 0,t.WebLinkProvider=class{constructor(e,t,r,n={}){this._terminal=e,this._regex=t,this._handler=r,this._options=n}provideLinks(e,t){const n=r.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,r)=>{if(this._options.hover){const{range:n}=e;this._options.hover(t,r,n)}},e))}};class r{static computeLink(e,t,n,i){const o=new RegExp(t.source,(t.flags||"")+"g"),[a,s]=r._getWindowedLineStrings(e-1,n),l=a.join("");let c;const u=[];for(;c=o.exec(l);){const e=c[0];try{const t=new URL(e),r=decodeURI(t.toString());if(e!==r&&e+"/"!==r)continue}catch(d){continue}const[t,o]=r._mapStrIdx(n,s,0,c.index),[a,l]=r._mapStrIdx(n,t,o,e.length);if(-1===t||-1===o||-1===a||-1===l)continue;const p={start:{x:o+1,y:t+1},end:{x:l,y:a+1}};u.push({range:p,text:e,activate:i})}return u}static _getWindowedLineStrings(e,t){let r,n=e,i=e,o=0,a="";const s=[];if(r=t.buffer.active.getLine(e)){const e=r.translateToString(!0);if(r.isWrapped&&" "!==e[0]){for(o=0;(r=t.buffer.active.getLine(--n))&&o<2048&&(a=r.translateToString(!0),o+=a.length,s.push(a),r.isWrapped&&-1===a.indexOf(" ")););s.reverse()}for(s.push(e),o=0;(r=t.buffer.active.getLine(++i))&&r.isWrapped&&o<2048&&(a=r.translateToString(!0),o+=a.length,s.push(a),-1===a.indexOf(" ")););}return[s,n]}static _mapStrIdx(e,t,r,n){const i=e.buffer.active,o=i.getNullCell();let a=r;for(;n;){const e=i.getLine(t);if(!e)return[-1,-1];for(let r=a;r<e.length;++r){e.getCell(r,o);const a=o.getChars();if(o.getWidth()&&(n-=a.length||1,r===e.length-1&&""===a)){const e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,o),2===o.getWidth()&&(n+=1))}if(n<0)return[t,r]}t++,a=0}return[t,a]}}t.LinkComputer=r}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.WebLinksAddon=void 0;const t=r(6),i=/https?:[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function o(e,t){const r=window.open();if(r){try{r.opener=null}catch(n){}r.location.href=t}}e.WebLinksAddon=class{constructor(e=o,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;const r=this._options,n=r.urlRegex||i;this._linkProvider=this._terminal.registerLinkProvider(new t.WebLinkProvider(this._terminal,n,this._handler,r))}dispose(){var e;null===(e=this._linkProvider)||void 0===e||e.dispose()}}})(),n})()}(xtermAddonWebLinks);var xtermAddonWebLinksExports=xtermAddonWebLinks.exports,MapShim=function(){if("undefined"!=typeof Map)return Map;function e(e,t){var r=-1;return e.some(function(e,n){return e[0]===t&&(r=n,!0)}),r}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var r=e(this.__entries__,t),n=this.__entries__[r];return n&&n[1]},t.prototype.set=function(t,r){var n=e(this.__entries__,t);~n?this.__entries__[n][1]=r:this.__entries__.push([t,r])},t.prototype.delete=function(t){var r=this.__entries__,n=e(r,t);~n&&r.splice(n,1)},t.prototype.has=function(t){return!!~e(this.__entries__,t)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(e,t){void 0===t&&(t=null);for(var r=0,n=this.__entries__;r<n.length;r++){var i=n[r];e.call(t,i[1],i[0])}},t}()}(),isBrowser="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,global$1="undefined"!=typeof global&&global.Math===Math?global:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),requestAnimationFrame$1="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(global$1):function(e){return setTimeout(function(){return e(Date.now())},1e3/60)},trailingTimeout=2;function throttle(e,t){var r=!1,n=!1,i=0;function o(){r&&(r=!1,e()),n&&s()}function a(){requestAnimationFrame$1(o)}function s(){var e=Date.now();if(r){if(e-i<trailingTimeout)return;n=!0}else r=!0,n=!1,setTimeout(a,t);i=e}return s}var REFRESH_DELAY=20,transitionKeys=["top","right","bottom","left","width","height","size","weight"],mutationObserverSupported="undefined"!=typeof MutationObserver,ResizeObserverController=function(){function e(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=throttle(this.refresh.bind(this),REFRESH_DELAY)}return e.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},e.prototype.removeObserver=function(e){var t=this.observers_,r=t.indexOf(e);~r&&t.splice(r,1),!t.length&&this.connected_&&this.disconnect_()},e.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},e.prototype.updateObservers_=function(){var e=this.observers_.filter(function(e){return e.gatherActive(),e.hasActive()});return e.forEach(function(e){return e.broadcastActive()}),e.length>0},e.prototype.connect_=function(){isBrowser&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mutationObserverSupported?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){isBrowser&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(e){var t=e.propertyName,r=void 0===t?"":t;transitionKeys.some(function(e){return!!~r.indexOf(e)})&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),defineConfigurable=function(e,t){for(var r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];Object.defineProperty(e,i,{value:t[i],enumerable:!1,writable:!1,configurable:!0})}return e},getWindowOf=function(e){return e&&e.ownerDocument&&e.ownerDocument.defaultView||global$1},emptyRect=createRectInit(0,0,0,0);function toFloat(e){return parseFloat(e)||0}function getBordersSize(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return t.reduce(function(t,r){return t+toFloat(e["border-"+r+"-width"])},0)}function getPaddings(e){for(var t={},r=0,n=["top","right","bottom","left"];r<n.length;r++){var i=n[r],o=e["padding-"+i];t[i]=toFloat(o)}return t}function getSVGContentRect(e){var t=e.getBBox();return createRectInit(0,0,t.width,t.height)}function getHTMLElementContentRect(e){var t=e.clientWidth,r=e.clientHeight;if(!t&&!r)return emptyRect;var n=getWindowOf(e).getComputedStyle(e),i=getPaddings(n),o=i.left+i.right,a=i.top+i.bottom,s=toFloat(n.width),l=toFloat(n.height);if("border-box"===n.boxSizing&&(Math.round(s+o)!==t&&(s-=getBordersSize(n,"left","right")+o),Math.round(l+a)!==r&&(l-=getBordersSize(n,"top","bottom")+a)),!isDocumentElement(e)){var c=Math.round(s+o)-t,u=Math.round(l+a)-r;1!==Math.abs(c)&&(s-=c),1!==Math.abs(u)&&(l-=u)}return createRectInit(i.left,i.top,s,l)}var isSVGGraphicsElement="undefined"!=typeof SVGGraphicsElement?function(e){return e instanceof getWindowOf(e).SVGGraphicsElement}:function(e){return e instanceof getWindowOf(e).SVGElement&&"function"==typeof e.getBBox};function isDocumentElement(e){return e===getWindowOf(e).document.documentElement}function getContentRect(e){return isBrowser?isSVGGraphicsElement(e)?getSVGContentRect(e):getHTMLElementContentRect(e):emptyRect}function createReadOnlyRect(e){var t=e.x,r=e.y,n=e.width,i=e.height,o="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,a=Object.create(o.prototype);return defineConfigurable(a,{x:t,y:r,width:n,height:i,top:r,right:t+n,bottom:i+r,left:t}),a}function createRectInit(e,t,r,n){return{x:e,y:t,width:r,height:n}}var ResizeObservation=function(){function e(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=createRectInit(0,0,0,0),this.target=e}return e.prototype.isActive=function(){var e=getContentRect(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},e.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},e}(),ResizeObserverEntry=function(){return function(e,t){var r=createReadOnlyRect(t);defineConfigurable(this,{target:e,contentRect:r})}}(),ResizeObserverSPI=function(){function e(e,t,r){if(this.activeObservations_=[],this.observations_=new MapShim,"function"!=typeof e)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=t,this.callbackCtx_=r}return e.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof getWindowOf(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)||(t.set(e,new ResizeObservation(e)),this.controller_.addObserver(this),this.controller_.refresh())}},e.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(e instanceof getWindowOf(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var t=this.observations_;t.has(e)&&(t.delete(e),t.size||this.controller_.removeObserver(this))}},e.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},e.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(t){t.isActive()&&e.activeObservations_.push(t)})},e.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,t=this.activeObservations_.map(function(e){return new ResizeObserverEntry(e.target,e.broadcastRect())});this.callback_.call(e,t,e),this.clearActive()}},e.prototype.clearActive=function(){this.activeObservations_.splice(0)},e.prototype.hasActive=function(){return this.activeObservations_.length>0},e}(),observers="undefined"!=typeof WeakMap?new WeakMap:new MapShim,ResizeObserver$1=function(){return function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=ResizeObserverController.getInstance(),n=new ResizeObserverSPI(t,r,this);observers.set(this,n)}}();["observe","unobserve","disconnect"].forEach(function(e){ResizeObserver$1.prototype[e]=function(){var t;return(t=observers.get(this))[e].apply(t,arguments)}});var index=void 0!==global$1.ResizeObserver?global$1.ResizeObserver:ResizeObserver$1;const ANSI_COLORS={reset:"",green:"",yellow:"",gray:"",cyan:""};function parseCommandString(e,t={}){const{preserveEmptyLines:r=!1,includeLineBreaks:n=!1}=t,i=e.split("\n"),o=[];let a="",s=0;for(let l=0;l<i.length;l++){s=l+1;const e=i[l].trim();e?e.startsWith("#!")||(e.startsWith("#")?a+=(a?" ":"")+e:(o.push({raw:e,command:extractCommand(e),comment:a,lineNumber:s,isGitCommand:e.startsWith("git"),hasRedirect:e.includes(">")||e.includes("|")||e.includes("<"),hasArguments:e.includes(" ")}),a="")):r&&n&&o.push({raw:"",command:"",comment:"",lineNumber:s,isGitCommand:!1,hasRedirect:!1,hasArguments:!1})}return o}function extractCommand(e){const t=e.trim();let r=!1,n="";for(let i=0;i<t.length;i++){const e=t[i];if('"'!==e&&"'"!==e||r){if(e===n&&r)r=!1;else if(" "===e&&!r)return t.substring(0,i)}else r=!0,n=e}return t}async function parseAndExecuteCommands(e,t,r={}){const n=parseCommandString(e).filter(e=>{const t=e.raw.trim();return t&&!t.startsWith("#!")});return await executeCommands(n,t,r),n}async function executeCommands(e,t,r={}){const{delay:n=200,showPrompt:i=!0,showComments:o=!0,simulateOutput:a=!0,abortSignal:s,onCommandStart:l,onCommandComplete:c}=r;for(let u=0;u<e.length;u++){const r=e[u];if(null==s?void 0:s.aborted)throw new Error("Command execution aborted");if(!r.raw.trim()||r.raw.trim().startsWith("#"))continue;null==l||l(r,u),o&&r.comment&&(t(`${ANSI_COLORS.gray}${r.comment}${ANSI_COLORS.reset}\r\n`),await sleep(n/2,s));t(`${i?`${ANSI_COLORS.green}$${ANSI_COLORS.reset} `:""}${r.raw}\r\n`),await sleep(n,s),a&&await simulateCommandOutput(r,t,n,s),null==c||c(r,u),u<e.length-1&&await sleep(n/2,s)}i&&t(`\r\n${ANSI_COLORS.green}$${ANSI_COLORS.reset} `)}async function simulateCommandOutput(e,t,r,n){const{raw:i,command:o}=e;"git"===o?await simulateGitCommand(i,t,r,n):"echo"===o?await simulateEchoCommand(i,t,r,n):i.includes("> /dev/null")?(t(`${ANSI_COLORS.gray}(输出已重定向到 /dev/null)${ANSI_COLORS.reset}\r\n`),await sleep(r,n)):await simulateGenericCommand(i,t,r,n)}async function simulateGitCommand(e,t,r,n){if(e.includes("git config user.email"))t(`${ANSI_COLORS.yellow}✓ 已设置用户邮箱${ANSI_COLORS.reset}\r\n`),await sleep(r,n);else if(e.includes("git config user.name"))t(`${ANSI_COLORS.yellow}✓ 已设置用户名${ANSI_COLORS.reset}\r\n`),await sleep(r,n);else if(e.includes("git init"))t(`${ANSI_COLORS.yellow}已初始化空的 Git 仓库于当前目录${ANSI_COLORS.reset}\r\n`),await sleep(r,n);else if(e.includes("git add")){const i=e.match(/git add\s+(.+)/);i&&(t(`${ANSI_COLORS.yellow}添加了文件: ${i[1]}${ANSI_COLORS.reset}\r\n`),await sleep(r,n))}else e.includes("git commit")?await simulateGitCommit(e,t,r,n):e.includes("git log")&&await simulateGitLog(e,t,r,n)}async function simulateGitCommit(e,t,r,n){const i=e.match(/-m\s+["']([^"']+)["']/),o=i?i[1]:"提交",a=Math.random().toString(36).substring(2,9);t(`${ANSI_COLORS.yellow}[main (root-commit) ${a}] ${o}${ANSI_COLORS.reset}\r\n`),t(`${ANSI_COLORS.yellow} 1 file changed, 0 insertions(+), 0 deletions(-)${ANSI_COLORS.reset}\r\n`),t(`${ANSI_COLORS.yellow} create mode 100644 file1.txt${ANSI_COLORS.reset}\r\n`),await sleep(r,n)}async function simulateGitLog(e,t,r,n){const i=Math.random().toString(36).substring(2,9);t(`${ANSI_COLORS.yellow}${i} 初始化提交,添加 file1.txt${ANSI_COLORS.reset}\r\n`),e.includes("--oneline")||(t(`${ANSI_COLORS.yellow}Author: Your Name <you@example.com>${ANSI_COLORS.reset}\r\n`),t(`${ANSI_COLORS.yellow}Date: ${(new Date).toLocaleString()}${ANSI_COLORS.reset}\r\n`),t(`${ANSI_COLORS.yellow}${ANSI_COLORS.reset}\r\n`),t(`${ANSI_COLORS.yellow} 初始化提交,添加 file1.txt${ANSI_COLORS.reset}\r\n`)),await sleep(r,n)}async function simulateEchoCommand(e,t,r,n){if(e.includes(">")){const r=e.match(/>\s*(.+)$/);r&&t(`${ANSI_COLORS.yellow}已创建文件: ${r[1].trim()}${ANSI_COLORS.reset}\r\n`)}else{const r=e.match(/echo\s+["']([^"']+)["']/);r&&t(`${ANSI_COLORS.yellow}${r[1]}${ANSI_COLORS.reset}\r\n`)}await sleep(r,n)}async function simulateGenericCommand(e,t,r,n){const i=["命令执行成功","操作完成","已处理","✓ 完成","执行完毕"],o=i[Math.floor(Math.random()*i.length)];t(`${ANSI_COLORS.cyan}${o}${ANSI_COLORS.reset}\r\n`),await sleep(r,n)}function sleep(e,t){return new Promise((r,n)=>{if(null==t?void 0:t.aborted)return void n(new Error("Sleep aborted"));const i=setTimeout(r,e);if(t){const e=()=>{clearTimeout(i),n(new Error("Sleep aborted"))};t.addEventListener("abort",e,{once:!0})}})}const Xterm=React.forwardRef((e,t)=>{const{id:r,conn:n,path:i,returnMessage:o,runWeb:a,valiateReturn:s,nextReturn:l,initExec:c,containers:u,initCode:d}=e,{shellData:p,podData:h,ptyWsUrl:f}=React.useContext(KnowledgeCardContext),g=React.useRef(null),[m,v]=React.useState(null),[y,b]=React.useState(null),[q,V]=React.useState(null),[S,E]=React.useState(!1),[x,C]=React.useState(""),[w,R]=React.useState(!1),[A,T]=React.useState(!1),[k,N]=React.useState(!1),[P,O]=React.useState(!0),[F,_]=React.useState(""),[D,I]=React.useState(null==u?void 0:u[0]),[U,L]=React.useState(""),[B,W]=React.useState(!1),[M,j]=React.useState(!1),K=React.useRef(null),H=new index(e=>{Array.isArray(e)&&e.length&&(K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{null==q||q.fit()},60))});React.useEffect(()=>{(null==p?void 0:p.defaultShellContainer)&&I(null==p?void 0:p.defaultShellContainer)},[p]);const z=React.useRef(null);React.useEffect(()=>{var e,t;null==(e=z.current)||e.abort(),z.current=new AbortController,y&&m&&!M&&S&&d&&parseAndExecuteCommands(d,e=>{},{delay:200,showPrompt:!1,showComments:!1,simulateOutput:!1,onCommandStart:e=>{null==m||m.send(e.raw+"\r")},abortSignal:null==(t=z.current)?void 0:t.signal}).then(()=>{j(!0)})},[d,y,m,S]);const X=React.useRef(null),G=e=>{const t=new Uint8Array(e).buffer;return(new TextDecoder).decode(t)};React.useEffect(()=>{y&&m&&!k&&y.onKey(e=>{const t=e.key;""!==t?""===t&&y.hasSelection()&&navigator.clipboard.writeText(y.getSelection()):navigator.clipboard.readText().then(e=>{try{null==m||m.send(e)}catch(t){}})})},[y,m,k]);const Z=React.useRef(null);React.useEffect(()=>()=>{clearInterval(Z.current)},[]);const Y=React.useRef(null),Q=React.useRef(null),J=React.useRef(null),$=e=>{"disconnectWebSocket"===e.data.type?null==m||m.close(4999):"connectWebSocket"===e.data.type&&ee()},ee=e=>{if(!x)return;m&&1===(null==m?void 0:m.readyState)&&(null==m||m.close(4999));const t=new WebSocket(x);v(t),N(!1),t.onopen=()=>{var e;w&&F===i&&(null==y||y.write("\r\n")),P||null==y||y.write(""),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{E(!0),O(!0)},100),null==y||y.loadAddon(new xtermAddonAttachExports.AttachAddon(t)),Q.current&&clearTimeout(Q.current),Q.current=setTimeout(()=>{null==q||q.fit()},60),e=t,Z.current=setInterval(()=>{null==e||e.send("#ping#")},3e4)},t.onmessage=e=>{var t,r,n,i;if("#run#"!==G(e.data)&&"#run#"!==e.data||a&&a(x),"string"!=typeof e.data)return;const o=(null==(r=null==(t=null==e?void 0:e.data)?void 0:t.trim())?void 0:r.split("\n"))??(null==(i=null==(n=G(null==e?void 0:e.data))?void 0:n.trim())?void 0:i.split("\n"));1===o.length?"success"==e.data.split("\n")[0].trim()&&s?s(!0):"failure"==e.data.split("\n")[0].trim()&&s&&s(!1):2===o.length?"success"!=e.data.split("\n")[0].trim()&&"success"!=e.data.split("\n")[1].trim()||!s?"failure"!=e.data.split("\n")[0].trim()&&"failure"!=e.data.split("\n")[1].trim()||!s||s(!1):s(!0):3===o.length&&("success"!=e.data.split("\n")[0].trim()&&"success"!=e.data.split("\n")[1].trim()&&"success"!=e.data.split("\n")[2].trim()||!s?"failure"!=e.data.split("\n")[0].trim()&&"failure"!=e.data.split("\n")[1].trim()&&"failure"!=e.data.split("\n")[2].trim()||!s||s(!1):s(!0)),1===o.length?"nextYes"==e.data.split("\n")[0].trim()&&l?l(!0):"nextNo"==e.data.split("\n")[0].trim()&&l&&l(!1):2===o.length?"nextYes"!=e.data.split("\n")[0].trim()&&"nextYes"!=e.data.split("\n")[1].trim()||!l?"nextNo"!=e.data.split("\n")[0].trim()&&"nextNo"!=e.data.split("\n")[1].trim()||!l||l(!1):l(!0):3===o.length&&("nextYes"!=e.data.split("\n")[0].trim()&&"nextYes"!=e.data.split("\n")[1].trim()&&"nextYes"!=e.data.split("\n")[2].trim()||!l?"nextNo"!=e.data.split("\n")[0].trim()&&"nextNo"!=e.data.split("\n")[1].trim()&&"nextNo"!=e.data.split("\n")[2].trim()||!l||l(!1):l(!0))},t.onclose=e=>{C(""),E(!1),clearInterval(Z.current),e.code<3e3?1005===e.code||1011===e.code||4999===e.code||B||(J.current&&clearTimeout(J.current),J.current=setTimeout(()=>{N(!0)},1e3)):o&&o(JSON.parse(e.reason).message)}};React.useEffect(()=>(null==c||c(),window.addEventListener("message",$),()=>{K.current&&clearTimeout(K.current),X.current&&clearTimeout(X.current),Y.current&&clearTimeout(Y.current),Q.current&&clearTimeout(Q.current),J.current&&clearTimeout(J.current),te.current&&clearTimeout(te.current),re.current&&clearTimeout(re.current),ne.current&&clearTimeout(ne.current),ie.current&&clearTimeout(ie.current),oe.current&&clearTimeout(oe.current),ae.current&&clearTimeout(ae.current),le.current&&clearTimeout(le.current),window.removeEventListener("message",$)}),[]);const te=React.useRef(null);React.useEffect(()=>{if(S){T(!1);let e=document.getElementById(r);(null==e?void 0:e.style)&&(e.style.display="block")}else{T(!1);let e=document.getElementById(r);(null==e?void 0:e.style)&&!B&&(e.style.display="none"),te.current&&clearTimeout(te.current),te.current=setTimeout(()=>{T(!0)},5e3)}if(S)U&&m&&(null==m||m.send(U+"\r"),L(""));else{let e;x&&(e=new URL(x)),null==e||e.searchParams.get("tool")}},[S]),React.useEffect(()=>{x&&y&&P&&ee()},[y,x]),React.useEffect(()=>{},[x]);const re=React.useRef(null);React.useEffect(()=>{i&&F!==i&&(null==y||y.write(""),R(!0),re.current&&clearTimeout(re.current),re.current=setTimeout(()=>{_(i)},2e3))},[i]),React.useEffect(()=>{C(n),E(!1)},[n]);const ne=React.useRef(null);React.useEffect(()=>{const e=document.getElementById(r);if(null===y&&e)if(e.innerHTML="",(e=>{const t=new xtermExports.Terminal({cursorStyle:"underline",cursorBlink:!0}),r=new xtermAddonFitExports.FitAddon;t.loadAddon(r),t.loadAddon(new xtermAddonWebLinksExports.WebLinksAddon),t.onResize(()=>{}),t.onLineFeed((e,t)=>{}),t.onData((e,t)=>{}),t.open(e),null==t||t.focus(),X.current&&clearTimeout(X.current),X.current=setTimeout(()=>{r.fit()},60),b(t),V(r)})(e),S){T(!1);let e=document.getElementById(r);(null==e?void 0:e.style)&&(e.style.display="block")}else{T(!1);let e=document.getElementById(r);(null==e?void 0:e.style)&&(e.style.display="none"),ne.current&&clearTimeout(ne.current),ne.current=setTimeout(()=>{T(!0)},5e3)}return g.current&&H.observe(g.current),()=>{H.disconnect()}},[]),React.useEffect(()=>{k&&x&&ee()},[k,x]),React.useEffect(()=>()=>{1===(null==m?void 0:m.readyState)&&(null==m||m.close(4999))},[m]);const ie=React.useRef(null),oe=React.useRef(null);React.useEffect(()=>{const e=e=>{var t,r,n,i,o,a;"reconnent"===(null==(t=null==e?void 0:e.data)?void 0:t.type)&&((null==(n=null==(r=null==e?void 0:e.data)?void 0:r.value)?void 0:n.reCon)?(null==y||y.write(""),ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{var t,r;C(null==(r=null==(t=null==e?void 0:e.data)?void 0:t.value)?void 0:r.url),N(!0)},1e3)):(O(!1),C(""),N(!1),null==m||m.close(4999))),"envinfoHave"===(null==(i=null==e?void 0:e.data)?void 0:i.type)&&(S||((null==(a=null==(o=null==e?void 0:e.data)?void 0:o.value)?void 0:a.reconent)?(N(!0),oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{null==y||y.write("")},100)):N(!1)))};if(m&&y)return window.addEventListener("message",e),()=>{window.removeEventListener("message",e)}},[m,x,y,S]);const ae=React.useRef(null);React.useImperativeHandle(t,()=>({changeShellType:e=>{W(e)},execCode:e=>(S?null==m||m.send(e.trim()+"\r"):L(e),!0),changeConn:e=>{m&&e!==x&&(null==m||m.close(4999)),e&&C(e)},reconnent:(e,t)=>{e?(null==y||y.write(""),ae.current&&clearTimeout(ae.current),ae.current=setTimeout(()=>{C(t)},1e3)):(O(!1),C(""),N(!1),null==m||m.close(4999))},sendValiate:(e,t)=>{if(S){let r=t.trim()+" && echo 'success' || echo 'failure'\r",n=t.trim()+" && echo 'nextYes' || echo 'nextNo'\r";1===e?null==m||m.send(n):null==m||m.send(r)}},updateContainer:se}));const se=e=>{I(e);const t=`${f||"wss://pty.cloudlab.top"}/api/terminal?pod=${null==h?void 0:h.pod}&container=${(null==e?void 0:e.container)||""}`;m&&t!==x&&(null==m||m.close(4999)),t&&C(t)},le=React.useRef(null);React.useEffect(()=>{if(!y)return;const e=new MutationObserver(e=>{e.forEach(()=>{le.current&&clearTimeout(le.current),le.current=setTimeout(()=>{null==q||q.fit()},0)})}),t=document.querySelector(".xterm-screen");return t&&e.observe(t,{attributes:!0,childList:!0,subtree:!0}),()=>e.disconnect()},[y,q]);const ce=React.useRef(null);return jsxRuntimeExports.jsxs("div",{className:"xtermContainer",children:[u&&(null==u?void 0:u.length)>0&&jsxRuntimeExports.jsxs("div",{className:"containerMsg",children:[jsxRuntimeExports.jsx(Popover,{placement:"rightBottom",arrow:!1,content:jsxRuntimeExports.jsx(Menu,{rootClassName:"containerMenu",selectedKeys:[],items:u.map(e=>({key:e.container,label:e.container,onClick:()=>{I(e);const t=`${f||"wss://pty.cloudlab.top"}/api/terminal?pod=${null==h?void 0:h.pod}&container=${(null==e?void 0:e.container)||""}`;m&&t!==x&&(null==m||m.close(4999)),t&&C(t)}}))}),children:jsxRuntimeExports.jsx("div",{className:"containerChangeBtn",children:"容器切换"})}),jsxRuntimeExports.jsxs("div",{className:"currentContainer",children:["当前容器:",D.container]})]}),jsxRuntimeExports.jsx("div",{ref:g,id:r,className:"xterms terminal"}),!B&&!S&&jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:"43%",transform:"translate(-50%)",left:"50%",color:"white"},children:jsxRuntimeExports.jsxs("div",{className:"loading",children:[jsxRuntimeExports.jsxs("div",{className:"loading-line",style:{top:"-60px"},children:[jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{})]}),jsxRuntimeExports.jsx("div",{className:"loading-text",children:A?D?jsxRuntimeExports.jsx(Button$1,{onClick:()=>{const e=`${f||"wss://pty.cloudlab.top"}/api/terminal?pod=${null==h?void 0:h.pod}&container=${(null==D?void 0:D.container)||""}`;null==m||m.close(4999),ce.current&&clearTimeout(ce.current),ce.current=setTimeout(()=>{e&&C(e)},1e3)},children:"刷新"}):"环境已重置,建议关闭shell,重新打开~":"环境载入中……"})]})})]})}),ExShell=e=>{const{container:t,initCode:r}=e,{envStatus:n,shellData:i,podData:o}=React.useContext(KnowledgeCardContext),[a,s]=React.useState(!1),l=React.useRef(null);return React.useEffect(()=>{var e;if(n===EnvStatus.Running&&null!==i){if(s(!1),!t)return;const r=i.containers.find(e=>e.name===t);return void(r&&(null==(e=l.current)?void 0:e.updateContainer)&&l.current.updateContainer(r))}""===n?Modal.confirm({title:"温馨提示",content:"该示例需要启动环境,请先启动环境后再使用。",cancelText:"我知道了",okText:"启动环境",centered:!0,width:400,onOk(e){e(),s(!0),window.postMessage({type:"startupEnv"})}}):n===EnvStatus.Startuping?s(!0):i&&s(!1)},[i,n]),i&&o&&n===EnvStatus.Running?jsxRuntimeExports.jsx(Xterm,{ref:l,id:"shellView",conn:i.conn,path:i.path,containers:i.containers,initCode:r}):jsxRuntimeExports.jsx(Spin,{spinning:a,fullscreen:!0,tip:"环境启动中..."})};var ToolType=(e=>(e.Runner="runner",e.Shell="shell",e))(ToolType||{});const ExampleTools=React.memo(e=>{const{tool:t,CodePlayerProps:r,container:n,initCode:i,saveCode:o}=e;return React.useMemo(()=>({runner:jsxRuntimeExports.jsx(ExCodePlayer,{codePlayerData:null==r?void 0:r.codePlayerData,codePlayerRef:null==r?void 0:r.codePlayerRef,saveCode:o}),shell:jsxRuntimeExports.jsx(ExShell,{container:n,initCode:i})}),[r,n])[t]},(e,t)=>{var r,n;return JSON.stringify(null==(r=e.CodePlayerProps)?void 0:r.codePlayerData)===JSON.stringify(null==(n=t.CodePlayerProps)?void 0:n.codePlayerData)&&e.tool===t.tool&&e.container===t.container}),ExampleCard=React.memo(e=>{const{title:t,code:r,execTool:n,lang:i,content:o,saveCode:a,container:s,dataId:l}=e;return jsxRuntimeExports.jsx("div",{className:"exampleContainer",children:jsxRuntimeExports.jsxs(Card,{className:"card",children:[t&&jsxRuntimeExports.jsx("div",{className:"header",children:jsxRuntimeExports.jsx("div",{className:"titleSection",children:jsxRuntimeExports.jsx("h1",{className:"title",children:t})})}),jsxRuntimeExports.jsx("div",{className:"codeTool",children:jsxRuntimeExports.jsx(ExampleTools,{CodePlayerProps:"runner"!==n&&n?null:{codePlayerData:{lang:i||"python",code:r||"",topic:t||"",content:o||"",dataId:l}},tool:n||ToolType.Runner,container:s,initCode:r||"",saveCode:a})})]})})});var __assign=function(){return __assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},__assign.apply(this,arguments)};function __spreadArray(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function memoize(e){var t=Object.create(null);return function(r){return void 0===t[r]&&(t[r]=e(r)),t[r]}}"function"==typeof SuppressedError&&SuppressedError;var reactPropsRegex=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|disableRemotePlayback|download|draggable|encType|enterKeyHint|fetchpriority|fetchPriority|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|popover|popoverTarget|popoverTargetAction|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,isPropValid=memoize(function(e){return reactPropsRegex.test(e)||111===e.charCodeAt(0)&&110===e.charCodeAt(1)&&e.charCodeAt(2)<91}),unitlessKeys={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},a="undefined"!=typeof process&&void 0!==process.env&&(process.env.REACT_APP_SC_ATTR||process.env.SC_ATTR)||"data-styled",c$2="active",u="data-styled-version",l="6.3.6",d$2="/*!sc*/\n",p="undefined"!=typeof window&&"undefined"!=typeof document,h$1=void 0===React.createContext,f=Boolean("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==process.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==process.env.REACT_APP_SC_DISABLE_SPEEDY&&process.env.REACT_APP_SC_DISABLE_SPEEDY:"undefined"!=typeof process&&void 0!==process.env&&void 0!==process.env.SC_DISABLE_SPEEDY&&""!==process.env.SC_DISABLE_SPEEDY?"false"!==process.env.SC_DISABLE_SPEEDY&&process.env.SC_DISABLE_SPEEDY:"production"!==process.env.NODE_ENV),y=/invalid hook call/i,v$2=new Set,g=function(e,t){if("production"!==process.env.NODE_ENV){if(h$1)return;var r=t?' with the id of "'.concat(t,'"'):"",n="The component ".concat(e).concat(r," has been created dynamically.\n")+"You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.\nSee https://styled-components.com/docs/basics#define-styled-components-outside-of-the-render-method for more info.\n",i=console.error;try{var o=!0;console.error=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];y.test(e)?(o=!1,v$2.delete(n)):i.apply(void 0,__spreadArray([e],t,!1))},"function"==typeof React.useState&&React.useState(null),o&&!v$2.has(n)&&v$2.add(n)}catch(e10){y.test(e10.message)&&v$2.delete(n)}finally{console.error=i}}},S=Object.freeze([]),w=Object.freeze({});function b(e,t,r){return void 0===r&&(r=w),e.theme!==r.theme&&e.theme||t||r.theme}var C=new Set(["a","abbr","address","area","article","aside","audio","b","bdi","bdo","blockquote","body","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","slot","small","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tspan","use"]),E=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,N=/(^-|-$)/g;function A(e){return e.replace(E,"-").replace(N,"")}var P=/(a)(d)/gi,_=function(e){return String.fromCharCode(e+(e>25?39:97))};function I(e){var t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=_(t%52)+r;return(_(t%52)+r).replace(P,"$1-$2")}var O,D=function(e,t){for(var r=t.length;r;)e=33*e^t.charCodeAt(--r);return e},T=function(e){return D(5381,e)};function x(e){return I(T(e)>>>0)}function R(e){return"production"!==process.env.NODE_ENV&&"string"==typeof e&&e||e.displayName||e.name||"Component"}function j$2(e){return"string"==typeof e&&("production"===process.env.NODE_ENV||e.charAt(0)===e.charAt(0).toLowerCase())}var k="function"==typeof Symbol&&Symbol.for,M=k?Symbol.for("react.memo"):60115,V=k?Symbol.for("react.forward_ref"):60112,F={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},L={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},B={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},G=((O={})[V]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},O[M]=B,O);function z(e){return("type"in(t=e)&&t.type.$$typeof)===M?B:"$$typeof"in e?G[e.$$typeof]:F;var t}var $$1=Object.defineProperty,Y=Object.getOwnPropertyNames,W=Object.getOwnPropertySymbols,q$2=Object.getOwnPropertyDescriptor,H=Object.getPrototypeOf,U=Object.prototype;function J(e,t,r){if("string"!=typeof t){if(U){var n=H(t);n&&n!==U&&J(e,n,r)}var i=Y(t);W&&(i=i.concat(W(t)));for(var o=z(e),a=z(t),s=0;s<i.length;++s){var l=i[s];if(!(l in L||r&&r[l]||a&&l in a||o&&l in o)){var c=q$2(t,l);try{$$1(e,l,c)}catch(u){}}}}return e}function X(e){return"function"==typeof e}function Z(e){return"object"==typeof e&&"styledComponentId"in e}function K(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Q(e,t){if(0===e.length)return"";for(var r=e[0],n=1;n<e.length;n++)r+=e[n];return r}function ee(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function te(e,t,r){if(void 0===r&&(r=!1),!r&&!ee(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var n=0;n<t.length;n++)e[n]=te(e[n],t[n]);else if(ee(t))for(var n in t)e[n]=te(e[n],t[n]);return e}function ne(e,t){Object.defineProperty(e,"toString",{value:t})}var oe="production"!==process.env.NODE_ENV?{1:"Cannot create styled-component for component: %s.\n\n",2:"Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n",3:"Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n",4:"The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n",5:"The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n",6:"Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n",7:'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n',8:'ThemeProvider: Please make your "theme" prop an object.\n\n',9:"Missing document `<head>`\n\n",10:"Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n",11:"_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n",12:"It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n",13:"%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n",14:'ThemeProvider: "theme" prop is required.\n\n',15:"A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n",16:"Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n",17:"CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n",18:"ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`"}:{};function re(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=e[0],n=[],i=1,o=e.length;i<o;i+=1)n.push(e[i]);return n.forEach(function(e){r=r.replace(/%[a-z]/,e)}),r}function se(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return"production"===process.env.NODE_ENV?new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):"")):new Error(re.apply(void 0,__spreadArray([oe[e]],t,!1)).trim())}var ie=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,r=0;r<e;r++)t+=this.groupSizes[r];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var r=this.groupSizes,n=r.length,i=n;e>=i;)if((i<<=1)<0)throw se(16,"".concat(e));this.groupSizes=new Uint32Array(i),this.groupSizes.set(r),this.length=i;for(var o=n;o<i;o++)this.groupSizes[o]=0}for(var a=this.indexOfGroup(e+1),s=(o=0,t.length);o<s;o++)this.tag.insertRule(a,t[o])&&(this.groupSizes[e]++,a++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],r=this.indexOfGroup(e),n=r+t;this.groupSizes[e]=0;for(var i=r;i<n;i++)this.tag.deleteRule(r)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var r=this.groupSizes[e],n=this.indexOfGroup(e),i=n+r,o=n;o<i;o++)t+="".concat(this.tag.getRule(o)).concat(d$2);return t},e}(),ae=1<<30,ce=new Map,ue=new Map,le=1,de=function(e){if(ce.has(e))return ce.get(e);for(;ue.has(le);)le++;var t=le++;if("production"!==process.env.NODE_ENV&&((0|t)<0||t>ae))throw se(16,"".concat(t));return ce.set(e,t),ue.set(t,e),t},pe=function(e,t){le=t+1,ce.set(e,t),ue.set(t,e)},he="style[".concat(a,"][").concat(u,'="').concat(l,'"]'),fe=new RegExp("^".concat(a,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),me=function(e,t,r){for(var n,i=r.split(","),o=0,a=i.length;o<a;o++)(n=i[o])&&e.registerName(t,n)},ye=function(e,t){for(var r,n=(null!==(r=t.textContent)&&void 0!==r?r:"").split(d$2),i=[],o=0,a=n.length;o<a;o++){var s=n[o].trim();if(s){var l=s.match(fe);if(l){var c=0|parseInt(l[1],10),u=l[2];0!==c&&(pe(u,c),me(e,u,l[3]),e.getTag().insertRules(c,i)),i.length=0}else i.push(s)}}},ve=function(e){for(var t=document.querySelectorAll(he),r=0,n=t.length;r<n;r++){var i=t[r];i&&i.getAttribute(a)!==c$2&&(ye(e,i),i.parentNode&&i.parentNode.removeChild(i))}};function ge(){return"undefined"!=typeof __webpack_nonce__?__webpack_nonce__:null}var Se=function(e){var t,r,n=document.head,i=e||n,o=document.createElement("style"),s=(t=i,(r=Array.from(t.querySelectorAll("style[".concat(a,"]"))))[r.length-1]),c=void 0!==s?s.nextSibling:null;o.setAttribute(a,c$2),o.setAttribute(u,l);var d=ge();return d&&o.setAttribute("nonce",d),i.insertBefore(o,c),o},we=function(){function e(e){this.element=Se(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,r=0,n=t.length;r<n;r++){var i=t[r];if(i.ownerNode===e)return i}throw se(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(r){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),be=function(){function e(e){this.element=Se(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var r=document.createTextNode(t);return this.element.insertBefore(r,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),Ce=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),Ee=p,Ne={isServer:!p,useCSSOMInjection:!f},Ae=function(){function e(e,t,r){void 0===e&&(e=w),void 0===t&&(t={});var n=this;this.options=__assign(__assign({},Ne),e),this.gs=t,this.names=new Map(r),this.server=!!e.isServer,!this.server&&p&&Ee&&(Ee=!1,ve(this)),ne(this,function(){return function(e){for(var t=e.getTag(),r=t.length,n="",i=function(r){var i,o=(i=r,ue.get(i));if(void 0===o)return"continue";var s=e.names.get(o),l=t.getGroup(r);if(void 0===s||!s.size||0===l.length)return"continue";var c="".concat(a,".g").concat(r,'[id="').concat(o,'"]'),u="";void 0!==s&&s.forEach(function(e){e.length>0&&(u+="".concat(e,","))}),n+="".concat(l).concat(c,'{content:"').concat(u,'"}').concat(d$2)},o=0;o<r;o++)i(o);return n}(n)})}return e.registerId=function(e){return de(e)},e.prototype.rehydrate=function(){!this.server&&p&&ve(this)},e.prototype.reconstructWithOptions=function(t,r){return void 0===r&&(r=!0),new e(__assign(__assign({},this.options),t),this.gs,r&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(e=function(e){var t=e.useCSSOMInjection,r=e.target;return e.isServer?new Ce(r):t?new we(r):new be(r)}(this.options),new ie(e)));var e},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(de(e),this.names.has(e))this.names.get(e).add(t);else{var r=new Set;r.add(t),this.names.set(e,r)}},e.prototype.insertRules=function(e,t,r){this.registerName(e,t),this.getTag().insertRules(de(e),r)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(de(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),Pe=/&/g,_e=47;function Ie(e){if(-1===e.indexOf("}"))return!1;for(var t=e.length,r=0,n=0,i=!1,o=0;o<t;o++){var a=e.charCodeAt(o);if(0!==n||i||a!==_e||42!==e.charCodeAt(o+1))if(i)42===a&&e.charCodeAt(o+1)===_e&&(i=!1,o++);else if(34!==a&&39!==a||0!==o&&92===e.charCodeAt(o-1)){if(0===n)if(123===a)r++;else if(125===a&&--r<0)return!0}else 0===n?n=a:n===a&&(n=0);else i=!0,o++}return 0!==r||0!==n}function Oe(e,t){return e.map(function(e){return"rule"===e.type&&(e.value="".concat(t," ").concat(e.value),e.value=e.value.replaceAll(",",",".concat(t," ")),e.props=e.props.map(function(e){return"".concat(t," ").concat(e)})),Array.isArray(e.children)&&"@keyframes"!==e.type&&(e.children=Oe(e.children,t)),e})}function De(e){var t,r,n,i=w,o=i.options,a=void 0===o?w:o,s=i.plugins,l=void 0===s?S:s,c=function(e,n,i){return i.startsWith(r)&&i.endsWith(r)&&i.replaceAll(r,"").length>0?".".concat(t):e},u=l.slice();u.push(function(e){e.type===RULESET&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(Pe,r).replace(n,c))}),a.prefix&&u.push(prefixer),u.push(stringify$7);var d=function(e,i,o,s){void 0===i&&(i=""),void 0===o&&(o=""),void 0===s&&(s="&"),t=s,r=i,n=new RegExp("\\".concat(r,"\\b"),"g");var l=function(e){if(!Ie(e))return e;for(var t=e.length,r="",n=0,i=0,o=0,a=!1,s=0;s<t;s++){var l=e.charCodeAt(s);if(0!==o||a||l!==_e||42!==e.charCodeAt(s+1))if(a)42===l&&e.charCodeAt(s+1)===_e&&(a=!1,s++);else if(34!==l&&39!==l||0!==s&&92===e.charCodeAt(s-1)){if(0===o)if(123===l)i++;else if(125===l){if(--i<0){for(var c=s+1;c<t;){var u=e.charCodeAt(c);if(59===u||10===u)break;c++}c<t&&59===e.charCodeAt(c)&&c++,i=0,s=c-1,n=c;continue}0===i&&(r+=e.substring(n,s+1),n=s+1)}else 59===l&&0===i&&(r+=e.substring(n,s+1),n=s+1)}else 0===o?o=l:o===l&&(o=0);else a=!0,s++}if(n<t){var d=e.substring(n);Ie(d)||(r+=d)}return r}(function(e){if(-1===e.indexOf("//"))return e;for(var t=e.length,r=[],n=0,i=0,o=0,a=0;i<t;){var s=e.charCodeAt(i);if(34!==s&&39!==s||0!==i&&92===e.charCodeAt(i-1))if(0===o)if(40===s&&i>=3&&108==(32|e.charCodeAt(i-1))&&114==(32|e.charCodeAt(i-2))&&117==(32|e.charCodeAt(i-3)))a=1,i++;else if(a>0)41===s?a--:40===s&&a++,i++;else if(s===_e&&i+1<t&&e.charCodeAt(i+1)===_e){for(i>n&&r.push(e.substring(n,i));i<t&&10!==e.charCodeAt(i);)i++;n=i}else i++;else i++;else 0===o?o=s:o===s&&(o=0),i++}return 0===n?e:(n<t&&r.push(e.substring(n)),r.join(""))}(e)),c=compile(o||i?"".concat(o," ").concat(i," { ").concat(l," }"):l);a.namespace&&(c=Oe(c,a.namespace));var d=[];return serialize$1(c,middleware(u.concat(rulesheet(function(e){return d.push(e)})))),d};return d.hash=l.length?l.reduce(function(e,t){return t.name||se(15),D(e,t.name)},5381).toString():"",d}var Te=new Ae,xe=De(),Re={shouldForwardProp:void 0,styleSheet:Te,stylis:xe},je=h$1?{Provider:function(e){return e.children},Consumer:function(e){return(0,e.children)(Re)}}:React.createContext(Re);function Ve(){return!h$1&&React.useContext?React.useContext(je):Re}je.Consumer,h$1||React.createContext(void 0);var Le=function(){function e(e,t){var r=this;this.inject=function(e,t){void 0===t&&(t=xe);var n=r.name+t.hash;e.hasNameForId(r.id,n)||e.insertRules(r.id,n,t(r.rules,n,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,ne(this,function(){throw se(12,String(r.name))})}return e.prototype.getName=function(e){return void 0===e&&(e=xe),this.name+e.hash},e}();function Be(e,t){return null==t||"boolean"==typeof t||""===t?"":"number"!=typeof t||0===t||e in unitlessKeys||e.startsWith("--")?String(t).trim():"".concat(t,"px")}var Ge=function(e){return e>="A"&&e<="Z"};function ze(e){for(var t="",r=0;r<e.length;r++){var n=e[r];if(1===r&&"-"===n&&"-"===e[0])return e;Ge(n)?t+="-"+n.toLowerCase():t+=n}return t.startsWith("ms-")?"-"+t:t}var $e=function(e){return null==e||!1===e||""===e},Ye=function(e){var t=[];for(var r in e){var n=e[r];e.hasOwnProperty(r)&&!$e(n)&&(Array.isArray(n)&&n.isCss||X(n)?t.push("".concat(ze(r),":"),n,";"):ee(n)?t.push.apply(t,__spreadArray(__spreadArray(["".concat(r," {")],Ye(n),!1),["}"],!1)):t.push("".concat(ze(r),": ").concat(Be(r,n),";")))}return t};function We(e,t,r,n){if($e(e))return[];if(Z(e))return[".".concat(e.styledComponentId)];if(X(e)){if(!X(o=e)||o.prototype&&o.prototype.isReactComponent||!t)return[e];var i=e(t);return"production"===process.env.NODE_ENV||"object"!=typeof i||Array.isArray(i)||i instanceof Le||ee(i),We(i,t,r,n)}var o;return e instanceof Le?r?(e.inject(r,n),[e.getName(n)]):[e]:ee(e)?Ye(e):Array.isArray(e)?Array.prototype.concat.apply(S,e.map(function(e){return We(e,t,r,n)})):[e.toString()]}function qe(e){for(var t=0;t<e.length;t+=1){var r=e[t];if(X(r)&&!Z(r))return!1}return!0}var He=T(l),Ue=function(){function e(e,t,r){this.rules=e,this.staticRulesId="",this.isStatic="production"===process.env.NODE_ENV&&(void 0===r||r.isStatic)&&qe(e),this.componentId=t,this.baseHash=D(He,t),this.baseStyle=r,Ae.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,r){var n=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,r).className:"";if(this.isStatic&&!r.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))n=K(n,this.staticRulesId);else{var i=Q(We(this.rules,e,t,r)),o=I(D(this.baseHash,i)>>>0);if(!t.hasNameForId(this.componentId,o)){var a=r(i,".".concat(o),void 0,this.componentId);t.insertRules(this.componentId,o,a)}n=K(n,o),this.staticRulesId=o}else{for(var s=D(this.baseHash,r.hash),l="",c=0;c<this.rules.length;c++){var u=this.rules[c];if("string"==typeof u)l+=u,"production"!==process.env.NODE_ENV&&(s=D(s,u));else if(u){var d=Q(We(u,e,t,r));s=D(s,d+c),l+=d}}if(l){var p=I(s>>>0);if(!t.hasNameForId(this.componentId,p)){var h=r(l,".".concat(p),void 0,this.componentId);t.insertRules(this.componentId,p,h)}n=K(n,p)}}return{className:n,css:"undefined"==typeof window?t.getTag().getGroup(de(this.componentId)):""}},e}(),Je=h$1?{Provider:function(e){return e.children},Consumer:function(e){return(0,e.children)(void 0)}}:React.createContext(void 0);Je.Consumer;var Qe={},et=new Set;function tt(e,t,r){var n,i=Z(e),o=e,a=!j$2(e),s=t.attrs,c=void 0===s?S:s,u=t.componentId,d=void 0===u?function(e,t){var r="string"!=typeof e?"sc":A(e);Qe[r]=(Qe[r]||0)+1;var n="".concat(r,"-").concat(x(l+r+Qe[r]));return t?"".concat(t,"-").concat(n):n}(t.displayName,t.parentComponentId):u,p=t.displayName,h=void 0===p?j$2(n=e)?"styled.".concat(n):"Styled(".concat(R(n),")"):p,f=t.displayName&&t.componentId?"".concat(A(t.displayName),"-").concat(t.componentId):t.componentId||d,m=i&&o.attrs?o.attrs.concat(c).filter(Boolean):c,v=t.shouldForwardProp;if(i&&o.shouldForwardProp){var y=o.shouldForwardProp;if(t.shouldForwardProp){var q=t.shouldForwardProp;v=function(e,t){return y(e,t)&&q(e,t)}}else v=y}var V=new Ue(r,f,i?o.componentStyle:void 0);function E(e,t){return function(e,t,r){var n=e.attrs,i=e.componentStyle,o=e.defaultProps,a=e.foldedComponentIds,s=e.styledComponentId,l=e.target,c=React.useContext?React.useContext(Je):void 0,u=Ve(),d=e.shouldForwardProp||u.shouldForwardProp;"production"!==process.env.NODE_ENV&&React.useDebugValue&&React.useDebugValue(s);var p=b(t,c,o)||w,h=function(e,t,r){for(var n,i=__assign(__assign({},t),{className:void 0,theme:r}),o=0;o<e.length;o+=1){var a=X(n=e[o])?n(i):n;for(var s in a)"className"===s?i.className=K(i.className,a[s]):"style"===s?i.style=__assign(__assign({},i.style),a[s]):i[s]=a[s]}return"className"in t&&"string"==typeof t.className&&(i.className=K(i.className,t.className)),i}(n,t,p),f=h.as||l,g={};for(var m in h)void 0===h[m]||"$"===m[0]||"as"===m||"theme"===m&&h.theme===p||("forwardedAs"===m?g.as=h.forwardedAs:d&&!d(m,f)||(g[m]=h[m],d||"development"!==process.env.NODE_ENV||isPropValid(m)||et.has(m)||!C.has(f)||et.add(m)));var v=function(e,t){var r=Ve(),n=e.generateAndInjectStyles(t,r.styleSheet,r.stylis);return"production"!==process.env.NODE_ENV&&React.useDebugValue&&React.useDebugValue(n.className),n}(i,h),y=v.className,q=v.css;"production"!==process.env.NODE_ENV&&e.warnTooManyClasses&&e.warnTooManyClasses(y);var V=K(a,s);y&&(V+=" "+y),h.className&&(V+=" "+h.className),g[j$2(f)&&!C.has(f)?"class":"className"]=V,r&&(g.ref=r);var S=React.createElement(f,g);return h$1&&q?React.createElement(React.Fragment,null,React.createElement("style",{precedence:"styled-components",href:"sc-".concat(s,"-").concat(y),children:q}),S):S}(T,e,t)}E.displayName=h;var T=React.forwardRef(E);return T.attrs=m,T.componentStyle=V,T.displayName=h,T.shouldForwardProp=v,T.foldedComponentIds=i?K(o.foldedComponentIds,o.styledComponentId):"",T.styledComponentId=f,T.target=i?o.target:e,Object.defineProperty(T,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(e){this._foldedDefaultProps=i?function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var n=0,i=t;n<i.length;n++)te(e,i[n],!0);return e}({},o.defaultProps,e):e}}),"production"!==process.env.NODE_ENV&&(g(h,f),T.warnTooManyClasses=function(e,t){var r={},n=!1;return function(e){if(!n&&(r[e]=!0,Object.keys(r).length>=200)){t&&' with the id of "'.concat(t,'"');n=!0,r={}}}}(0,f)),ne(T,function(){return".".concat(T.styledComponentId)}),a&&J(T,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),T}function nt(e,t){for(var r=[e[0]],n=0,i=t.length;n<i;n+=1)r.push(t[n],e[n+1]);return r}var ot=function(e){return Object.assign(e,{isCss:!0})};function rt(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(X(e)||ee(e))return ot(We(nt(S,__spreadArray([e],t,!0))));var n=e;return 0===t.length&&1===n.length&&"string"==typeof n[0]?We(n):ot(We(nt(n,t)))}function st(e,t,r){if(void 0===r&&(r=w),!t)throw se(1,t);var n=function(n){for(var i=[],o=1;o<arguments.length;o++)i[o-1]=arguments[o];return e(t,r,rt.apply(void 0,__spreadArray([n],i,!1)))};return n.attrs=function(n){return st(e,t,__assign(__assign({},r),{attrs:Array.prototype.concat(r.attrs,n).filter(Boolean)}))},n.withConfig=function(n){return st(e,t,__assign(__assign({},r),n))},n}var it=function(e){return st(tt,e)},at=it;function dt(e){var t=React.forwardRef(function(t,r){var n=b(t,React.useContext?React.useContext(Je):void 0,e.defaultProps);return process.env.NODE_ENV,React.createElement(e,__assign(__assign({},t),{theme:n,ref:r}))});return t.displayName="WithTheme(".concat(R(e),")"),J(t,e)}C.forEach(function(e){at[e]=it(e)}),"production"!==process.env.NODE_ENV&&"undefined"!=typeof navigator&&navigator.product;var ft="__sc-".concat(a,"__");function ownKeys$1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _objectSpread$1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys$1(Object(r),!0).forEach(function(t){_defineProperty$1(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys$1(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function powerSetPermutations(e){var t=e.length;return 0===t||1===t?e:2===t?[e[0],e[1],"".concat(e[0],".").concat(e[1]),"".concat(e[1],".").concat(e[0])]:3===t?[e[0],e[1],e[2],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0])]:t>=4?[e[0],e[1],e[2],e[3],"".concat(e[0],".").concat(e[1]),"".concat(e[0],".").concat(e[2]),"".concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[0]),"".concat(e[1],".").concat(e[2]),"".concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[1]),"".concat(e[2],".").concat(e[3]),"".concat(e[3],".").concat(e[0]),"".concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[0]),"".concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[0],".").concat(e[1],".").concat(e[2],".").concat(e[3]),"".concat(e[0],".").concat(e[1],".").concat(e[3],".").concat(e[2]),"".concat(e[0],".").concat(e[2],".").concat(e[1],".").concat(e[3]),"".concat(e[0],".").concat(e[2],".").concat(e[3],".").concat(e[1]),"".concat(e[0],".").concat(e[3],".").concat(e[1],".").concat(e[2]),"".concat(e[0],".").concat(e[3],".").concat(e[2],".").concat(e[1]),"".concat(e[1],".").concat(e[0],".").concat(e[2],".").concat(e[3]),"".concat(e[1],".").concat(e[0],".").concat(e[3],".").concat(e[2]),"".concat(e[1],".").concat(e[2],".").concat(e[0],".").concat(e[3]),"".concat(e[1],".").concat(e[2],".").concat(e[3],".").concat(e[0]),"".concat(e[1],".").concat(e[3],".").concat(e[0],".").concat(e[2]),"".concat(e[1],".").concat(e[3],".").concat(e[2],".").concat(e[0]),"".concat(e[2],".").concat(e[0],".").concat(e[1],".").concat(e[3]),"".concat(e[2],".").concat(e[0],".").concat(e[3],".").concat(e[1]),"".concat(e[2],".").concat(e[1],".").concat(e[0],".").concat(e[3]),"".concat(e[2],".").concat(e[1],".").concat(e[3],".").concat(e[0]),"".concat(e[2],".").concat(e[3],".").concat(e[0],".").concat(e[1]),"".concat(e[2],".").concat(e[3],".").concat(e[1],".").concat(e[0]),"".concat(e[3],".").concat(e[0],".").concat(e[1],".").concat(e[2]),"".concat(e[3],".").concat(e[0],".").concat(e[2],".").concat(e[1]),"".concat(e[3],".").concat(e[1],".").concat(e[0],".").concat(e[2]),"".concat(e[3],".").concat(e[1],".").concat(e[2],".").concat(e[0]),"".concat(e[3],".").concat(e[2],".").concat(e[0],".").concat(e[1]),"".concat(e[3],".").concat(e[2],".").concat(e[1],".").concat(e[0])]:void 0}"production"!==process.env.NODE_ENV&&"test"!==process.env.NODE_ENV&&"undefined"!=typeof window&&(window[ft]||(window[ft]=0),window[ft],window[ft]+=1);var classNameCombinations={};function getClassNameCombinations(e){if(0===e.length||1===e.length)return e;var t=e.join(".");return classNameCombinations[t]||(classNameCombinations[t]=powerSetPermutations(e)),classNameCombinations[t]}function createStyleObject(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;return getClassNameCombinations(e.filter(function(e){return"token"!==e})).reduce(function(e,t){return _objectSpread$1(_objectSpread$1({},e),r[t])},t)}function createClassNameString(e){return e.join(" ")}function createChildren(e,t){var r=0;return function(n){return r+=1,n.map(function(n,i){return createElement({node:n,stylesheet:e,useInlineStyles:t,key:"code-segment-".concat(r,"-").concat(i)})})}}function createElement(e){var t=e.node,r=e.stylesheet,n=e.style,i=void 0===n?{}:n,o=e.useInlineStyles,a=e.key,s=t.properties,l=t.type,c=t.tagName,u=t.value;if("text"===l)return u;if(c){var d,p=createChildren(r,o);if(o){var h=Object.keys(r).reduce(function(e,t){return t.split(".").forEach(function(t){e.includes(t)||e.push(t)}),e},[]),f=s.className&&s.className.includes("token")?["token"]:[],g=s.className&&f.concat(s.className.filter(function(e){return!h.includes(e)}));d=_objectSpread$1(_objectSpread$1({},s),{},{className:createClassNameString(g)||void 0,style:createStyleObject(s.className,Object.assign({},s.style,i),r)})}else d=_objectSpread$1(_objectSpread$1({},s),{},{className:createClassNameString(s.className)});var m=p(t.children);return React.createElement(c,_extends$Z({key:a},d),m)}}const checkForListedLanguage=function(e,t){return-1!==e.listLanguages().indexOf(t)};var _excluded=["language","children","style","customStyle","codeTagProps","useInlineStyles","showLineNumbers","showInlineLineNumbers","startingLineNumber","lineNumberContainerStyle","lineNumberStyle","wrapLines","wrapLongLines","lineProps","renderer","PreTag","CodeTag","code","astGenerator"];function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach(function(t){_defineProperty$1(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var newLineRegex=/\n/g;function getNewLines(e){return e.match(newLineRegex)}function getAllLineNumbers(e){var t=e.lines,r=e.startingLineNumber,n=e.style;return t.map(function(e,t){var i=t+r;return React.createElement("span",{key:"line-".concat(t),className:"react-syntax-highlighter-line-number",style:"function"==typeof n?n(i):n},"".concat(i,"\n"))})}function AllLineNumbers(e){var t=e.codeString,r=e.codeStyle,n=e.containerStyle,i=void 0===n?{float:"left",paddingRight:"10px"}:n,o=e.numberStyle,a=void 0===o?{}:o,s=e.startingLineNumber;return React.createElement("code",{style:Object.assign({},r,i)},getAllLineNumbers({lines:t.replace(/\n$/,"").split("\n"),style:a,startingLineNumber:s}))}function getEmWidthOfNumber(e){return"".concat(e.toString().length,".25em")}function getInlineLineNumber(e,t){return{type:"element",tagName:"span",properties:{key:"line-number--".concat(e),className:["comment","linenumber","react-syntax-highlighter-line-number"],style:t},children:[{type:"text",value:e}]}}function assembleLineNumberStyles(e,t,r){var n={display:"inline-block",minWidth:getEmWidthOfNumber(r),paddingRight:"1em",textAlign:"right",userSelect:"none"},i="function"==typeof e?e(t):e;return _objectSpread(_objectSpread({},n),i)}function createLineElement(e){var t=e.children,r=e.lineNumber,n=e.lineNumberStyle,i=e.largestLineNumber,o=e.showInlineLineNumbers,a=e.lineProps,s=void 0===a?{}:a,l=e.className,c=void 0===l?[]:l,u=e.showLineNumbers,d=e.wrapLongLines,p=e.wrapLines,h=void 0!==p&&p?_objectSpread({},"function"==typeof s?s(r):s):{};if(h.className=h.className?[].concat(_toConsumableArray(h.className.trim().split(/\s+/)),_toConsumableArray(c)):c,r&&o){var f=assembleLineNumberStyles(n,r,i);t.unshift(getInlineLineNumber(r,f))}return d&u&&(h.style=_objectSpread({display:"flex"},h.style)),{type:"element",tagName:"span",properties:h,children:t}}function flattenCodeTree(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=0;n<e.length;n++){var i=e[n];if("text"===i.type)r.push(createLineElement({children:[i],className:_toConsumableArray(new Set(t))}));else if(i.children){var o=t.concat(i.properties.className);flattenCodeTree(i.children,o).forEach(function(e){return r.push(e)})}}return r}function processLines(e,t,r,n,i,o,a,s,l){var c,u=flattenCodeTree(e.value),d=[],p=-1,h=0;function f(e,o){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return t||c.length>0?function(e,o){return createLineElement({children:e,lineNumber:o,lineNumberStyle:s,largestLineNumber:a,showInlineLineNumbers:i,lineProps:r,className:arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],showLineNumbers:n,wrapLongLines:l,wrapLines:t})}(e,o,c):function(e,t){if(n&&t&&i){var r=assembleLineNumberStyles(s,t,a);e.unshift(getInlineLineNumber(t,r))}return e}(e,o)}for(var g=function(){var e=u[h],t=e.children[0].value;if(getNewLines(t)){var r=t.split("\n");r.forEach(function(t,i){var a=n&&d.length+o,s={type:"text",value:"".concat(t,"\n")};if(0===i){var l=f(u.slice(p+1,h).concat(createLineElement({children:[s],className:e.properties.className})),a);d.push(l)}else if(i===r.length-1){var c=u[h+1]&&u[h+1].children&&u[h+1].children[0],g={type:"text",value:"".concat(t)};if(c){var m=createLineElement({children:[g],className:e.properties.className});u.splice(h+1,0,m)}else{var v=f([g],a,e.properties.className);d.push(v)}}else{var y=f([s],a,e.properties.className);d.push(y)}}),p=h}h++};h<u.length;)g();if(p!==u.length-1){var m=u.slice(p+1,u.length);if(m&&m.length){var v=f(m,n&&d.length+o);d.push(v)}}return t?d:(c=[]).concat.apply(c,d)}function defaultRenderer(e){var t=e.rows,r=e.stylesheet,n=e.useInlineStyles;return t.map(function(e,t){return createElement({node:e,stylesheet:r,useInlineStyles:n,key:"code-segment-".concat(t)})})}function isHighlightJs(e){return e&&void 0!==e.highlightAuto}function getCodeTree(e){var t=e.astGenerator,r=e.language,n=e.code,i=e.defaultCodeValue;if(isHighlightJs(t)){var o=checkForListedLanguage(t,r);return"text"===r?{value:i,language:"text"}:o?t.highlight(r,n):t.highlightAuto(n)}try{return r&&"text"!==r?{value:t.highlight(n,r)}:{value:i}}catch(e10){return{value:i}}}function highlight$1(e,t){return function(r){var n,i,o=r.language,a=r.children,s=r.style,l=void 0===s?t:s,c=r.customStyle,u=void 0===c?{}:c,d=r.codeTagProps,p=void 0===d?{className:o?"language-".concat(o):void 0,style:_objectSpread(_objectSpread({},l['code[class*="language-"]']),l['code[class*="language-'.concat(o,'"]')])}:d,h=r.useInlineStyles,f=void 0===h||h,g=r.showLineNumbers,m=void 0!==g&&g,v=r.showInlineLineNumbers,y=void 0===v||v,b=r.startingLineNumber,q=void 0===b?1:b,V=r.lineNumberContainerStyle,S=r.lineNumberStyle,E=void 0===S?{}:S,x=r.wrapLines,C=r.wrapLongLines,w=void 0!==C&&C,R=r.lineProps,A=void 0===R?{}:R,T=r.renderer,k=r.PreTag,N=void 0===k?"pre":k,P=r.CodeTag,O=void 0===P?"code":P,F=r.code,_=void 0===F?(Array.isArray(a)?a[0]:a)||"":F,D=r.astGenerator,I=_objectWithoutProperties(r,_excluded);D=D||e;var U=m?React.createElement(AllLineNumbers,{containerStyle:V,codeStyle:p.style||{},numberStyle:E,startingLineNumber:q,codeString:_}):null,L=l.hljs||l['pre[class*="language-"]']||{backgroundColor:"#fff"},B=isHighlightJs(D)?"hljs":"prismjs",W=f?Object.assign({},I,{style:Object.assign({},L,u)}):Object.assign({},I,{className:I.className?"".concat(B," ").concat(I.className):B,style:Object.assign({},u)});if(p.style=_objectSpread(w?{whiteSpace:"pre-wrap"}:{whiteSpace:"pre"},p.style),!D)return React.createElement(N,W,U,React.createElement(O,p,_));(void 0===x&&T||w)&&(x=!0),T=T||defaultRenderer;var M=[{type:"text",value:_}],j=getCodeTree({astGenerator:D,language:o,code:_,defaultCodeValue:M});null===j.language&&(j.value=M);var K=processLines(j,x,A,m,y,q,q+(null!==(n=null===(i=_.match(/\n/g))||void 0===i?void 0:i.length)&&void 0!==n?n:0),E,w);return React.createElement(N,W,React.createElement(O,p,!y&&U,T({rows:K,stylesheet:l,useInlineStyles:f})))}}function asyncGeneratorStep(e,t,r,n,i,o,a){try{var s=e[o](a),l=s.value}catch(c){return void r(c)}s.done?t(l):Promise.resolve(l).then(n,i)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var o=e.apply(t,r);function a(e){asyncGeneratorStep(o,n,i,a,s,"next",e)}function s(e){asyncGeneratorStep(o,n,i,a,s,"throw",e)}a(void 0)})}}function _regeneratorRuntime$1(){
229
229
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
230
230
  _regeneratorRuntime$1=function(){return t};var e,t={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(P){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var o=t&&t.prototype instanceof v?t:v,a=Object.create(o.prototype),s=new k(n||[]);return i(a,"_invoke",{value:w(e,r,s)}),a}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(n){return{type:"throw",arg:n}}}t.wrap=u;var p="suspendedStart",h="suspendedYield",f="executing",g="completed",m={};function v(){}function y(){}function b(){}var q={};c(q,a,function(){return this});var V=Object.getPrototypeOf,S=V&&V(V(N([])));S&&S!==r&&n.call(S,a)&&(q=S);var E=b.prototype=v.prototype=Object.create(q);function x(e){["next","throw","return"].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function C(e,t){function r(i,o,a,s){var l=d(e[i],e,o);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==_typeof$1(u)&&n.call(u,"__await")?t.resolve(u.__await).then(function(e){r("next",e,a,s)},function(e){r("throw",e,a,s)}):t.resolve(u).then(function(e){c.value=e,a(c)},function(e){return r("throw",e,a,s)})}s(l.arg)}var o;i(this,"_invoke",{value:function(e,n){function i(){return new t(function(t,i){r(e,n,t,i)})}return o=o?o.then(i,i):i()}})}function w(t,r,n){var i=p;return function(o,a){if(i===f)throw Error("Generator is already running");if(i===g){if("throw"===o)throw a;return{value:e,done:!0}}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var l=R(s,n);if(l){if(l===m)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===p)throw i=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=f;var c=d(t,r,n);if("normal"===c.type){if(i=n.done?g:h,c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=g,n.method="throw",n.arg=c.arg)}}}function R(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,R(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var o=d(i,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var a=o.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function A(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(A,this),this.reset(!0)}function N(t){if(t||""===t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function r(){for(;++i<t.length;)if(n.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return o.next=o}}throw new TypeError(_typeof$1(t)+" is not iterable")}return y.prototype=b,i(E,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:y,configurable:!0}),y.displayName=c(b,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,l,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},x(C.prototype),c(C.prototype,s,function(){return this}),t.AsyncIterator=C,t.async=function(e,r,n,i,o){void 0===o&&(o=Promise);var a=new C(u(e,r,n,i),o);return t.isGeneratorFunction(r)?a:a.next().then(function(e){return e.done?e.value:a.next()})},x(E),c(E,l,"Generator"),c(E,a,function(){return this}),c(E,"toString",function(){return"[object Generator]"}),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=N,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(T),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function i(n,i){return s.type="throw",s.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var l=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;T(r)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:N(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}function _callSuper(e,t,r){return t=_getPrototypeOf(t),_possibleConstructorReturn(e,_isNativeReflectConstruct()?Reflect.construct(t,r||[],_getPrototypeOf(e).constructor):t.apply(e,r))}function _isNativeReflectConstruct(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(_isNativeReflectConstruct=function(){return!!e})()}const createAsyncLoadingHighlighter=function(e){var t,r=e.loader,n=e.isLanguageRegistered,i=e.registerLanguage,o=e.languageLoaders,a=e.noAsyncLoadingLanguages,s=function(e){function t(){return _classCallCheck(this,t),_callSuper(this,t,arguments)}return _inherits(t,e),_createClass(t,[{key:"componentDidUpdate",value:function(){!t.isRegistered(this.props.language)&&o&&this.loadLanguage()}},{key:"componentDidMount",value:function(){var e=this;t.astGeneratorPromise||t.loadAstGenerator(),t.astGenerator||t.astGeneratorPromise.then(function(){e.forceUpdate()}),!t.isRegistered(this.props.language)&&o&&this.loadLanguage()}},{key:"loadLanguage",value:function(){var e=this,r=this.props.language;"text"!==r&&t.loadLanguage(r).then(function(){return e.forceUpdate()}).catch(function(){})}},{key:"normalizeLanguage",value:function(e){return t.isSupportedLanguage(e)?e:"text"}},{key:"render",value:function(){return React.createElement(t.highlightInstance,_extends$Z({},this.props,{language:this.normalizeLanguage(this.props.language),astGenerator:t.astGenerator}))}}],[{key:"preload",value:function(){return t.loadAstGenerator()}},{key:"loadLanguage",value:(n=_asyncToGenerator(_regeneratorRuntime$1().mark(function e(r){var n;return _regeneratorRuntime$1().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("function"!=typeof(n=o[r])){e.next=5;break}return e.abrupt("return",n(t.registerLanguage));case 5:throw new Error("Language ".concat(r," not supported"));case 6:case"end":return e.stop()}},e)})),function(e){return n.apply(this,arguments)})},{key:"isSupportedLanguage",value:function(e){return t.isRegistered(e)||"function"==typeof o[e]}},{key:"loadAstGenerator",value:function(){return t.astGeneratorPromise=r().then(function(e){t.astGenerator=e,i&&t.languages.forEach(function(t,r){return i(e,r,t)})}),t.astGeneratorPromise}}]);var n}(React.PureComponent);return t=s,_defineProperty$1(s,"astGenerator",null),_defineProperty$1(s,"highlightInstance",highlight$1(null,{})),_defineProperty$1(s,"astGeneratorPromise",null),_defineProperty$1(s,"languages",new Map),_defineProperty$1(s,"supportedLanguages",e.supportedLanguages||Object.keys(o||{})),_defineProperty$1(s,"isRegistered",function(e){if(a)return!0;if(!i)throw new Error("Current syntax highlighter doesn't support registration of languages");return t.astGenerator?n(t.astGenerator,e):t.languages.has(e)}),_defineProperty$1(s,"registerLanguage",function(e,r){if(!i)throw new Error("Current syntax highlighter doesn't support registration of languages");if(t.astGenerator)return i(t.astGenerator,e,r);t.languages.set(e,r)}),s};function _regeneratorRuntime(){
231
231
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */