@niwa-labs/ncode 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/CHANGELOG.zh-CN.md +5 -0
- package/README.md +2 -2
- package/chunks/{application-A3S2LMBY.js → application-6B6N6MDM.js} +1 -1
- package/chunks/{auth-command-QNQ32TBI.js → auth-command-L57HWPOO.js} +1 -1
- package/chunks/{chunk-6LDRLO4Y.js → chunk-3LRARE6Z.js} +1 -1
- package/chunks/{chunk-5R2PGOIA.js → chunk-3MLT4F77.js} +1 -1
- package/chunks/{chunk-NOGL6Y6L.js → chunk-7F3QKGB7.js} +1 -1
- package/chunks/{chunk-LFGHL5A2.js → chunk-ALZZ3WAV.js} +1 -1
- package/chunks/{chunk-RD7XROJD.js → chunk-CUPCI2YC.js} +1 -1
- package/chunks/{chunk-OOBSLGMR.js → chunk-DBSRTVJC.js} +1 -1
- package/chunks/{chunk-XSWWOH4F.js → chunk-GS7TCNDK.js} +1 -1
- package/chunks/{chunk-36COWQLE.js → chunk-GZPVFWYD.js} +1 -1
- package/chunks/{chunk-CAY2BP2G.js → chunk-JEHPL5Z6.js} +1 -1
- package/chunks/{chunk-R7NDEPS3.js → chunk-LC7ZI6EV.js} +1 -1
- package/chunks/{chunk-ELHMZ5OD.js → chunk-NWMN2FDO.js} +1 -1
- package/chunks/{chunk-MVI24MQ2.js → chunk-O5EROATK.js} +664 -664
- package/chunks/{chunk-UMGGEC4N.js → chunk-QIYZZJVO.js} +1 -1
- package/chunks/{chunk-PBGCNSGZ.js → chunk-QMBFFQPV.js} +1 -1
- package/chunks/{chunk-JLFN6WSO.js → chunk-RZDVNG5Z.js} +1 -1
- package/chunks/{chunk-MI4YWYJF.js → chunk-UEPKZSE6.js} +1 -1
- package/chunks/{chunk-V4IDVAIA.js → chunk-WHBWI5OQ.js} +1 -1
- package/chunks/{chunk-ZPIJSTUE.js → chunk-WUORF7YS.js} +1 -1
- package/chunks/{chunk-UNEPZJKK.js → chunk-XWNCITOR.js} +5 -5
- package/chunks/{data-dir-OKWMOLNQ.js → data-dir-6RWVCAMB.js} +1 -1
- package/chunks/{launcher-4QSNU24J.js → launcher-B3C4PQ6Q.js} +3 -3
- package/chunks/{lifecycle-ELQ2EYO3.js → lifecycle-56K655PJ.js} +1 -1
- package/chunks/main-W3SJ2POE.js +14 -0
- package/chunks/{plugin-command-NGTATXBX.js → plugin-command-EBSKJLM3.js} +1 -1
- package/chunks/{profile-command-ZHVREBWO.js → profile-command-HIJDJDEL.js} +1 -1
- package/chunks/{provider-command-BGKOLCUG.js → provider-command-VCCPLOXR.js} +1 -1
- package/chunks/{run-acp-command-2CJQDXHQ.js → run-acp-command-FBV27QBE.js} +13 -13
- package/chunks/run-daemon-command-PZ2TU524.js +2 -0
- package/chunks/run-exec-command-K7BC2HEI.js +16 -0
- package/chunks/src-7ZMHMWLX.js +2 -0
- package/chunks/{telemetry-command-6FE4WQ4Q.js → telemetry-command-ZYOF64Y4.js} +1 -1
- package/chunks/{update-4VPIX7FP.js → update-ZKUCGIOR.js} +1 -1
- package/cli.js +3 -3
- package/matrix-mcp-stdio.js +1 -1
- package/mcoded.js +1 -1
- package/package.json +1 -1
- package/release.json +4 -4
- package/chunks/main-TXP74KHK.js +0 -14
- package/chunks/run-daemon-command-NDOIPTKF.js +0 -2
- package/chunks/run-exec-command-VNT4IKOJ.js +0 -16
- package/chunks/src-ED5HBSWE.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
|
|
2
|
-
import{c as um,d as lm,e as xT,g as wT,h as IT,i as DT}from"./chunk-BWR3NJFR.js";import{a as FT,b as hm,c as Ho,d as WT,e as jT,f as VT,h as pm}from"./chunk-ELHMZ5OD.js";import{h as dm,o as ET}from"./chunk-K6C7372U.js";import{a as sn,b as JT,c as nb,d as ub}from"./chunk-RQJU3CYQ.js";import{a as vn,b as x,g as ZT,h as eb,i as tb,j as $i,k as Uo,m as ib,n as sb}from"./chunk-XSWWOH4F.js";import{a as ms,b as cb,c as Sb}from"./chunk-OOBSLGMR.js";import{a as rb}from"./chunk-QWGJTTQL.js";import"./chunk-THPIH2MC.js";import{a as ob}from"./chunk-L6OMXWRF.js";import{a as $T,b as BT,d as qT}from"./chunk-AKUP5CLI.js";import{b as Tb,c as bb}from"./chunk-ETWTIQXF.js";import{a as NT,b as gb,c as yb}from"./chunk-SRTYTXAC.js";import{b as hb,e as pb,f as mb,g as fb}from"./chunk-PGYNNAKS.js";import{a as zT,b as QT,c as YT,d as XT,e as qn,h as ab,k as gs,m as lb,n as Bi,o as db,p as Hu,q as mm}from"./chunk-MI4YWYJF.js";import{a as nr,b as ir,c as Nn,d as qo,e as N,h as ct,i as Fu}from"./chunk-U6RWF7BC.js";import{a as $n,b as HT,c as $u,f as UT,j as KT,k as fs,m as Bn,n as Bu,o as qu,q as Ni,r as GT,s as Fi}from"./chunk-RD7XROJD.js";import{a as MT}from"./chunk-ME57CPMB.js";import{a as vb}from"./chunk-PBGCNSGZ.js";import"./chunk-JLFN6WSO.js";import{a as OT}from"./chunk-6LDRLO4Y.js";import{a as I9}from"./chunk-JMC5JQHT.js";import{a as w9}from"./chunk-XVGF4Y4P.js";import{d as CT}from"./chunk-R7NDEPS3.js";import{d as ST}from"./chunk-V6SXVN2Z.js";import"./chunk-7WOIEENL.js";import{d as bT,e as vT}from"./chunk-ZPIJSTUE.js";import{c as TT}from"./chunk-V4IDVAIA.js";import{A as PT,B as _T,C as LT,l as AT,m as qt,o as RT,p as ps,u as kT}from"./chunk-MVI24MQ2.js";import"./chunk-NJAER6QW.js";import{a as Fn}from"./chunk-PIADSVUZ.js";import"./chunk-ZJZBXSNG.js";import"./chunk-OLQR4XQZ.js";import"./chunk-ASRGXT22.js";import"./chunk-FJEP2EHP.js";import"./chunk-HMLSH6YL.js";import"./chunk-PIV6YF7B.js";import"./chunk-D2BEUF36.js";import"./chunk-2EBHD6KJ.js";import"./chunk-3KTXNSLL.js";import"./chunk-SKLKXOH4.js";import"./chunk-QASV4FRT.js";import"./chunk-W7O5Y6VY.js";import"./chunk-E3RI7IHR.js";import"./chunk-NT6GUYYJ.js";import"./chunk-3ZEDGMQ4.js";import{a as gT,e as yT}from"./chunk-TRX2HFTB.js";import{ja as hT,ka as pT,sa as mT}from"./chunk-UNEPZJKK.js";import{l as am}from"./chunk-ISBSRM3S.js";import{o as Bo}from"./chunk-5R2PGOIA.js";import"./chunk-UQL67NEA.js";import"./chunk-ZK7UCXBX.js";import"./chunk-2YX4JWQ4.js";import"./chunk-T4KXNSN3.js";import"./chunk-LVGBQ7NP.js";import"./chunk-SK4JBJDF.js";import"./chunk-YHXW6NMN.js";import"./chunk-NG2L523L.js";import{d as cm}from"./chunk-UE7MODZO.js";import"./chunk-HVCY6M5J.js";import"./chunk-XWU4BV73.js";import"./chunk-NUHYT7HY.js";import"./chunk-FHJWUDED.js";import"./chunk-4QXF4OT5.js";import"./chunk-6MFNDZP7.js";import"./chunk-4GGSPZK3.js";import"./chunk-IONMKU5J.js";import"./chunk-AODHXPQF.js";import{h as fT}from"./chunk-AUG3KCLV.js";import{nb as M9}from"./chunk-CAY2BP2G.js";import"./chunk-DSIZQTS3.js";import"./chunk-NOGL6Y6L.js";import"./chunk-OKOOSGFE.js";import"./chunk-INIZLM6Q.js";import"./chunk-ELQ5G4U6.js";import"./chunk-BF4U2LYQ.js";import"./chunk-GJ3NP2JO.js";import"./chunk-WXD24E23.js";import"./chunk-2PNC3MM4.js";import"./chunk-4QKCRKWB.js";import"./chunk-YNDFGYGN.js";import"./chunk-NEICESQ2.js";import"./chunk-TXWPPTYK.js";import"./chunk-5RFGU5IW.js";import"./chunk-QH5Z4N4A.js";import"./chunk-WTI4WCBV.js";import"./chunk-PTV7FFNF.js";import"./chunk-TAEC3WRM.js";import"./chunk-3XYKJXXO.js";import"./chunk-4A4KPPPE.js";import{a as sr}from"./chunk-VAARXN34.js";import{c as ce,e as cT}from"./chunk-FK3SSGJE.js";var Fl=ce(oi=>{"use strict";var K_=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];oi.REPLACEMENT_CHARACTER="\uFFFD";oi.CODE_POINTS={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533};oi.CODE_POINT_SEQUENCES={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]};oi.isSurrogate=function(n){return n>=55296&&n<=57343};oi.isSurrogatePair=function(n){return n>=56320&&n<=57343};oi.getSurrogatePairCodePoint=function(n,e){return(n-55296)*1024+9216+e};oi.isControlCodePoint=function(n){return n!==32&&n!==10&&n!==13&&n!==9&&n!==12&&n>=1&&n<=31||n>=127&&n<=159};oi.isUndefinedCodePoint=function(n){return n>=64976&&n<=65007||K_.indexOf(n)>-1}});var $l=ce((GY,nS)=>{"use strict";nS.exports={controlCharacterInInputStream:"control-character-in-input-stream",noncharacterInInputStream:"noncharacter-in-input-stream",surrogateInInputStream:"surrogate-in-input-stream",nonVoidHtmlElementStartTagWithTrailingSolidus:"non-void-html-element-start-tag-with-trailing-solidus",endTagWithAttributes:"end-tag-with-attributes",endTagWithTrailingSolidus:"end-tag-with-trailing-solidus",unexpectedSolidusInTag:"unexpected-solidus-in-tag",unexpectedNullCharacter:"unexpected-null-character",unexpectedQuestionMarkInsteadOfTagName:"unexpected-question-mark-instead-of-tag-name",invalidFirstCharacterOfTagName:"invalid-first-character-of-tag-name",unexpectedEqualsSignBeforeAttributeName:"unexpected-equals-sign-before-attribute-name",missingEndTagName:"missing-end-tag-name",unexpectedCharacterInAttributeName:"unexpected-character-in-attribute-name",unknownNamedCharacterReference:"unknown-named-character-reference",missingSemicolonAfterCharacterReference:"missing-semicolon-after-character-reference",unexpectedCharacterAfterDoctypeSystemIdentifier:"unexpected-character-after-doctype-system-identifier",unexpectedCharacterInUnquotedAttributeValue:"unexpected-character-in-unquoted-attribute-value",eofBeforeTagName:"eof-before-tag-name",eofInTag:"eof-in-tag",missingAttributeValue:"missing-attribute-value",missingWhitespaceBetweenAttributes:"missing-whitespace-between-attributes",missingWhitespaceAfterDoctypePublicKeyword:"missing-whitespace-after-doctype-public-keyword",missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:"missing-whitespace-between-doctype-public-and-system-identifiers",missingWhitespaceAfterDoctypeSystemKeyword:"missing-whitespace-after-doctype-system-keyword",missingQuoteBeforeDoctypePublicIdentifier:"missing-quote-before-doctype-public-identifier",missingQuoteBeforeDoctypeSystemIdentifier:"missing-quote-before-doctype-system-identifier",missingDoctypePublicIdentifier:"missing-doctype-public-identifier",missingDoctypeSystemIdentifier:"missing-doctype-system-identifier",abruptDoctypePublicIdentifier:"abrupt-doctype-public-identifier",abruptDoctypeSystemIdentifier:"abrupt-doctype-system-identifier",cdataInHtmlContent:"cdata-in-html-content",incorrectlyOpenedComment:"incorrectly-opened-comment",eofInScriptHtmlCommentLikeText:"eof-in-script-html-comment-like-text",eofInDoctype:"eof-in-doctype",nestedComment:"nested-comment",abruptClosingOfEmptyComment:"abrupt-closing-of-empty-comment",eofInComment:"eof-in-comment",incorrectlyClosedComment:"incorrectly-closed-comment",eofInCdata:"eof-in-cdata",absenceOfDigitsInNumericCharacterReference:"absence-of-digits-in-numeric-character-reference",nullCharacterReference:"null-character-reference",surrogateCharacterReference:"surrogate-character-reference",characterReferenceOutsideUnicodeRange:"character-reference-outside-unicode-range",controlCharacterReference:"control-character-reference",noncharacterCharacterReference:"noncharacter-character-reference",missingWhitespaceBeforeDoctypeName:"missing-whitespace-before-doctype-name",missingDoctypeName:"missing-doctype-name",invalidCharacterSequenceAfterDoctypeName:"invalid-character-sequence-after-doctype-name",duplicateAttribute:"duplicate-attribute",nonConformingDoctype:"non-conforming-doctype",missingDoctype:"missing-doctype",misplacedDoctype:"misplaced-doctype",endTagWithoutMatchingOpenElement:"end-tag-without-matching-open-element",closingOfElementWithOpenChildElements:"closing-of-element-with-open-child-elements",disallowedContentInNoscriptInHead:"disallowed-content-in-noscript-in-head",openElementsLeftAfterEof:"open-elements-left-after-eof",abandonedHeadElementChild:"abandoned-head-element-child",misplacedStartTagForHeadElement:"misplaced-start-tag-for-head-element",nestedNoscriptInHead:"nested-noscript-in-head",eofInElementThatCanContainOnlyText:"eof-in-element-that-can-contain-only-text"}});var sS=ce((zY,iS)=>{"use strict";var _r=Fl();var vf=$l();var _s=_r.CODE_POINTS;var W_=1<<16;var Sf=class{constructor(){this.html=null;this.pos=-1;this.lastGapPos=-1;this.lastCharPos=-1;this.gapStack=[];this.skipNextNewLine=false;this.lastChunkWritten=false;this.endOfChunkHit=false;this.bufferWaterline=W_}_err(){}_addGap(){this.gapStack.push(this.lastGapPos);this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.lastCharPos){const t=this.html.charCodeAt(this.pos+1);if(_r.isSurrogatePair(t)){this.pos++;this._addGap();return _r.getSurrogatePairCodePoint(e,t)}}else if(!this.lastChunkWritten){this.endOfChunkHit=true;return _s.EOF}this._err(vf.surrogateInInputStream);return e}dropParsedChunk(){if(this.pos>this.bufferWaterline){this.lastCharPos-=this.pos;this.html=this.html.substring(this.pos);this.pos=0;this.lastGapPos=-1;this.gapStack=[]}}write(e,t){if(this.html){this.html+=e}else{this.html=e}this.lastCharPos=this.html.length-1;this.endOfChunkHit=false;this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1,this.html.length);this.lastCharPos=this.html.length-1;this.endOfChunkHit=false}advance(){this.pos++;if(this.pos>this.lastCharPos){this.endOfChunkHit=!this.lastChunkWritten;return _s.EOF}let e=this.html.charCodeAt(this.pos);if(this.skipNextNewLine&&e===_s.LINE_FEED){this.skipNextNewLine=false;this._addGap();return this.advance()}if(e===_s.CARRIAGE_RETURN){this.skipNextNewLine=true;return _s.LINE_FEED}this.skipNextNewLine=false;if(_r.isSurrogate(e)){e=this._processSurrogate(e)}const t=e>31&&e<127||e===_s.LINE_FEED||e===_s.CARRIAGE_RETURN||e>159&&e<64976;if(!t){this._checkForProblematicCharacters(e)}return e}_checkForProblematicCharacters(e){if(_r.isControlCodePoint(e)){this._err(vf.controlCharacterInInputStream)}else if(_r.isUndefinedCodePoint(e)){this._err(vf.noncharacterInInputStream)}}retreat(){if(this.pos===this.lastGapPos){this.lastGapPos=this.gapStack.pop();this.pos--}this.pos--}};iS.exports=Sf});var oS=ce((QY,rS)=>{"use strict";rS.exports=new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4e3,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,1e4,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13e3,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204])});var xa=ce((YY,sC)=>{"use strict";var j_=sS();var ke=Fl();var Ds=oS();var F=$l();var M=ke.CODE_POINTS;var Ls=ke.CODE_POINT_SEQUENCES;var V_={128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376};var JS=1<<0;var ZS=1<<1;var eC=1<<2;var G_=JS|ZS|eC;var he="DATA_STATE";var Or="RCDATA_STATE";var Sa="RAWTEXT_STATE";var li="SCRIPT_DATA_STATE";var tC="PLAINTEXT_STATE";var aS="TAG_OPEN_STATE";var uS="END_TAG_OPEN_STATE";var Cf="TAG_NAME_STATE";var lS="RCDATA_LESS_THAN_SIGN_STATE";var dS="RCDATA_END_TAG_OPEN_STATE";var cS="RCDATA_END_TAG_NAME_STATE";var hS="RAWTEXT_LESS_THAN_SIGN_STATE";var pS="RAWTEXT_END_TAG_OPEN_STATE";var mS="RAWTEXT_END_TAG_NAME_STATE";var fS="SCRIPT_DATA_LESS_THAN_SIGN_STATE";var gS="SCRIPT_DATA_END_TAG_OPEN_STATE";var yS="SCRIPT_DATA_END_TAG_NAME_STATE";var TS="SCRIPT_DATA_ESCAPE_START_STATE";var bS="SCRIPT_DATA_ESCAPE_START_DASH_STATE";var In="SCRIPT_DATA_ESCAPED_STATE";var vS="SCRIPT_DATA_ESCAPED_DASH_STATE";var xf="SCRIPT_DATA_ESCAPED_DASH_DASH_STATE";var Bl="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE";var SS="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE";var CS="SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE";var xS="SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE";var ai="SCRIPT_DATA_DOUBLE_ESCAPED_STATE";var wS="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE";var IS="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE";var ql="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE";var MS="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE";var Kn="BEFORE_ATTRIBUTE_NAME_STATE";var Hl="ATTRIBUTE_NAME_STATE";var wf="AFTER_ATTRIBUTE_NAME_STATE";var If="BEFORE_ATTRIBUTE_VALUE_STATE";var Ul="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE";var Kl="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE";var Wl="ATTRIBUTE_VALUE_UNQUOTED_STATE";var Mf="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE";var ji="SELF_CLOSING_START_TAG_STATE";var ya="BOGUS_COMMENT_STATE";var ES="MARKUP_DECLARATION_OPEN_STATE";var AS="COMMENT_START_STATE";var RS="COMMENT_START_DASH_STATE";var Vi="COMMENT_STATE";var kS="COMMENT_LESS_THAN_SIGN_STATE";var PS="COMMENT_LESS_THAN_SIGN_BANG_STATE";var _S="COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE";var LS="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE";var jl="COMMENT_END_DASH_STATE";var Vl="COMMENT_END_STATE";var OS="COMMENT_END_BANG_STATE";var DS="DOCTYPE_STATE";var Gl="BEFORE_DOCTYPE_NAME_STATE";var zl="DOCTYPE_NAME_STATE";var NS="AFTER_DOCTYPE_NAME_STATE";var FS="AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE";var $S="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE";var Ef="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE";var Af="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE";var Rf="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE";var BS="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE";var qS="AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE";var HS="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE";var Ta="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE";var ba="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE";var kf="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE";var ui="BOGUS_DOCTYPE_STATE";var Ql="CDATA_SECTION_STATE";var US="CDATA_SECTION_BRACKET_STATE";var KS="CDATA_SECTION_END_STATE";var Lr="CHARACTER_REFERENCE_STATE";var WS="NAMED_CHARACTER_REFERENCE_STATE";var jS="AMBIGUOS_AMPERSAND_STATE";var VS="NUMERIC_CHARACTER_REFERENCE_STATE";var GS="HEXADEMICAL_CHARACTER_REFERENCE_START_STATE";var zS="DECIMAL_CHARACTER_REFERENCE_START_STATE";var QS="HEXADEMICAL_CHARACTER_REFERENCE_STATE";var YS="DECIMAL_CHARACTER_REFERENCE_STATE";var va="NUMERIC_CHARACTER_REFERENCE_END_STATE";function Be(n){return n===M.SPACE||n===M.LINE_FEED||n===M.TABULATION||n===M.FORM_FEED}function Ca(n){return n>=M.DIGIT_0&&n<=M.DIGIT_9}function Mn(n){return n>=M.LATIN_CAPITAL_A&&n<=M.LATIN_CAPITAL_Z}function Os(n){return n>=M.LATIN_SMALL_A&&n<=M.LATIN_SMALL_Z}function zi(n){return Os(n)||Mn(n)}function Pf(n){return zi(n)||Ca(n)}function nC(n){return n>=M.LATIN_CAPITAL_A&&n<=M.LATIN_CAPITAL_F}function iC(n){return n>=M.LATIN_SMALL_A&&n<=M.LATIN_SMALL_F}function z_(n){return Ca(n)||nC(n)||iC(n)}function Yl(n){return n+32}function Ge(n){if(n<=65535){return String.fromCharCode(n)}n-=65536;return String.fromCharCode(n>>>10&1023|55296)+String.fromCharCode(56320|n&1023)}function Gi(n){return String.fromCharCode(Yl(n))}function XS(n,e){const t=Ds[++n];let i=++n;let s=i+t-1;while(i<=s){const r=i+s>>>1;const o=Ds[r];if(o<e){i=r+1}else if(o>e){s=r-1}else{return Ds[r+t]}}return-1}var Dt=class n{constructor(){this.preprocessor=new j_;this.tokenQueue=[];this.allowCDATA=false;this.state=he;this.returnState="";this.charRefCode=-1;this.tempBuff=[];this.lastStartTagName="";this.consumedAfterSnapshot=-1;this.active=false;this.currentCharacterToken=null;this.currentToken=null;this.currentAttr=null}_err(){}_errOnNextCodePoint(e){this._consume();this._err(e);this._unconsume()}getNextToken(){while(!this.tokenQueue.length&&this.active){this.consumedAfterSnapshot=0;const e=this._consume();if(!this._ensureHibernation()){this[this.state](e)}}return this.tokenQueue.shift()}write(e,t){this.active=true;this.preprocessor.write(e,t)}insertHtmlAtCurrentPos(e){this.active=true;this.preprocessor.insertHtmlAtCurrentPos(e)}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--){this.preprocessor.retreat()}this.active=false;this.tokenQueue.push({type:n.HIBERNATION_TOKEN});return true}return false}_consume(){this.consumedAfterSnapshot++;return this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--;this.preprocessor.retreat()}_reconsumeInState(e){this.state=e;this._unconsume()}_consumeSequenceIfMatch(e,t,i){let s=0;let r=true;const o=e.length;let a=0;let u=t;let l=void 0;for(;a<o;a++){if(a>0){u=this._consume();s++}if(u===M.EOF){r=false;break}l=e[a];if(u!==l&&(i||u!==Yl(l))){r=false;break}}if(!r){while(s--){this._unconsume()}}return r}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==Ls.SCRIPT_STRING.length){return false}for(let e=0;e<this.tempBuff.length;e++){if(this.tempBuff[e]!==Ls.SCRIPT_STRING[e]){return false}}return true}_createStartTagToken(){this.currentToken={type:n.START_TAG_TOKEN,tagName:"",selfClosing:false,ackSelfClosing:false,attrs:[]}}_createEndTagToken(){this.currentToken={type:n.END_TAG_TOKEN,tagName:"",selfClosing:false,attrs:[]}}_createCommentToken(){this.currentToken={type:n.COMMENT_TOKEN,data:""}}_createDoctypeToken(e){this.currentToken={type:n.DOCTYPE_TOKEN,name:e,forceQuirks:false,publicId:null,systemId:null}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t}}_createEOFToken(){this.currentToken={type:n.EOF_TOKEN}}_createAttr(e){this.currentAttr={name:e,value:""}}_leaveAttrName(e){if(n.getTokenAttr(this.currentToken,this.currentAttr.name)===null){this.currentToken.attrs.push(this.currentAttr)}else{this._err(F.duplicateAttribute)}this.state=e}_leaveAttrValue(e){this.state=e}_emitCurrentToken(){this._emitCurrentCharacterToken();const e=this.currentToken;this.currentToken=null;if(e.type===n.START_TAG_TOKEN){this.lastStartTagName=e.tagName}else if(e.type===n.END_TAG_TOKEN){if(e.attrs.length>0){this._err(F.endTagWithAttributes)}if(e.selfClosing){this._err(F.endTagWithTrailingSolidus)}}this.tokenQueue.push(e)}_emitCurrentCharacterToken(){if(this.currentCharacterToken){this.tokenQueue.push(this.currentCharacterToken);this.currentCharacterToken=null}}_emitEOFToken(){this._createEOFToken();this._emitCurrentToken()}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken&&this.currentCharacterToken.type!==e){this._emitCurrentCharacterToken()}if(this.currentCharacterToken){this.currentCharacterToken.chars+=t}else{this._createCharacterToken(e,t)}}_emitCodePoint(e){let t=n.CHARACTER_TOKEN;if(Be(e)){t=n.WHITESPACE_CHARACTER_TOKEN}else if(e===M.NULL){t=n.NULL_CHARACTER_TOKEN}this._appendCharToCurrentCharacterToken(t,Ge(e))}_emitSeveralCodePoints(e){for(let t=0;t<e.length;t++){this._emitCodePoint(e[t])}}_emitChars(e){this._appendCharToCurrentCharacterToken(n.CHARACTER_TOKEN,e)}_matchNamedCharacterReference(e){let t=null;let i=1;let s=XS(0,e);this.tempBuff.push(e);while(s>-1){const r=Ds[s];const o=r<G_;const a=o&&r&JS;if(a){t=r&ZS?[Ds[++s],Ds[++s]]:[Ds[++s]];i=0}const u=this._consume();this.tempBuff.push(u);i++;if(u===M.EOF){break}if(o){s=r&eC?XS(s,u):-1}else{s=u===r?++s:-1}}while(i--){this.tempBuff.pop();this._unconsume()}return t}_isCharacterReferenceInAttribute(){return this.returnState===Ul||this.returnState===Kl||this.returnState===Wl}_isCharacterReferenceAttributeQuirk(e){if(!e&&this._isCharacterReferenceInAttribute()){const t=this._consume();this._unconsume();return t===M.EQUALS_SIGN||Pf(t)}return false}_flushCodePointsConsumedAsCharacterReference(){if(this._isCharacterReferenceInAttribute()){for(let e=0;e<this.tempBuff.length;e++){this.currentAttr.value+=Ge(this.tempBuff[e])}}else{this._emitSeveralCodePoints(this.tempBuff)}this.tempBuff=[]}[he](e){this.preprocessor.dropParsedChunk();if(e===M.LESS_THAN_SIGN){this.state=aS}else if(e===M.AMPERSAND){this.returnState=he;this.state=Lr}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitCodePoint(e)}else if(e===M.EOF){this._emitEOFToken()}else{this._emitCodePoint(e)}}[Or](e){this.preprocessor.dropParsedChunk();if(e===M.AMPERSAND){this.returnState=Or;this.state=Lr}else if(e===M.LESS_THAN_SIGN){this.state=lS}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._emitEOFToken()}else{this._emitCodePoint(e)}}[Sa](e){this.preprocessor.dropParsedChunk();if(e===M.LESS_THAN_SIGN){this.state=hS}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._emitEOFToken()}else{this._emitCodePoint(e)}}[li](e){this.preprocessor.dropParsedChunk();if(e===M.LESS_THAN_SIGN){this.state=fS}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._emitEOFToken()}else{this._emitCodePoint(e)}}[tC](e){this.preprocessor.dropParsedChunk();if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._emitEOFToken()}else{this._emitCodePoint(e)}}[aS](e){if(e===M.EXCLAMATION_MARK){this.state=ES}else if(e===M.SOLIDUS){this.state=uS}else if(zi(e)){this._createStartTagToken();this._reconsumeInState(Cf)}else if(e===M.QUESTION_MARK){this._err(F.unexpectedQuestionMarkInsteadOfTagName);this._createCommentToken();this._reconsumeInState(ya)}else if(e===M.EOF){this._err(F.eofBeforeTagName);this._emitChars("<");this._emitEOFToken()}else{this._err(F.invalidFirstCharacterOfTagName);this._emitChars("<");this._reconsumeInState(he)}}[uS](e){if(zi(e)){this._createEndTagToken();this._reconsumeInState(Cf)}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingEndTagName);this.state=he}else if(e===M.EOF){this._err(F.eofBeforeTagName);this._emitChars("</");this._emitEOFToken()}else{this._err(F.invalidFirstCharacterOfTagName);this._createCommentToken();this._reconsumeInState(ya)}}[Cf](e){if(Be(e)){this.state=Kn}else if(e===M.SOLIDUS){this.state=ji}else if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(Mn(e)){this.currentToken.tagName+=Gi(e)}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.tagName+=ke.REPLACEMENT_CHARACTER}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this.currentToken.tagName+=Ge(e)}}[lS](e){if(e===M.SOLIDUS){this.tempBuff=[];this.state=dS}else{this._emitChars("<");this._reconsumeInState(Or)}}[dS](e){if(zi(e)){this._createEndTagToken();this._reconsumeInState(cS)}else{this._emitChars("</");this._reconsumeInState(Or)}}[cS](e){if(Mn(e)){this.currentToken.tagName+=Gi(e);this.tempBuff.push(e)}else if(Os(e)){this.currentToken.tagName+=Ge(e);this.tempBuff.push(e)}else{if(this.lastStartTagName===this.currentToken.tagName){if(Be(e)){this.state=Kn;return}if(e===M.SOLIDUS){this.state=ji;return}if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken();return}}this._emitChars("</");this._emitSeveralCodePoints(this.tempBuff);this._reconsumeInState(Or)}}[hS](e){if(e===M.SOLIDUS){this.tempBuff=[];this.state=pS}else{this._emitChars("<");this._reconsumeInState(Sa)}}[pS](e){if(zi(e)){this._createEndTagToken();this._reconsumeInState(mS)}else{this._emitChars("</");this._reconsumeInState(Sa)}}[mS](e){if(Mn(e)){this.currentToken.tagName+=Gi(e);this.tempBuff.push(e)}else if(Os(e)){this.currentToken.tagName+=Ge(e);this.tempBuff.push(e)}else{if(this.lastStartTagName===this.currentToken.tagName){if(Be(e)){this.state=Kn;return}if(e===M.SOLIDUS){this.state=ji;return}if(e===M.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=he;return}}this._emitChars("</");this._emitSeveralCodePoints(this.tempBuff);this._reconsumeInState(Sa)}}[fS](e){if(e===M.SOLIDUS){this.tempBuff=[];this.state=gS}else if(e===M.EXCLAMATION_MARK){this.state=TS;this._emitChars("<!")}else{this._emitChars("<");this._reconsumeInState(li)}}[gS](e){if(zi(e)){this._createEndTagToken();this._reconsumeInState(yS)}else{this._emitChars("</");this._reconsumeInState(li)}}[yS](e){if(Mn(e)){this.currentToken.tagName+=Gi(e);this.tempBuff.push(e)}else if(Os(e)){this.currentToken.tagName+=Ge(e);this.tempBuff.push(e)}else{if(this.lastStartTagName===this.currentToken.tagName){if(Be(e)){this.state=Kn;return}else if(e===M.SOLIDUS){this.state=ji;return}else if(e===M.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=he;return}}this._emitChars("</");this._emitSeveralCodePoints(this.tempBuff);this._reconsumeInState(li)}}[TS](e){if(e===M.HYPHEN_MINUS){this.state=bS;this._emitChars("-")}else{this._reconsumeInState(li)}}[bS](e){if(e===M.HYPHEN_MINUS){this.state=xf;this._emitChars("-")}else{this._reconsumeInState(li)}}[In](e){if(e===M.HYPHEN_MINUS){this.state=vS;this._emitChars("-")}else if(e===M.LESS_THAN_SIGN){this.state=Bl}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._err(F.eofInScriptHtmlCommentLikeText);this._emitEOFToken()}else{this._emitCodePoint(e)}}[vS](e){if(e===M.HYPHEN_MINUS){this.state=xf;this._emitChars("-")}else if(e===M.LESS_THAN_SIGN){this.state=Bl}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.state=In;this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._err(F.eofInScriptHtmlCommentLikeText);this._emitEOFToken()}else{this.state=In;this._emitCodePoint(e)}}[xf](e){if(e===M.HYPHEN_MINUS){this._emitChars("-")}else if(e===M.LESS_THAN_SIGN){this.state=Bl}else if(e===M.GREATER_THAN_SIGN){this.state=li;this._emitChars(">")}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.state=In;this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._err(F.eofInScriptHtmlCommentLikeText);this._emitEOFToken()}else{this.state=In;this._emitCodePoint(e)}}[Bl](e){if(e===M.SOLIDUS){this.tempBuff=[];this.state=SS}else if(zi(e)){this.tempBuff=[];this._emitChars("<");this._reconsumeInState(xS)}else{this._emitChars("<");this._reconsumeInState(In)}}[SS](e){if(zi(e)){this._createEndTagToken();this._reconsumeInState(CS)}else{this._emitChars("</");this._reconsumeInState(In)}}[CS](e){if(Mn(e)){this.currentToken.tagName+=Gi(e);this.tempBuff.push(e)}else if(Os(e)){this.currentToken.tagName+=Ge(e);this.tempBuff.push(e)}else{if(this.lastStartTagName===this.currentToken.tagName){if(Be(e)){this.state=Kn;return}if(e===M.SOLIDUS){this.state=ji;return}if(e===M.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=he;return}}this._emitChars("</");this._emitSeveralCodePoints(this.tempBuff);this._reconsumeInState(In)}}[xS](e){if(Be(e)||e===M.SOLIDUS||e===M.GREATER_THAN_SIGN){this.state=this._isTempBufferEqualToScriptString()?ai:In;this._emitCodePoint(e)}else if(Mn(e)){this.tempBuff.push(Yl(e));this._emitCodePoint(e)}else if(Os(e)){this.tempBuff.push(e);this._emitCodePoint(e)}else{this._reconsumeInState(In)}}[ai](e){if(e===M.HYPHEN_MINUS){this.state=wS;this._emitChars("-")}else if(e===M.LESS_THAN_SIGN){this.state=ql;this._emitChars("<")}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._err(F.eofInScriptHtmlCommentLikeText);this._emitEOFToken()}else{this._emitCodePoint(e)}}[wS](e){if(e===M.HYPHEN_MINUS){this.state=IS;this._emitChars("-")}else if(e===M.LESS_THAN_SIGN){this.state=ql;this._emitChars("<")}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.state=ai;this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._err(F.eofInScriptHtmlCommentLikeText);this._emitEOFToken()}else{this.state=ai;this._emitCodePoint(e)}}[IS](e){if(e===M.HYPHEN_MINUS){this._emitChars("-")}else if(e===M.LESS_THAN_SIGN){this.state=ql;this._emitChars("<")}else if(e===M.GREATER_THAN_SIGN){this.state=li;this._emitChars(">")}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.state=ai;this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._err(F.eofInScriptHtmlCommentLikeText);this._emitEOFToken()}else{this.state=ai;this._emitCodePoint(e)}}[ql](e){if(e===M.SOLIDUS){this.tempBuff=[];this.state=MS;this._emitChars("/")}else{this._reconsumeInState(ai)}}[MS](e){if(Be(e)||e===M.SOLIDUS||e===M.GREATER_THAN_SIGN){this.state=this._isTempBufferEqualToScriptString()?In:ai;this._emitCodePoint(e)}else if(Mn(e)){this.tempBuff.push(Yl(e));this._emitCodePoint(e)}else if(Os(e)){this.tempBuff.push(e);this._emitCodePoint(e)}else{this._reconsumeInState(ai)}}[Kn](e){if(Be(e)){return}if(e===M.SOLIDUS||e===M.GREATER_THAN_SIGN||e===M.EOF){this._reconsumeInState(wf)}else if(e===M.EQUALS_SIGN){this._err(F.unexpectedEqualsSignBeforeAttributeName);this._createAttr("=");this.state=Hl}else{this._createAttr("");this._reconsumeInState(Hl)}}[Hl](e){if(Be(e)||e===M.SOLIDUS||e===M.GREATER_THAN_SIGN||e===M.EOF){this._leaveAttrName(wf);this._unconsume()}else if(e===M.EQUALS_SIGN){this._leaveAttrName(If)}else if(Mn(e)){this.currentAttr.name+=Gi(e)}else if(e===M.QUOTATION_MARK||e===M.APOSTROPHE||e===M.LESS_THAN_SIGN){this._err(F.unexpectedCharacterInAttributeName);this.currentAttr.name+=Ge(e)}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentAttr.name+=ke.REPLACEMENT_CHARACTER}else{this.currentAttr.name+=Ge(e)}}[wf](e){if(Be(e)){return}if(e===M.SOLIDUS){this.state=ji}else if(e===M.EQUALS_SIGN){this.state=If}else if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this._createAttr("");this._reconsumeInState(Hl)}}[If](e){if(Be(e)){return}if(e===M.QUOTATION_MARK){this.state=Ul}else if(e===M.APOSTROPHE){this.state=Kl}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingAttributeValue);this.state=he;this._emitCurrentToken()}else{this._reconsumeInState(Wl)}}[Ul](e){if(e===M.QUOTATION_MARK){this.state=Mf}else if(e===M.AMPERSAND){this.returnState=Ul;this.state=Lr}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentAttr.value+=ke.REPLACEMENT_CHARACTER}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this.currentAttr.value+=Ge(e)}}[Kl](e){if(e===M.APOSTROPHE){this.state=Mf}else if(e===M.AMPERSAND){this.returnState=Kl;this.state=Lr}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentAttr.value+=ke.REPLACEMENT_CHARACTER}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this.currentAttr.value+=Ge(e)}}[Wl](e){if(Be(e)){this._leaveAttrValue(Kn)}else if(e===M.AMPERSAND){this.returnState=Wl;this.state=Lr}else if(e===M.GREATER_THAN_SIGN){this._leaveAttrValue(he);this._emitCurrentToken()}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentAttr.value+=ke.REPLACEMENT_CHARACTER}else if(e===M.QUOTATION_MARK||e===M.APOSTROPHE||e===M.LESS_THAN_SIGN||e===M.EQUALS_SIGN||e===M.GRAVE_ACCENT){this._err(F.unexpectedCharacterInUnquotedAttributeValue);this.currentAttr.value+=Ge(e)}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this.currentAttr.value+=Ge(e)}}[Mf](e){if(Be(e)){this._leaveAttrValue(Kn)}else if(e===M.SOLIDUS){this._leaveAttrValue(ji)}else if(e===M.GREATER_THAN_SIGN){this._leaveAttrValue(he);this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this._err(F.missingWhitespaceBetweenAttributes);this._reconsumeInState(Kn)}}[ji](e){if(e===M.GREATER_THAN_SIGN){this.currentToken.selfClosing=true;this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this._err(F.unexpectedSolidusInTag);this._reconsumeInState(Kn)}}[ya](e){if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._emitCurrentToken();this._emitEOFToken()}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.data+=ke.REPLACEMENT_CHARACTER}else{this.currentToken.data+=Ge(e)}}[ES](e){if(this._consumeSequenceIfMatch(Ls.DASH_DASH_STRING,e,true)){this._createCommentToken();this.state=AS}else if(this._consumeSequenceIfMatch(Ls.DOCTYPE_STRING,e,false)){this.state=DS}else if(this._consumeSequenceIfMatch(Ls.CDATA_START_STRING,e,true)){if(this.allowCDATA){this.state=Ql}else{this._err(F.cdataInHtmlContent);this._createCommentToken();this.currentToken.data="[CDATA[";this.state=ya}}else if(!this._ensureHibernation()){this._err(F.incorrectlyOpenedComment);this._createCommentToken();this._reconsumeInState(ya)}}[AS](e){if(e===M.HYPHEN_MINUS){this.state=RS}else if(e===M.GREATER_THAN_SIGN){this._err(F.abruptClosingOfEmptyComment);this.state=he;this._emitCurrentToken()}else{this._reconsumeInState(Vi)}}[RS](e){if(e===M.HYPHEN_MINUS){this.state=Vl}else if(e===M.GREATER_THAN_SIGN){this._err(F.abruptClosingOfEmptyComment);this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInComment);this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.data+="-";this._reconsumeInState(Vi)}}[Vi](e){if(e===M.HYPHEN_MINUS){this.state=jl}else if(e===M.LESS_THAN_SIGN){this.currentToken.data+="<";this.state=kS}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.data+=ke.REPLACEMENT_CHARACTER}else if(e===M.EOF){this._err(F.eofInComment);this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.data+=Ge(e)}}[kS](e){if(e===M.EXCLAMATION_MARK){this.currentToken.data+="!";this.state=PS}else if(e===M.LESS_THAN_SIGN){this.currentToken.data+="!"}else{this._reconsumeInState(Vi)}}[PS](e){if(e===M.HYPHEN_MINUS){this.state=_S}else{this._reconsumeInState(Vi)}}[_S](e){if(e===M.HYPHEN_MINUS){this.state=LS}else{this._reconsumeInState(jl)}}[LS](e){if(e!==M.GREATER_THAN_SIGN&&e!==M.EOF){this._err(F.nestedComment)}this._reconsumeInState(Vl)}[jl](e){if(e===M.HYPHEN_MINUS){this.state=Vl}else if(e===M.EOF){this._err(F.eofInComment);this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.data+="-";this._reconsumeInState(Vi)}}[Vl](e){if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(e===M.EXCLAMATION_MARK){this.state=OS}else if(e===M.HYPHEN_MINUS){this.currentToken.data+="-"}else if(e===M.EOF){this._err(F.eofInComment);this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.data+="--";this._reconsumeInState(Vi)}}[OS](e){if(e===M.HYPHEN_MINUS){this.currentToken.data+="--!";this.state=jl}else if(e===M.GREATER_THAN_SIGN){this._err(F.incorrectlyClosedComment);this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInComment);this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.data+="--!";this._reconsumeInState(Vi)}}[DS](e){if(Be(e)){this.state=Gl}else if(e===M.GREATER_THAN_SIGN){this._reconsumeInState(Gl)}else if(e===M.EOF){this._err(F.eofInDoctype);this._createDoctypeToken(null);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingWhitespaceBeforeDoctypeName);this._reconsumeInState(Gl)}}[Gl](e){if(Be(e)){return}if(Mn(e)){this._createDoctypeToken(Gi(e));this.state=zl}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._createDoctypeToken(ke.REPLACEMENT_CHARACTER);this.state=zl}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingDoctypeName);this._createDoctypeToken(null);this.currentToken.forceQuirks=true;this._emitCurrentToken();this.state=he}else if(e===M.EOF){this._err(F.eofInDoctype);this._createDoctypeToken(null);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._createDoctypeToken(Ge(e));this.state=zl}}[zl](e){if(Be(e)){this.state=NS}else if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(Mn(e)){this.currentToken.name+=Gi(e)}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.name+=ke.REPLACEMENT_CHARACTER}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.name+=Ge(e)}}[NS](e){if(Be(e)){return}if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else if(this._consumeSequenceIfMatch(Ls.PUBLIC_STRING,e,false)){this.state=FS}else if(this._consumeSequenceIfMatch(Ls.SYSTEM_STRING,e,false)){this.state=qS}else if(!this._ensureHibernation()){this._err(F.invalidCharacterSequenceAfterDoctypeName);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[FS](e){if(Be(e)){this.state=$S}else if(e===M.QUOTATION_MARK){this._err(F.missingWhitespaceAfterDoctypePublicKeyword);this.currentToken.publicId="";this.state=Ef}else if(e===M.APOSTROPHE){this._err(F.missingWhitespaceAfterDoctypePublicKeyword);this.currentToken.publicId="";this.state=Af}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingDoctypePublicIdentifier);this.currentToken.forceQuirks=true;this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingQuoteBeforeDoctypePublicIdentifier);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[$S](e){if(Be(e)){return}if(e===M.QUOTATION_MARK){this.currentToken.publicId="";this.state=Ef}else if(e===M.APOSTROPHE){this.currentToken.publicId="";this.state=Af}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingDoctypePublicIdentifier);this.currentToken.forceQuirks=true;this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingQuoteBeforeDoctypePublicIdentifier);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[Ef](e){if(e===M.QUOTATION_MARK){this.state=Rf}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.publicId+=ke.REPLACEMENT_CHARACTER}else if(e===M.GREATER_THAN_SIGN){this._err(F.abruptDoctypePublicIdentifier);this.currentToken.forceQuirks=true;this._emitCurrentToken();this.state=he}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.publicId+=Ge(e)}}[Af](e){if(e===M.APOSTROPHE){this.state=Rf}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.publicId+=ke.REPLACEMENT_CHARACTER}else if(e===M.GREATER_THAN_SIGN){this._err(F.abruptDoctypePublicIdentifier);this.currentToken.forceQuirks=true;this._emitCurrentToken();this.state=he}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.publicId+=Ge(e)}}[Rf](e){if(Be(e)){this.state=BS}else if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(e===M.QUOTATION_MARK){this._err(F.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);this.currentToken.systemId="";this.state=Ta}else if(e===M.APOSTROPHE){this._err(F.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);this.currentToken.systemId="";this.state=ba}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingQuoteBeforeDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[BS](e){if(Be(e)){return}if(e===M.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=he}else if(e===M.QUOTATION_MARK){this.currentToken.systemId="";this.state=Ta}else if(e===M.APOSTROPHE){this.currentToken.systemId="";this.state=ba}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingQuoteBeforeDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[qS](e){if(Be(e)){this.state=HS}else if(e===M.QUOTATION_MARK){this._err(F.missingWhitespaceAfterDoctypeSystemKeyword);this.currentToken.systemId="";this.state=Ta}else if(e===M.APOSTROPHE){this._err(F.missingWhitespaceAfterDoctypeSystemKeyword);this.currentToken.systemId="";this.state=ba}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingQuoteBeforeDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[HS](e){if(Be(e)){return}if(e===M.QUOTATION_MARK){this.currentToken.systemId="";this.state=Ta}else if(e===M.APOSTROPHE){this.currentToken.systemId="";this.state=ba}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingQuoteBeforeDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[Ta](e){if(e===M.QUOTATION_MARK){this.state=kf}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.systemId+=ke.REPLACEMENT_CHARACTER}else if(e===M.GREATER_THAN_SIGN){this._err(F.abruptDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this._emitCurrentToken();this.state=he}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.systemId+=Ge(e)}}[ba](e){if(e===M.APOSTROPHE){this.state=kf}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.systemId+=ke.REPLACEMENT_CHARACTER}else if(e===M.GREATER_THAN_SIGN){this._err(F.abruptDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this._emitCurrentToken();this.state=he}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.systemId+=Ge(e)}}[kf](e){if(Be(e)){return}if(e===M.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=he}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.unexpectedCharacterAfterDoctypeSystemIdentifier);this._reconsumeInState(ui)}}[ui](e){if(e===M.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=he}else if(e===M.NULL){this._err(F.unexpectedNullCharacter)}else if(e===M.EOF){this._emitCurrentToken();this._emitEOFToken()}}[Ql](e){if(e===M.RIGHT_SQUARE_BRACKET){this.state=US}else if(e===M.EOF){this._err(F.eofInCdata);this._emitEOFToken()}else{this._emitCodePoint(e)}}[US](e){if(e===M.RIGHT_SQUARE_BRACKET){this.state=KS}else{this._emitChars("]");this._reconsumeInState(Ql)}}[KS](e){if(e===M.GREATER_THAN_SIGN){this.state=he}else if(e===M.RIGHT_SQUARE_BRACKET){this._emitChars("]")}else{this._emitChars("]]");this._reconsumeInState(Ql)}}[Lr](e){this.tempBuff=[M.AMPERSAND];if(e===M.NUMBER_SIGN){this.tempBuff.push(e);this.state=VS}else if(Pf(e)){this._reconsumeInState(WS)}else{this._flushCodePointsConsumedAsCharacterReference();this._reconsumeInState(this.returnState)}}[WS](e){const t=this._matchNamedCharacterReference(e);if(this._ensureHibernation()){this.tempBuff=[M.AMPERSAND]}else if(t){const i=this.tempBuff[this.tempBuff.length-1]===M.SEMICOLON;if(!this._isCharacterReferenceAttributeQuirk(i)){if(!i){this._errOnNextCodePoint(F.missingSemicolonAfterCharacterReference)}this.tempBuff=t}this._flushCodePointsConsumedAsCharacterReference();this.state=this.returnState}else{this._flushCodePointsConsumedAsCharacterReference();this.state=jS}}[jS](e){if(Pf(e)){if(this._isCharacterReferenceInAttribute()){this.currentAttr.value+=Ge(e)}else{this._emitCodePoint(e)}}else{if(e===M.SEMICOLON){this._err(F.unknownNamedCharacterReference)}this._reconsumeInState(this.returnState)}}[VS](e){this.charRefCode=0;if(e===M.LATIN_SMALL_X||e===M.LATIN_CAPITAL_X){this.tempBuff.push(e);this.state=GS}else{this._reconsumeInState(zS)}}[GS](e){if(z_(e)){this._reconsumeInState(QS)}else{this._err(F.absenceOfDigitsInNumericCharacterReference);this._flushCodePointsConsumedAsCharacterReference();this._reconsumeInState(this.returnState)}}[zS](e){if(Ca(e)){this._reconsumeInState(YS)}else{this._err(F.absenceOfDigitsInNumericCharacterReference);this._flushCodePointsConsumedAsCharacterReference();this._reconsumeInState(this.returnState)}}[QS](e){if(nC(e)){this.charRefCode=this.charRefCode*16+e-55}else if(iC(e)){this.charRefCode=this.charRefCode*16+e-87}else if(Ca(e)){this.charRefCode=this.charRefCode*16+e-48}else if(e===M.SEMICOLON){this.state=va}else{this._err(F.missingSemicolonAfterCharacterReference);this._reconsumeInState(va)}}[YS](e){if(Ca(e)){this.charRefCode=this.charRefCode*10+e-48}else if(e===M.SEMICOLON){this.state=va}else{this._err(F.missingSemicolonAfterCharacterReference);this._reconsumeInState(va)}}[va](){if(this.charRefCode===M.NULL){this._err(F.nullCharacterReference);this.charRefCode=M.REPLACEMENT_CHARACTER}else if(this.charRefCode>1114111){this._err(F.characterReferenceOutsideUnicodeRange);this.charRefCode=M.REPLACEMENT_CHARACTER}else if(ke.isSurrogate(this.charRefCode)){this._err(F.surrogateCharacterReference);this.charRefCode=M.REPLACEMENT_CHARACTER}else if(ke.isUndefinedCodePoint(this.charRefCode)){this._err(F.noncharacterCharacterReference)}else if(ke.isControlCodePoint(this.charRefCode)||this.charRefCode===M.CARRIAGE_RETURN){this._err(F.controlCharacterReference);const e=V_[this.charRefCode];if(e){this.charRefCode=e}}this.tempBuff=[this.charRefCode];this._flushCodePointsConsumedAsCharacterReference();this._reconsumeInState(this.returnState)}};Dt.CHARACTER_TOKEN="CHARACTER_TOKEN";Dt.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN";Dt.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN";Dt.START_TAG_TOKEN="START_TAG_TOKEN";Dt.END_TAG_TOKEN="END_TAG_TOKEN";Dt.COMMENT_TOKEN="COMMENT_TOKEN";Dt.DOCTYPE_TOKEN="DOCTYPE_TOKEN";Dt.EOF_TOKEN="EOF_TOKEN";Dt.HIBERNATION_TOKEN="HIBERNATION_TOKEN";Dt.MODE={DATA:he,RCDATA:Or,RAWTEXT:Sa,SCRIPT_DATA:li,PLAINTEXT:tC};Dt.getTokenAttr=function(n,e){for(let t=n.attrs.length-1;t>=0;t--){if(n.attrs[t].name===e){return n.attrs[t].value}}return null};sC.exports=Dt});var Qi=ce(Dr=>{"use strict";var _f=Dr.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};Dr.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"};Dr.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};var H=Dr.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};Dr.SPECIAL_ELEMENTS={[_f.HTML]:{[H.ADDRESS]:true,[H.APPLET]:true,[H.AREA]:true,[H.ARTICLE]:true,[H.ASIDE]:true,[H.BASE]:true,[H.BASEFONT]:true,[H.BGSOUND]:true,[H.BLOCKQUOTE]:true,[H.BODY]:true,[H.BR]:true,[H.BUTTON]:true,[H.CAPTION]:true,[H.CENTER]:true,[H.COL]:true,[H.COLGROUP]:true,[H.DD]:true,[H.DETAILS]:true,[H.DIR]:true,[H.DIV]:true,[H.DL]:true,[H.DT]:true,[H.EMBED]:true,[H.FIELDSET]:true,[H.FIGCAPTION]:true,[H.FIGURE]:true,[H.FOOTER]:true,[H.FORM]:true,[H.FRAME]:true,[H.FRAMESET]:true,[H.H1]:true,[H.H2]:true,[H.H3]:true,[H.H4]:true,[H.H5]:true,[H.H6]:true,[H.HEAD]:true,[H.HEADER]:true,[H.HGROUP]:true,[H.HR]:true,[H.HTML]:true,[H.IFRAME]:true,[H.IMG]:true,[H.INPUT]:true,[H.LI]:true,[H.LINK]:true,[H.LISTING]:true,[H.MAIN]:true,[H.MARQUEE]:true,[H.MENU]:true,[H.META]:true,[H.NAV]:true,[H.NOEMBED]:true,[H.NOFRAMES]:true,[H.NOSCRIPT]:true,[H.OBJECT]:true,[H.OL]:true,[H.P]:true,[H.PARAM]:true,[H.PLAINTEXT]:true,[H.PRE]:true,[H.SCRIPT]:true,[H.SECTION]:true,[H.SELECT]:true,[H.SOURCE]:true,[H.STYLE]:true,[H.SUMMARY]:true,[H.TABLE]:true,[H.TBODY]:true,[H.TD]:true,[H.TEMPLATE]:true,[H.TEXTAREA]:true,[H.TFOOT]:true,[H.TH]:true,[H.THEAD]:true,[H.TITLE]:true,[H.TR]:true,[H.TRACK]:true,[H.UL]:true,[H.WBR]:true,[H.XMP]:true},[_f.MATHML]:{[H.MI]:true,[H.MO]:true,[H.MN]:true,[H.MS]:true,[H.MTEXT]:true,[H.ANNOTATION_XML]:true},[_f.SVG]:{[H.TITLE]:true,[H.FOREIGN_OBJECT]:true,[H.DESC]:true}}});var uC=ce((JY,aC)=>{"use strict";var oC=Qi();var W=oC.TAG_NAMES;var Pe=oC.NAMESPACES;function rC(n){switch(n.length){case 1:return n===W.P;case 2:return n===W.RB||n===W.RP||n===W.RT||n===W.DD||n===W.DT||n===W.LI;case 3:return n===W.RTC;case 6:return n===W.OPTION;case 8:return n===W.OPTGROUP}return false}function Q_(n){switch(n.length){case 1:return n===W.P;case 2:return n===W.RB||n===W.RP||n===W.RT||n===W.DD||n===W.DT||n===W.LI||n===W.TD||n===W.TH||n===W.TR;case 3:return n===W.RTC;case 5:return n===W.TBODY||n===W.TFOOT||n===W.THEAD;case 6:return n===W.OPTION;case 7:return n===W.CAPTION;case 8:return n===W.OPTGROUP||n===W.COLGROUP}return false}function Xl(n,e){switch(n.length){case 2:if(n===W.TD||n===W.TH){return e===Pe.HTML}else if(n===W.MI||n===W.MO||n===W.MN||n===W.MS){return e===Pe.MATHML}break;case 4:if(n===W.HTML){return e===Pe.HTML}else if(n===W.DESC){return e===Pe.SVG}break;case 5:if(n===W.TABLE){return e===Pe.HTML}else if(n===W.MTEXT){return e===Pe.MATHML}else if(n===W.TITLE){return e===Pe.SVG}break;case 6:return(n===W.APPLET||n===W.OBJECT)&&e===Pe.HTML;case 7:return(n===W.CAPTION||n===W.MARQUEE)&&e===Pe.HTML;case 8:return n===W.TEMPLATE&&e===Pe.HTML;case 13:return n===W.FOREIGN_OBJECT&&e===Pe.SVG;case 14:return n===W.ANNOTATION_XML&&e===Pe.MATHML}return false}var Lf=class{constructor(e,t){this.stackTop=-1;this.items=[];this.current=e;this.currentTagName=null;this.currentTmplContent=null;this.tmplCount=0;this.treeAdapter=t}_indexOf(e){let t=-1;for(let i=this.stackTop;i>=0;i--){if(this.items[i]===e){t=i;break}}return t}_isInTemplate(){return this.currentTagName===W.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===Pe.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop];this.currentTagName=this.current&&this.treeAdapter.getTagName(this.current);this.currentTmplContent=this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):null}push(e){this.items[++this.stackTop]=e;this._updateCurrentElement();if(this._isInTemplate()){this.tmplCount++}}pop(){this.stackTop--;if(this.tmplCount>0&&this._isInTemplate()){this.tmplCount--}this._updateCurrentElement()}replace(e,t){const i=this._indexOf(e);this.items[i]=t;if(i===this.stackTop){this._updateCurrentElement()}}insertAfter(e,t){const i=this._indexOf(e)+1;this.items.splice(i,0,t);if(i===++this.stackTop){this._updateCurrentElement()}}popUntilTagNamePopped(e){while(this.stackTop>-1){const t=this.currentTagName;const i=this.treeAdapter.getNamespaceURI(this.current);this.pop();if(t===e&&i===Pe.HTML){break}}}popUntilElementPopped(e){while(this.stackTop>-1){const t=this.current;this.pop();if(t===e){break}}}popUntilNumberedHeaderPopped(){while(this.stackTop>-1){const e=this.currentTagName;const t=this.treeAdapter.getNamespaceURI(this.current);this.pop();if(e===W.H1||e===W.H2||e===W.H3||e===W.H4||e===W.H5||e===W.H6&&t===Pe.HTML){break}}}popUntilTableCellPopped(){while(this.stackTop>-1){const e=this.currentTagName;const t=this.treeAdapter.getNamespaceURI(this.current);this.pop();if(e===W.TD||e===W.TH&&t===Pe.HTML){break}}}popAllUpToHtmlElement(){this.stackTop=0;this._updateCurrentElement()}clearBackToTableContext(){while(this.currentTagName!==W.TABLE&&this.currentTagName!==W.TEMPLATE&&this.currentTagName!==W.HTML||this.treeAdapter.getNamespaceURI(this.current)!==Pe.HTML){this.pop()}}clearBackToTableBodyContext(){while(this.currentTagName!==W.TBODY&&this.currentTagName!==W.TFOOT&&this.currentTagName!==W.THEAD&&this.currentTagName!==W.TEMPLATE&&this.currentTagName!==W.HTML||this.treeAdapter.getNamespaceURI(this.current)!==Pe.HTML){this.pop()}}clearBackToTableRowContext(){while(this.currentTagName!==W.TR&&this.currentTagName!==W.TEMPLATE&&this.currentTagName!==W.HTML||this.treeAdapter.getNamespaceURI(this.current)!==Pe.HTML){this.pop()}}remove(e){for(let t=this.stackTop;t>=0;t--){if(this.items[t]===e){this.items.splice(t,1);this.stackTop--;this._updateCurrentElement();break}}}tryPeekProperlyNestedBodyElement(){const e=this.items[1];return e&&this.treeAdapter.getTagName(e)===W.BODY?e:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e);return--t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.currentTagName===W.HTML}hasInScope(e){for(let t=this.stackTop;t>=0;t--){const i=this.treeAdapter.getTagName(this.items[t]);const s=this.treeAdapter.getNamespaceURI(this.items[t]);if(i===e&&s===Pe.HTML){return true}if(Xl(i,s)){return false}}return true}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const t=this.treeAdapter.getTagName(this.items[e]);const i=this.treeAdapter.getNamespaceURI(this.items[e]);if((t===W.H1||t===W.H2||t===W.H3||t===W.H4||t===W.H5||t===W.H6)&&i===Pe.HTML){return true}if(Xl(t,i)){return false}}return true}hasInListItemScope(e){for(let t=this.stackTop;t>=0;t--){const i=this.treeAdapter.getTagName(this.items[t]);const s=this.treeAdapter.getNamespaceURI(this.items[t]);if(i===e&&s===Pe.HTML){return true}if((i===W.UL||i===W.OL)&&s===Pe.HTML||Xl(i,s)){return false}}return true}hasInButtonScope(e){for(let t=this.stackTop;t>=0;t--){const i=this.treeAdapter.getTagName(this.items[t]);const s=this.treeAdapter.getNamespaceURI(this.items[t]);if(i===e&&s===Pe.HTML){return true}if(i===W.BUTTON&&s===Pe.HTML||Xl(i,s)){return false}}return true}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--){const i=this.treeAdapter.getTagName(this.items[t]);const s=this.treeAdapter.getNamespaceURI(this.items[t]);if(s!==Pe.HTML){continue}if(i===e){return true}if(i===W.TABLE||i===W.TEMPLATE||i===W.HTML){return false}}return true}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--){const t=this.treeAdapter.getTagName(this.items[e]);const i=this.treeAdapter.getNamespaceURI(this.items[e]);if(i!==Pe.HTML){continue}if(t===W.TBODY||t===W.THEAD||t===W.TFOOT){return true}if(t===W.TABLE||t===W.HTML){return false}}return true}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--){const i=this.treeAdapter.getTagName(this.items[t]);const s=this.treeAdapter.getNamespaceURI(this.items[t]);if(s!==Pe.HTML){continue}if(i===e){return true}if(i!==W.OPTION&&i!==W.OPTGROUP){return false}}return true}generateImpliedEndTags(){while(rC(this.currentTagName)){this.pop()}}generateImpliedEndTagsThoroughly(){while(Q_(this.currentTagName)){this.pop()}}generateImpliedEndTagsWithExclusion(e){while(rC(this.currentTagName)&&this.currentTagName!==e){this.pop()}}};aC.exports=Lf});var dC=ce((ZY,lC)=>{"use strict";var Jl=3;var wa=class n{constructor(e){this.length=0;this.entries=[];this.treeAdapter=e;this.bookmark=null}_getNoahArkConditionCandidates(e){const t=[];if(this.length>=Jl){const i=this.treeAdapter.getAttrList(e).length;const s=this.treeAdapter.getTagName(e);const r=this.treeAdapter.getNamespaceURI(e);for(let o=this.length-1;o>=0;o--){const a=this.entries[o];if(a.type===n.MARKER_ENTRY){break}const u=a.element;const l=this.treeAdapter.getAttrList(u);const d=this.treeAdapter.getTagName(u)===s&&this.treeAdapter.getNamespaceURI(u)===r&&l.length===i;if(d){t.push({idx:o,attrs:l})}}}return t.length<Jl?[]:t}_ensureNoahArkCondition(e){const t=this._getNoahArkConditionCandidates(e);let i=t.length;if(i){const s=this.treeAdapter.getAttrList(e);const r=s.length;const o=Object.create(null);for(let a=0;a<r;a++){const u=s[a];o[u.name]=u.value}for(let a=0;a<r;a++){for(let u=0;u<i;u++){const l=t[u].attrs[a];if(o[l.name]!==l.value){t.splice(u,1);i--}if(t.length<Jl){return}}}for(let a=i-1;a>=Jl-1;a--){this.entries.splice(t[a].idx,1);this.length--}}}insertMarker(){this.entries.push({type:n.MARKER_ENTRY});this.length++}pushElement(e,t){this._ensureNoahArkCondition(e);this.entries.push({type:n.ELEMENT_ENTRY,element:e,token:t});this.length++}insertElementAfterBookmark(e,t){let i=this.length-1;for(;i>=0;i--){if(this.entries[i]===this.bookmark){break}}this.entries.splice(i+1,0,{type:n.ELEMENT_ENTRY,element:e,token:t});this.length++}removeEntry(e){for(let t=this.length-1;t>=0;t--){if(this.entries[t]===e){this.entries.splice(t,1);this.length--;break}}}clearToLastMarker(){while(this.length){const e=this.entries.pop();this.length--;if(e.type===n.MARKER_ENTRY){break}}}getElementEntryInScopeWithTagName(e){for(let t=this.length-1;t>=0;t--){const i=this.entries[t];if(i.type===n.MARKER_ENTRY){return null}if(this.treeAdapter.getTagName(i.element)===e){return i}}return null}getElementEntry(e){for(let t=this.length-1;t>=0;t--){const i=this.entries[t];if(i.type===n.ELEMENT_ENTRY&&i.element===e){return i}}return null}};wa.MARKER_ENTRY="MARKER_ENTRY";wa.ELEMENT_ENTRY="ELEMENT_ENTRY";lC.exports=wa});var Wn=ce((eX,cC)=>{"use strict";var Zl=class{constructor(e){const t={};const i=this._getOverriddenMethods(this,t);for(const s of Object.keys(i)){if(typeof i[s]==="function"){t[s]=e[s];e[s]=i[s]}}}_getOverriddenMethods(){throw new Error("Not implemented")}};Zl.install=function(n,e,t){if(!n.__mixins){n.__mixins=[]}for(let s=0;s<n.__mixins.length;s++){if(n.__mixins[s].constructor===e){return n.__mixins[s]}}const i=new e(n,t);n.__mixins.push(i);return i};cC.exports=Zl});var Df=ce((tX,hC)=>{"use strict";var Y_=Wn();var Of=class extends Y_{constructor(e){super(e);this.preprocessor=e;this.isEol=false;this.lineStartPos=0;this.droppedBufferSize=0;this.offset=0;this.col=0;this.line=1}_getOverriddenMethods(e,t){return{advance(){const i=this.pos+1;const s=this.html[i];if(e.isEol){e.isEol=false;e.line++;e.lineStartPos=i}if(s==="\n"||s==="\r"&&this.html[i+1]!=="\n"){e.isEol=true}e.col=i-e.lineStartPos+1;e.offset=e.droppedBufferSize+i;return t.advance.call(this)},retreat(){t.retreat.call(this);e.isEol=false;e.col=this.pos-e.lineStartPos+1},dropParsedChunk(){const i=this.pos;t.dropParsedChunk.call(this);const s=i-this.pos;e.lineStartPos-=s;e.droppedBufferSize+=s;e.offset=e.droppedBufferSize+this.pos}}}};hC.exports=Of});var $f=ce((nX,mC)=>{"use strict";var pC=Wn();var Nf=xa();var X_=Df();var Ff=class extends pC{constructor(e){super(e);this.tokenizer=e;this.posTracker=pC.install(e.preprocessor,X_);this.currentAttrLocation=null;this.ctLoc=null}_getCurrentLocation(){return{startLine:this.posTracker.line,startCol:this.posTracker.col,startOffset:this.posTracker.offset,endLine:-1,endCol:-1,endOffset:-1}}_attachCurrentAttrLocationInfo(){this.currentAttrLocation.endLine=this.posTracker.line;this.currentAttrLocation.endCol=this.posTracker.col;this.currentAttrLocation.endOffset=this.posTracker.offset;const e=this.tokenizer.currentToken;const t=this.tokenizer.currentAttr;if(!e.location.attrs){e.location.attrs=Object.create(null)}e.location.attrs[t.name]=this.currentAttrLocation}_getOverriddenMethods(e,t){const i={_createStartTagToken(){t._createStartTagToken.call(this);this.currentToken.location=e.ctLoc},_createEndTagToken(){t._createEndTagToken.call(this);this.currentToken.location=e.ctLoc},_createCommentToken(){t._createCommentToken.call(this);this.currentToken.location=e.ctLoc},_createDoctypeToken(s){t._createDoctypeToken.call(this,s);this.currentToken.location=e.ctLoc},_createCharacterToken(s,r){t._createCharacterToken.call(this,s,r);this.currentCharacterToken.location=e.ctLoc},_createEOFToken(){t._createEOFToken.call(this);this.currentToken.location=e._getCurrentLocation()},_createAttr(s){t._createAttr.call(this,s);e.currentAttrLocation=e._getCurrentLocation()},_leaveAttrName(s){t._leaveAttrName.call(this,s);e._attachCurrentAttrLocationInfo()},_leaveAttrValue(s){t._leaveAttrValue.call(this,s);e._attachCurrentAttrLocationInfo()},_emitCurrentToken(){const s=this.currentToken.location;if(this.currentCharacterToken){this.currentCharacterToken.location.endLine=s.startLine;this.currentCharacterToken.location.endCol=s.startCol;this.currentCharacterToken.location.endOffset=s.startOffset}if(this.currentToken.type===Nf.EOF_TOKEN){s.endLine=s.startLine;s.endCol=s.startCol;s.endOffset=s.startOffset}else{s.endLine=e.posTracker.line;s.endCol=e.posTracker.col+1;s.endOffset=e.posTracker.offset+1}t._emitCurrentToken.call(this)},_emitCurrentCharacterToken(){const s=this.currentCharacterToken&&this.currentCharacterToken.location;if(s&&s.endOffset===-1){s.endLine=e.posTracker.line;s.endCol=e.posTracker.col;s.endOffset=e.posTracker.offset}t._emitCurrentCharacterToken.call(this)}};Object.keys(Nf.MODE).forEach(s=>{const r=Nf.MODE[s];i[r]=function(o){e.ctLoc=e._getCurrentLocation();t[r].call(this,o)}});return i}};mC.exports=Ff});var gC=ce((iX,fC)=>{"use strict";var J_=Wn();var Bf=class extends J_{constructor(e,t){super(e);this.onItemPop=t.onItemPop}_getOverriddenMethods(e,t){return{pop(){e.onItemPop(this.current);t.pop.call(this)},popAllUpToHtmlElement(){for(let i=this.stackTop;i>0;i--){e.onItemPop(this.items[i])}t.popAllUpToHtmlElement.call(this)},remove(i){e.onItemPop(this.current);t.remove.call(this,i)}}}};fC.exports=Bf});var bC=ce((sX,TC)=>{"use strict";var qf=Wn();var yC=xa();var Z_=$f();var e8=gC();var t8=Qi();var Hf=t8.TAG_NAMES;var Uf=class extends qf{constructor(e){super(e);this.parser=e;this.treeAdapter=this.parser.treeAdapter;this.posTracker=null;this.lastStartTagToken=null;this.lastFosterParentingLocation=null;this.currentToken=null}_setStartLocation(e){let t=null;if(this.lastStartTagToken){t=Object.assign({},this.lastStartTagToken.location);t.startTag=this.lastStartTagToken.location}this.treeAdapter.setNodeSourceCodeLocation(e,t)}_setEndLocation(e,t){const i=this.treeAdapter.getNodeSourceCodeLocation(e);if(i){if(t.location){const s=t.location;const r=this.treeAdapter.getTagName(e);const o=t.type===yC.END_TAG_TOKEN&&r===t.tagName;if(o){i.endTag=Object.assign({},s);i.endLine=s.endLine;i.endCol=s.endCol;i.endOffset=s.endOffset}else{i.endLine=s.startLine;i.endCol=s.startCol;i.endOffset=s.startOffset}}}}_getOverriddenMethods(e,t){return{_bootstrap(i,s){t._bootstrap.call(this,i,s);e.lastStartTagToken=null;e.lastFosterParentingLocation=null;e.currentToken=null;const r=qf.install(this.tokenizer,Z_);e.posTracker=r.posTracker;qf.install(this.openElements,e8,{onItemPop:function(o){e._setEndLocation(o,e.currentToken)}})},_runParsingLoop(i){t._runParsingLoop.call(this,i);for(let s=this.openElements.stackTop;s>=0;s--){e._setEndLocation(this.openElements.items[s],e.currentToken)}},_processTokenInForeignContent(i){e.currentToken=i;t._processTokenInForeignContent.call(this,i)},_processToken(i){e.currentToken=i;t._processToken.call(this,i);const s=i.type===yC.END_TAG_TOKEN&&(i.tagName===Hf.HTML||i.tagName===Hf.BODY&&this.openElements.hasInScope(Hf.BODY));if(s){for(let r=this.openElements.stackTop;r>=0;r--){const o=this.openElements.items[r];if(this.treeAdapter.getTagName(o)===i.tagName){e._setEndLocation(o,i);break}}}},_setDocumentType(i){t._setDocumentType.call(this,i);const s=this.treeAdapter.getChildNodes(this.document);const r=s.length;for(let o=0;o<r;o++){const a=s[o];if(this.treeAdapter.isDocumentTypeNode(a)){this.treeAdapter.setNodeSourceCodeLocation(a,i.location);break}}},_attachElementToTree(i){e._setStartLocation(i);e.lastStartTagToken=null;t._attachElementToTree.call(this,i)},_appendElement(i,s){e.lastStartTagToken=i;t._appendElement.call(this,i,s)},_insertElement(i,s){e.lastStartTagToken=i;t._insertElement.call(this,i,s)},_insertTemplate(i){e.lastStartTagToken=i;t._insertTemplate.call(this,i);const s=this.treeAdapter.getTemplateContent(this.openElements.current);this.treeAdapter.setNodeSourceCodeLocation(s,null)},_insertFakeRootElement(){t._insertFakeRootElement.call(this);this.treeAdapter.setNodeSourceCodeLocation(this.openElements.current,null)},_appendCommentNode(i,s){t._appendCommentNode.call(this,i,s);const r=this.treeAdapter.getChildNodes(s);const o=r[r.length-1];this.treeAdapter.setNodeSourceCodeLocation(o,i.location)},_findFosterParentingLocation(){e.lastFosterParentingLocation=t._findFosterParentingLocation.call(this);return e.lastFosterParentingLocation},_insertCharacters(i){t._insertCharacters.call(this,i);const s=this._shouldFosterParentOnInsertion();const r=s&&e.lastFosterParentingLocation.parent||this.openElements.currentTmplContent||this.openElements.current;const o=this.treeAdapter.getChildNodes(r);const a=s&&e.lastFosterParentingLocation.beforeElement?o.indexOf(e.lastFosterParentingLocation.beforeElement)-1:o.length-1;const u=o[a];const l=this.treeAdapter.getNodeSourceCodeLocation(u);if(l){l.endLine=i.location.endLine;l.endCol=i.location.endCol;l.endOffset=i.location.endOffset}else{this.treeAdapter.setNodeSourceCodeLocation(u,i.location)}}}}};TC.exports=Uf});var ed=ce((rX,vC)=>{"use strict";var n8=Wn();var Kf=class extends n8{constructor(e,t){super(e);this.posTracker=null;this.onParseError=t.onParseError}_setErrorLocation(e){e.startLine=e.endLine=this.posTracker.line;e.startCol=e.endCol=this.posTracker.col;e.startOffset=e.endOffset=this.posTracker.offset}_reportError(e){const t={code:e,startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1};this._setErrorLocation(t);this.onParseError(t)}_getOverriddenMethods(e){return{_err(t){e._reportError(t)}}}};vC.exports=Kf});var CC=ce((oX,SC)=>{"use strict";var i8=ed();var s8=Df();var r8=Wn();var Wf=class extends i8{constructor(e,t){super(e,t);this.posTracker=r8.install(e,s8);this.lastErrOffset=-1}_reportError(e){if(this.lastErrOffset!==this.posTracker.offset){this.lastErrOffset=this.posTracker.offset;super._reportError(e)}}};SC.exports=Wf});var wC=ce((aX,xC)=>{"use strict";var o8=ed();var a8=CC();var u8=Wn();var jf=class extends o8{constructor(e,t){super(e,t);const i=u8.install(e.preprocessor,a8,t);this.posTracker=i.posTracker}};xC.exports=jf});var EC=ce((uX,MC)=>{"use strict";var l8=ed();var d8=wC();var c8=$f();var IC=Wn();var Vf=class extends l8{constructor(e,t){super(e,t);this.opts=t;this.ctLoc=null;this.locBeforeToken=false}_setErrorLocation(e){if(this.ctLoc){e.startLine=this.ctLoc.startLine;e.startCol=this.ctLoc.startCol;e.startOffset=this.ctLoc.startOffset;e.endLine=this.locBeforeToken?this.ctLoc.startLine:this.ctLoc.endLine;e.endCol=this.locBeforeToken?this.ctLoc.startCol:this.ctLoc.endCol;e.endOffset=this.locBeforeToken?this.ctLoc.startOffset:this.ctLoc.endOffset}}_getOverriddenMethods(e,t){return{_bootstrap(i,s){t._bootstrap.call(this,i,s);IC.install(this.tokenizer,d8,e.opts);IC.install(this.tokenizer,c8)},_processInputToken(i){e.ctLoc=i.location;t._processInputToken.call(this,i)},_err(i,s){e.locBeforeToken=s&&s.beforeToken;e._reportError(i)}}}};MC.exports=Vf});var Gf=ce(Se=>{"use strict";var{DOCUMENT_MODE:h8}=Qi();Se.createDocument=function(){return{nodeName:"#document",mode:h8.NO_QUIRKS,childNodes:[]}};Se.createDocumentFragment=function(){return{nodeName:"#document-fragment",childNodes:[]}};Se.createElement=function(n,e,t){return{nodeName:n,tagName:n,attrs:t,namespaceURI:e,childNodes:[],parentNode:null}};Se.createCommentNode=function(n){return{nodeName:"#comment",data:n,parentNode:null}};var AC=function(n){return{nodeName:"#text",value:n,parentNode:null}};var RC=Se.appendChild=function(n,e){n.childNodes.push(e);e.parentNode=n};var p8=Se.insertBefore=function(n,e,t){const i=n.childNodes.indexOf(t);n.childNodes.splice(i,0,e);e.parentNode=n};Se.setTemplateContent=function(n,e){n.content=e};Se.getTemplateContent=function(n){return n.content};Se.setDocumentType=function(n,e,t,i){let s=null;for(let r=0;r<n.childNodes.length;r++){if(n.childNodes[r].nodeName==="#documentType"){s=n.childNodes[r];break}}if(s){s.name=e;s.publicId=t;s.systemId=i}else{RC(n,{nodeName:"#documentType",name:e,publicId:t,systemId:i})}};Se.setDocumentMode=function(n,e){n.mode=e};Se.getDocumentMode=function(n){return n.mode};Se.detachNode=function(n){if(n.parentNode){const e=n.parentNode.childNodes.indexOf(n);n.parentNode.childNodes.splice(e,1);n.parentNode=null}};Se.insertText=function(n,e){if(n.childNodes.length){const t=n.childNodes[n.childNodes.length-1];if(t.nodeName==="#text"){t.value+=e;return}}RC(n,AC(e))};Se.insertTextBefore=function(n,e,t){const i=n.childNodes[n.childNodes.indexOf(t)-1];if(i&&i.nodeName==="#text"){i.value+=e}else{p8(n,AC(e),t)}};Se.adoptAttributes=function(n,e){const t=[];for(let i=0;i<n.attrs.length;i++){t.push(n.attrs[i].name)}for(let i=0;i<e.length;i++){if(t.indexOf(e[i].name)===-1){n.attrs.push(e[i])}}};Se.getFirstChild=function(n){return n.childNodes[0]};Se.getChildNodes=function(n){return n.childNodes};Se.getParentNode=function(n){return n.parentNode};Se.getAttrList=function(n){return n.attrs};Se.getTagName=function(n){return n.tagName};Se.getNamespaceURI=function(n){return n.namespaceURI};Se.getTextNodeContent=function(n){return n.value};Se.getCommentNodeContent=function(n){return n.data};Se.getDocumentTypeNodeName=function(n){return n.name};Se.getDocumentTypeNodePublicId=function(n){return n.publicId};Se.getDocumentTypeNodeSystemId=function(n){return n.systemId};Se.isTextNode=function(n){return n.nodeName==="#text"};Se.isCommentNode=function(n){return n.nodeName==="#comment"};Se.isDocumentTypeNode=function(n){return n.nodeName==="#documentType"};Se.isElementNode=function(n){return!!n.tagName};Se.setNodeSourceCodeLocation=function(n,e){n.sourceCodeLocation=e};Se.getNodeSourceCodeLocation=function(n){return n.sourceCodeLocation}});var zf=ce((dX,kC)=>{"use strict";kC.exports=function n(e,t){t=t||Object.create(null);return[e,t].reduce((i,s)=>{Object.keys(s).forEach(r=>{i[r]=s[r]});return i},Object.create(null))}});var Qf=ce(td=>{"use strict";var{DOCUMENT_MODE:Nr}=Qi();var LC="html";var m8="about:legacy-compat";var f8="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd";var OC=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"];var g8=OC.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);var y8=["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"];var DC=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"];var T8=DC.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);function PC(n){const e=n.indexOf('"')!==-1?"'":'"';return e+n+e}function _C(n,e){for(let t=0;t<e.length;t++){if(n.indexOf(e[t])===0){return true}}return false}td.isConforming=function(n){return n.name===LC&&n.publicId===null&&(n.systemId===null||n.systemId===m8)};td.getDocumentMode=function(n){if(n.name!==LC){return Nr.QUIRKS}const e=n.systemId;if(e&&e.toLowerCase()===f8){return Nr.QUIRKS}let t=n.publicId;if(t!==null){t=t.toLowerCase();if(y8.indexOf(t)>-1){return Nr.QUIRKS}let i=e===null?g8:OC;if(_C(t,i)){return Nr.QUIRKS}i=e===null?DC:T8;if(_C(t,i)){return Nr.LIMITED_QUIRKS}}return Nr.NO_QUIRKS};td.serializeContent=function(n,e,t){let i="!DOCTYPE ";if(n){i+=n}if(e){i+=" PUBLIC "+PC(e)}else if(t){i+=" SYSTEM"}if(t!==null){i+=" "+PC(t)}return i}});var FC=ce(Yi=>{"use strict";var Yf=xa();var Xf=Qi();var ne=Xf.TAG_NAMES;var ht=Xf.NAMESPACES;var nd=Xf.ATTRS;var NC={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"};var b8="definitionurl";var v8="definitionURL";var S8={attributename:"attributeName",attributetype:"attributeType",basefrequency:"baseFrequency",baseprofile:"baseProfile",calcmode:"calcMode",clippathunits:"clipPathUnits",diffuseconstant:"diffuseConstant",edgemode:"edgeMode",filterunits:"filterUnits",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",limitingconeangle:"limitingConeAngle",markerheight:"markerHeight",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textlength:"textLength",viewbox:"viewBox",viewtarget:"viewTarget",xchannelselector:"xChannelSelector",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan"};var C8={"xlink:actuate":{prefix:"xlink",name:"actuate",namespace:ht.XLINK},"xlink:arcrole":{prefix:"xlink",name:"arcrole",namespace:ht.XLINK},"xlink:href":{prefix:"xlink",name:"href",namespace:ht.XLINK},"xlink:role":{prefix:"xlink",name:"role",namespace:ht.XLINK},"xlink:show":{prefix:"xlink",name:"show",namespace:ht.XLINK},"xlink:title":{prefix:"xlink",name:"title",namespace:ht.XLINK},"xlink:type":{prefix:"xlink",name:"type",namespace:ht.XLINK},"xml:base":{prefix:"xml",name:"base",namespace:ht.XML},"xml:lang":{prefix:"xml",name:"lang",namespace:ht.XML},"xml:space":{prefix:"xml",name:"space",namespace:ht.XML},xmlns:{prefix:"",name:"xmlns",namespace:ht.XMLNS},"xmlns:xlink":{prefix:"xmlns",name:"xlink",namespace:ht.XMLNS}};var x8=Yi.SVG_TAG_NAMES_ADJUSTMENT_MAP={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath"};var w8={[ne.B]:true,[ne.BIG]:true,[ne.BLOCKQUOTE]:true,[ne.BODY]:true,[ne.BR]:true,[ne.CENTER]:true,[ne.CODE]:true,[ne.DD]:true,[ne.DIV]:true,[ne.DL]:true,[ne.DT]:true,[ne.EM]:true,[ne.EMBED]:true,[ne.H1]:true,[ne.H2]:true,[ne.H3]:true,[ne.H4]:true,[ne.H5]:true,[ne.H6]:true,[ne.HEAD]:true,[ne.HR]:true,[ne.I]:true,[ne.IMG]:true,[ne.LI]:true,[ne.LISTING]:true,[ne.MENU]:true,[ne.META]:true,[ne.NOBR]:true,[ne.OL]:true,[ne.P]:true,[ne.PRE]:true,[ne.RUBY]:true,[ne.S]:true,[ne.SMALL]:true,[ne.SPAN]:true,[ne.STRONG]:true,[ne.STRIKE]:true,[ne.SUB]:true,[ne.SUP]:true,[ne.TABLE]:true,[ne.TT]:true,[ne.U]:true,[ne.UL]:true,[ne.VAR]:true};Yi.causesExit=function(n){const e=n.tagName;const t=e===ne.FONT&&(Yf.getTokenAttr(n,nd.COLOR)!==null||Yf.getTokenAttr(n,nd.SIZE)!==null||Yf.getTokenAttr(n,nd.FACE)!==null);return t?true:w8[e]};Yi.adjustTokenMathMLAttrs=function(n){for(let e=0;e<n.attrs.length;e++){if(n.attrs[e].name===b8){n.attrs[e].name=v8;break}}};Yi.adjustTokenSVGAttrs=function(n){for(let e=0;e<n.attrs.length;e++){const t=S8[n.attrs[e].name];if(t){n.attrs[e].name=t}}};Yi.adjustTokenXMLAttrs=function(n){for(let e=0;e<n.attrs.length;e++){const t=C8[n.attrs[e].name];if(t){n.attrs[e].prefix=t.prefix;n.attrs[e].name=t.name;n.attrs[e].namespace=t.namespace}}};Yi.adjustTokenSVGTagName=function(n){const e=x8[n.tagName];if(e){n.tagName=e}};function I8(n,e){return e===ht.MATHML&&(n===ne.MI||n===ne.MO||n===ne.MN||n===ne.MS||n===ne.MTEXT)}function M8(n,e,t){if(e===ht.MATHML&&n===ne.ANNOTATION_XML){for(let i=0;i<t.length;i++){if(t[i].name===nd.ENCODING){const s=t[i].value.toLowerCase();return s===NC.TEXT_HTML||s===NC.APPLICATION_XML}}}return e===ht.SVG&&(n===ne.FOREIGN_OBJECT||n===ne.DESC||n===ne.TITLE)}Yi.isIntegrationPoint=function(n,e,t,i){if((!i||i===ht.HTML)&&M8(n,e,t)){return true}if((!i||i===ht.MATHML)&&I8(n,e)){return true}return false}});var ux=ce((pX,ax)=>{"use strict";var A=xa();var E8=uC();var $C=dC();var A8=bC();var R8=EC();var BC=Wn();var k8=Gf();var P8=zf();var qC=Qf();var jn=FC();var pt=$l();var _8=Fl();var Fs=Qi();var g=Fs.TAG_NAMES;var X=Fs.NAMESPACES;var YC=Fs.ATTRS;var L8={scriptingEnabled:true,sourceCodeLocationInfo:false,onParseError:null,treeAdapter:k8};var XC="hidden";var O8=8;var D8=3;var JC="INITIAL_MODE";var Zf="BEFORE_HTML_MODE";var dd="BEFORE_HEAD_MODE";var Br="IN_HEAD_MODE";var ZC="IN_HEAD_NO_SCRIPT_MODE";var cd="AFTER_HEAD_MODE";var Vn="IN_BODY_MODE";var od="TEXT_MODE";var Ct="IN_TABLE_MODE";var ex="IN_TABLE_TEXT_MODE";var hd="IN_CAPTION_MODE";var La="IN_COLUMN_GROUP_MODE";var mn="IN_TABLE_BODY_MODE";var pi="IN_ROW_MODE";var pd="IN_CELL_MODE";var e1="IN_SELECT_MODE";var t1="IN_SELECT_IN_TABLE_MODE";var ad="IN_TEMPLATE_MODE";var n1="AFTER_BODY_MODE";var md="IN_FRAMESET_MODE";var tx="AFTER_FRAMESET_MODE";var nx="AFTER_AFTER_BODY_MODE";var ix="AFTER_AFTER_FRAMESET_MODE";var N8={[g.TR]:pi,[g.TBODY]:mn,[g.THEAD]:mn,[g.TFOOT]:mn,[g.CAPTION]:hd,[g.COLGROUP]:La,[g.TABLE]:Ct,[g.BODY]:Vn,[g.FRAMESET]:md};var F8={[g.CAPTION]:Ct,[g.COLGROUP]:Ct,[g.TBODY]:Ct,[g.TFOOT]:Ct,[g.THEAD]:Ct,[g.COL]:La,[g.TR]:mn,[g.TD]:pi,[g.TH]:pi};var HC={[JC]:{[A.CHARACTER_TOKEN]:Ma,[A.NULL_CHARACTER_TOKEN]:Ma,[A.WHITESPACE_CHARACTER_TOKEN]:fe,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:j8,[A.START_TAG_TOKEN]:Ma,[A.END_TAG_TOKEN]:Ma,[A.EOF_TOKEN]:Ma},[Zf]:{[A.CHARACTER_TOKEN]:Aa,[A.NULL_CHARACTER_TOKEN]:Aa,[A.WHITESPACE_CHARACTER_TOKEN]:fe,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:V8,[A.END_TAG_TOKEN]:G8,[A.EOF_TOKEN]:Aa},[dd]:{[A.CHARACTER_TOKEN]:Ra,[A.NULL_CHARACTER_TOKEN]:Ra,[A.WHITESPACE_CHARACTER_TOKEN]:fe,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:id,[A.START_TAG_TOKEN]:z8,[A.END_TAG_TOKEN]:Q8,[A.EOF_TOKEN]:Ra},[Br]:{[A.CHARACTER_TOKEN]:ka,[A.NULL_CHARACTER_TOKEN]:ka,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:id,[A.START_TAG_TOKEN]:rt,[A.END_TAG_TOKEN]:$s,[A.EOF_TOKEN]:ka},[ZC]:{[A.CHARACTER_TOKEN]:Pa,[A.NULL_CHARACTER_TOKEN]:Pa,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:id,[A.START_TAG_TOKEN]:Y8,[A.END_TAG_TOKEN]:X8,[A.EOF_TOKEN]:Pa},[cd]:{[A.CHARACTER_TOKEN]:_a,[A.NULL_CHARACTER_TOKEN]:_a,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:id,[A.START_TAG_TOKEN]:J8,[A.END_TAG_TOKEN]:Z8,[A.EOF_TOKEN]:_a},[Vn]:{[A.CHARACTER_TOKEN]:sd,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:Ft,[A.END_TAG_TOKEN]:i1,[A.EOF_TOKEN]:ci},[od]:{[A.CHARACTER_TOKEN]:Nt,[A.NULL_CHARACTER_TOKEN]:Nt,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:fe,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:fe,[A.END_TAG_TOKEN]:kL,[A.EOF_TOKEN]:PL},[Ct]:{[A.CHARACTER_TOKEN]:hi,[A.NULL_CHARACTER_TOKEN]:hi,[A.WHITESPACE_CHARACTER_TOKEN]:hi,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:s1,[A.END_TAG_TOKEN]:r1,[A.EOF_TOKEN]:ci},[ex]:{[A.CHARACTER_TOKEN]:HL,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:qL,[A.COMMENT_TOKEN]:Ea,[A.DOCTYPE_TOKEN]:Ea,[A.START_TAG_TOKEN]:Ea,[A.END_TAG_TOKEN]:Ea,[A.EOF_TOKEN]:Ea},[hd]:{[A.CHARACTER_TOKEN]:sd,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:UL,[A.END_TAG_TOKEN]:KL,[A.EOF_TOKEN]:ci},[La]:{[A.CHARACTER_TOKEN]:ud,[A.NULL_CHARACTER_TOKEN]:ud,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:WL,[A.END_TAG_TOKEN]:jL,[A.EOF_TOKEN]:ci},[mn]:{[A.CHARACTER_TOKEN]:hi,[A.NULL_CHARACTER_TOKEN]:hi,[A.WHITESPACE_CHARACTER_TOKEN]:hi,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:VL,[A.END_TAG_TOKEN]:GL,[A.EOF_TOKEN]:ci},[pi]:{[A.CHARACTER_TOKEN]:hi,[A.NULL_CHARACTER_TOKEN]:hi,[A.WHITESPACE_CHARACTER_TOKEN]:hi,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:zL,[A.END_TAG_TOKEN]:QL,[A.EOF_TOKEN]:ci},[pd]:{[A.CHARACTER_TOKEN]:sd,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:YL,[A.END_TAG_TOKEN]:XL,[A.EOF_TOKEN]:ci},[e1]:{[A.CHARACTER_TOKEN]:Nt,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:sx,[A.END_TAG_TOKEN]:rx,[A.EOF_TOKEN]:ci},[t1]:{[A.CHARACTER_TOKEN]:Nt,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:JL,[A.END_TAG_TOKEN]:ZL,[A.EOF_TOKEN]:ci},[ad]:{[A.CHARACTER_TOKEN]:sd,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:eO,[A.END_TAG_TOKEN]:tO,[A.EOF_TOKEN]:ox},[n1]:{[A.CHARACTER_TOKEN]:ld,[A.NULL_CHARACTER_TOKEN]:ld,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:W8,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:nO,[A.END_TAG_TOKEN]:iO,[A.EOF_TOKEN]:Ia},[md]:{[A.CHARACTER_TOKEN]:fe,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:sO,[A.END_TAG_TOKEN]:rO,[A.EOF_TOKEN]:Ia},[tx]:{[A.CHARACTER_TOKEN]:fe,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:oO,[A.END_TAG_TOKEN]:aO,[A.EOF_TOKEN]:Ia},[nx]:{[A.CHARACTER_TOKEN]:rd,[A.NULL_CHARACTER_TOKEN]:rd,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:UC,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:uO,[A.END_TAG_TOKEN]:rd,[A.EOF_TOKEN]:Ia},[ix]:{[A.CHARACTER_TOKEN]:fe,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:UC,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:lO,[A.END_TAG_TOKEN]:fe,[A.EOF_TOKEN]:Ia}};var Jf=class{constructor(e){this.options=P8(L8,e);this.treeAdapter=this.options.treeAdapter;this.pendingScript=null;if(this.options.sourceCodeLocationInfo){BC.install(this,A8)}if(this.options.onParseError){BC.install(this,R8,{onParseError:this.options.onParseError})}}parse(e){const t=this.treeAdapter.createDocument();this._bootstrap(t,null);this.tokenizer.write(e,true);this._runParsingLoop(null);return t}parseFragment(e,t){if(!t){t=this.treeAdapter.createElement(g.TEMPLATE,X.HTML,[])}const i=this.treeAdapter.createElement("documentmock",X.HTML,[]);this._bootstrap(i,t);if(this.treeAdapter.getTagName(t)===g.TEMPLATE){this._pushTmplInsertionMode(ad)}this._initTokenizerForFragmentParsing();this._insertFakeRootElement();this._resetInsertionMode();this._findFormInFragmentContext();this.tokenizer.write(e,true);this._runParsingLoop(null);const s=this.treeAdapter.getFirstChild(i);const r=this.treeAdapter.createDocumentFragment();this._adoptNodes(s,r);return r}_bootstrap(e,t){this.tokenizer=new A(this.options);this.stopped=false;this.insertionMode=JC;this.originalInsertionMode="";this.document=e;this.fragmentContext=t;this.headElement=null;this.formElement=null;this.openElements=new E8(this.document,this.treeAdapter);this.activeFormattingElements=new $C(this.treeAdapter);this.tmplInsertionModeStack=[];this.tmplInsertionModeStackTop=-1;this.currentTmplInsertionMode=null;this.pendingCharacterTokens=[];this.hasNonWhitespacePendingCharacterToken=false;this.framesetOk=true;this.skipNextNewLine=false;this.fosterParentingEnabled=false}_err(){}_runParsingLoop(e){while(!this.stopped){this._setupTokenizerCDATAMode();const t=this.tokenizer.getNextToken();if(t.type===A.HIBERNATION_TOKEN){break}if(this.skipNextNewLine){this.skipNextNewLine=false;if(t.type===A.WHITESPACE_CHARACTER_TOKEN&&t.chars[0]==="\n"){if(t.chars.length===1){continue}t.chars=t.chars.substr(1)}}this._processInputToken(t);if(e&&this.pendingScript){break}}}runParsingLoopForCurrentChunk(e,t){this._runParsingLoop(t);if(t&&this.pendingScript){const i=this.pendingScript;this.pendingScript=null;t(i);return}if(e){e()}}_setupTokenizerCDATAMode(){const e=this._getAdjustedCurrentElement();this.tokenizer.allowCDATA=e&&e!==this.document&&this.treeAdapter.getNamespaceURI(e)!==X.HTML&&!this._isIntegrationPoint(e)}_switchToTextParsing(e,t){this._insertElement(e,X.HTML);this.tokenizer.state=t;this.originalInsertionMode=this.insertionMode;this.insertionMode=od}switchToPlaintextParsing(){this.insertionMode=od;this.originalInsertionMode=Vn;this.tokenizer.state=A.MODE.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;do{if(this.treeAdapter.getTagName(e)===g.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}while(e)}_initTokenizerForFragmentParsing(){if(this.treeAdapter.getNamespaceURI(this.fragmentContext)===X.HTML){const e=this.treeAdapter.getTagName(this.fragmentContext);if(e===g.TITLE||e===g.TEXTAREA){this.tokenizer.state=A.MODE.RCDATA}else if(e===g.STYLE||e===g.XMP||e===g.IFRAME||e===g.NOEMBED||e===g.NOFRAMES||e===g.NOSCRIPT){this.tokenizer.state=A.MODE.RAWTEXT}else if(e===g.SCRIPT){this.tokenizer.state=A.MODE.SCRIPT_DATA}else if(e===g.PLAINTEXT){this.tokenizer.state=A.MODE.PLAINTEXT}}}_setDocumentType(e){const t=e.name||"";const i=e.publicId||"";const s=e.systemId||"";this.treeAdapter.setDocumentType(this.document,t,i,s)}_attachElementToTree(e){if(this._shouldFosterParentOnInsertion()){this._fosterParentElement(e)}else{const t=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.appendChild(t,e)}}_appendElement(e,t){const i=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(i)}_insertElement(e,t){const i=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(i);this.openElements.push(i)}_insertFakeElement(e){const t=this.treeAdapter.createElement(e,X.HTML,[]);this._attachElementToTree(t);this.openElements.push(t)}_insertTemplate(e){const t=this.treeAdapter.createElement(e.tagName,X.HTML,e.attrs);const i=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,i);this._attachElementToTree(t);this.openElements.push(t)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(g.HTML,X.HTML,[]);this.treeAdapter.appendChild(this.openElements.current,e);this.openElements.push(e)}_appendCommentNode(e,t){const i=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,i)}_insertCharacters(e){if(this._shouldFosterParentOnInsertion()){this._fosterParentText(e.chars)}else{const t=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.insertText(t,e.chars)}}_adoptNodes(e,t){for(let i=this.treeAdapter.getFirstChild(e);i;i=this.treeAdapter.getFirstChild(e)){this.treeAdapter.detachNode(i);this.treeAdapter.appendChild(t,i)}}_shouldProcessTokenInForeignContent(e){const t=this._getAdjustedCurrentElement();if(!t||t===this.document){return false}const i=this.treeAdapter.getNamespaceURI(t);if(i===X.HTML){return false}if(this.treeAdapter.getTagName(t)===g.ANNOTATION_XML&&i===X.MATHML&&e.type===A.START_TAG_TOKEN&&e.tagName===g.SVG){return false}const s=e.type===A.CHARACTER_TOKEN||e.type===A.NULL_CHARACTER_TOKEN||e.type===A.WHITESPACE_CHARACTER_TOKEN;const r=e.type===A.START_TAG_TOKEN&&e.tagName!==g.MGLYPH&&e.tagName!==g.MALIGNMARK;if((r||s)&&this._isIntegrationPoint(t,X.MATHML)){return false}if((e.type===A.START_TAG_TOKEN||s)&&this._isIntegrationPoint(t,X.HTML)){return false}return e.type!==A.EOF_TOKEN}_processToken(e){HC[this.insertionMode][e.type](this,e)}_processTokenInBodyMode(e){HC[Vn][e.type](this,e)}_processTokenInForeignContent(e){if(e.type===A.CHARACTER_TOKEN){cO(this,e)}else if(e.type===A.NULL_CHARACTER_TOKEN){dO(this,e)}else if(e.type===A.WHITESPACE_CHARACTER_TOKEN){Nt(this,e)}else if(e.type===A.COMMENT_TOKEN){Ze(this,e)}else if(e.type===A.START_TAG_TOKEN){hO(this,e)}else if(e.type===A.END_TAG_TOKEN){pO(this,e)}}_processInputToken(e){if(this._shouldProcessTokenInForeignContent(e)){this._processTokenInForeignContent(e)}else{this._processToken(e)}if(e.type===A.START_TAG_TOKEN&&e.selfClosing&&!e.ackSelfClosing){this._err(pt.nonVoidHtmlElementStartTagWithTrailingSolidus)}}_isIntegrationPoint(e,t){const i=this.treeAdapter.getTagName(e);const s=this.treeAdapter.getNamespaceURI(e);const r=this.treeAdapter.getAttrList(e);return jn.isIntegrationPoint(i,s,r,t)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.length;if(e){let t=e;let i=null;do{t--;i=this.activeFormattingElements.entries[t];if(i.type===$C.MARKER_ENTRY||this.openElements.contains(i.element)){t++;break}}while(t>0);for(let s=t;s<e;s++){i=this.activeFormattingElements.entries[s];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element));i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags();this.openElements.popUntilTableCellPopped();this.activeFormattingElements.clearToLastMarker();this.insertionMode=pi}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(g.P);this.openElements.popUntilTagNamePopped(g.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop,t=false;e>=0;e--){let i=this.openElements.items[e];if(e===0){t=true;if(this.fragmentContext){i=this.fragmentContext}}const s=this.treeAdapter.getTagName(i);const r=N8[s];if(r){this.insertionMode=r;break}else if(!t&&(s===g.TD||s===g.TH)){this.insertionMode=pd;break}else if(!t&&s===g.HEAD){this.insertionMode=Br;break}else if(s===g.SELECT){this._resetInsertionModeForSelect(e);break}else if(s===g.TEMPLATE){this.insertionMode=this.currentTmplInsertionMode;break}else if(s===g.HTML){this.insertionMode=this.headElement?cd:dd;break}else if(t){this.insertionMode=Vn;break}}}_resetInsertionModeForSelect(e){if(e>0){for(let t=e-1;t>0;t--){const i=this.openElements.items[t];const s=this.treeAdapter.getTagName(i);if(s===g.TEMPLATE){break}else if(s===g.TABLE){this.insertionMode=t1;return}}}this.insertionMode=e1}_pushTmplInsertionMode(e){this.tmplInsertionModeStack.push(e);this.tmplInsertionModeStackTop++;this.currentTmplInsertionMode=e}_popTmplInsertionMode(){this.tmplInsertionModeStack.pop();this.tmplInsertionModeStackTop--;this.currentTmplInsertionMode=this.tmplInsertionModeStack[this.tmplInsertionModeStackTop]}_isElementCausesFosterParenting(e){const t=this.treeAdapter.getTagName(e);return t===g.TABLE||t===g.TBODY||t===g.TFOOT||t===g.THEAD||t===g.TR}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.current)}_findFosterParentingLocation(){const e={parent:null,beforeElement:null};for(let t=this.openElements.stackTop;t>=0;t--){const i=this.openElements.items[t];const s=this.treeAdapter.getTagName(i);const r=this.treeAdapter.getNamespaceURI(i);if(s===g.TEMPLATE&&r===X.HTML){e.parent=this.treeAdapter.getTemplateContent(i);break}else if(s===g.TABLE){e.parent=this.treeAdapter.getParentNode(i);if(e.parent){e.beforeElement=i}else{e.parent=this.openElements.items[t-1]}break}}if(!e.parent){e.parent=this.openElements.items[0]}return e}_fosterParentElement(e){const t=this._findFosterParentingLocation();if(t.beforeElement){this.treeAdapter.insertBefore(t.parent,e,t.beforeElement)}else{this.treeAdapter.appendChild(t.parent,e)}}_fosterParentText(e){const t=this._findFosterParentingLocation();if(t.beforeElement){this.treeAdapter.insertTextBefore(t.parent,e,t.beforeElement)}else{this.treeAdapter.insertText(t.parent,e)}}_isSpecialElement(e){const t=this.treeAdapter.getTagName(e);const i=this.treeAdapter.getNamespaceURI(e);return Fs.SPECIAL_ELEMENTS[i][t]}};ax.exports=Jf;function $8(n,e){let t=n.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);if(t){if(!n.openElements.contains(t.element)){n.activeFormattingElements.removeEntry(t);t=null}else if(!n.openElements.hasInScope(e.tagName)){t=null}}else{En(n,e)}return t}function B8(n,e){let t=null;for(let i=n.openElements.stackTop;i>=0;i--){const s=n.openElements.items[i];if(s===e.element){break}if(n._isSpecialElement(s)){t=s}}if(!t){n.openElements.popUntilElementPopped(e.element);n.activeFormattingElements.removeEntry(e)}return t}function q8(n,e,t){let i=e;let s=n.openElements.getCommonAncestor(e);for(let r=0,o=s;o!==t;r++,o=s){s=n.openElements.getCommonAncestor(o);const a=n.activeFormattingElements.getElementEntry(o);const u=a&&r>=D8;const l=!a||u;if(l){if(u){n.activeFormattingElements.removeEntry(a)}n.openElements.remove(o)}else{o=H8(n,a);if(i===e){n.activeFormattingElements.bookmark=a}n.treeAdapter.detachNode(i);n.treeAdapter.appendChild(o,i);i=o}}return i}function H8(n,e){const t=n.treeAdapter.getNamespaceURI(e.element);const i=n.treeAdapter.createElement(e.token.tagName,t,e.token.attrs);n.openElements.replace(e.element,i);e.element=i;return i}function U8(n,e,t){if(n._isElementCausesFosterParenting(e)){n._fosterParentElement(t)}else{const i=n.treeAdapter.getTagName(e);const s=n.treeAdapter.getNamespaceURI(e);if(i===g.TEMPLATE&&s===X.HTML){e=n.treeAdapter.getTemplateContent(e)}n.treeAdapter.appendChild(e,t)}}function K8(n,e,t){const i=n.treeAdapter.getNamespaceURI(t.element);const s=t.token;const r=n.treeAdapter.createElement(s.tagName,i,s.attrs);n._adoptNodes(e,r);n.treeAdapter.appendChild(e,r);n.activeFormattingElements.insertElementAfterBookmark(r,t.token);n.activeFormattingElements.removeEntry(t);n.openElements.remove(t.element);n.openElements.insertAfter(e,r)}function Ji(n,e){let t;for(let i=0;i<O8;i++){t=$8(n,e,t);if(!t){break}const s=B8(n,t);if(!s){break}n.activeFormattingElements.bookmark=t;const r=q8(n,s,t.element);const o=n.openElements.getCommonAncestor(t.element);n.treeAdapter.detachNode(r);U8(n,o,r);K8(n,s,t)}}function fe(){}function id(n){n._err(pt.misplacedDoctype)}function Ze(n,e){n._appendCommentNode(e,n.openElements.currentTmplContent||n.openElements.current)}function W8(n,e){n._appendCommentNode(e,n.openElements.items[0])}function UC(n,e){n._appendCommentNode(e,n.document)}function Nt(n,e){n._insertCharacters(e)}function Ia(n){n.stopped=true}function j8(n,e){n._setDocumentType(e);const t=e.forceQuirks?Fs.DOCUMENT_MODE.QUIRKS:qC.getDocumentMode(e);if(!qC.isConforming(e)){n._err(pt.nonConformingDoctype)}n.treeAdapter.setDocumentMode(n.document,t);n.insertionMode=Zf}function Ma(n,e){n._err(pt.missingDoctype,{beforeToken:true});n.treeAdapter.setDocumentMode(n.document,Fs.DOCUMENT_MODE.QUIRKS);n.insertionMode=Zf;n._processToken(e)}function V8(n,e){if(e.tagName===g.HTML){n._insertElement(e,X.HTML);n.insertionMode=dd}else{Aa(n,e)}}function G8(n,e){const t=e.tagName;if(t===g.HTML||t===g.HEAD||t===g.BODY||t===g.BR){Aa(n,e)}}function Aa(n,e){n._insertFakeRootElement();n.insertionMode=dd;n._processToken(e)}function z8(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.HEAD){n._insertElement(e,X.HTML);n.headElement=n.openElements.current;n.insertionMode=Br}else{Ra(n,e)}}function Q8(n,e){const t=e.tagName;if(t===g.HEAD||t===g.BODY||t===g.HTML||t===g.BR){Ra(n,e)}else{n._err(pt.endTagWithoutMatchingOpenElement)}}function Ra(n,e){n._insertFakeElement(g.HEAD);n.headElement=n.openElements.current;n.insertionMode=Br;n._processToken(e)}function rt(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.BASE||t===g.BASEFONT||t===g.BGSOUND||t===g.LINK||t===g.META){n._appendElement(e,X.HTML);e.ackSelfClosing=true}else if(t===g.TITLE){n._switchToTextParsing(e,A.MODE.RCDATA)}else if(t===g.NOSCRIPT){if(n.options.scriptingEnabled){n._switchToTextParsing(e,A.MODE.RAWTEXT)}else{n._insertElement(e,X.HTML);n.insertionMode=ZC}}else if(t===g.NOFRAMES||t===g.STYLE){n._switchToTextParsing(e,A.MODE.RAWTEXT)}else if(t===g.SCRIPT){n._switchToTextParsing(e,A.MODE.SCRIPT_DATA)}else if(t===g.TEMPLATE){n._insertTemplate(e,X.HTML);n.activeFormattingElements.insertMarker();n.framesetOk=false;n.insertionMode=ad;n._pushTmplInsertionMode(ad)}else if(t===g.HEAD){n._err(pt.misplacedStartTagForHeadElement)}else{ka(n,e)}}function $s(n,e){const t=e.tagName;if(t===g.HEAD){n.openElements.pop();n.insertionMode=cd}else if(t===g.BODY||t===g.BR||t===g.HTML){ka(n,e)}else if(t===g.TEMPLATE){if(n.openElements.tmplCount>0){n.openElements.generateImpliedEndTagsThoroughly();if(n.openElements.currentTagName!==g.TEMPLATE){n._err(pt.closingOfElementWithOpenChildElements)}n.openElements.popUntilTagNamePopped(g.TEMPLATE);n.activeFormattingElements.clearToLastMarker();n._popTmplInsertionMode();n._resetInsertionMode()}else{n._err(pt.endTagWithoutMatchingOpenElement)}}else{n._err(pt.endTagWithoutMatchingOpenElement)}}function ka(n,e){n.openElements.pop();n.insertionMode=cd;n._processToken(e)}function Y8(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.BASEFONT||t===g.BGSOUND||t===g.HEAD||t===g.LINK||t===g.META||t===g.NOFRAMES||t===g.STYLE){rt(n,e)}else if(t===g.NOSCRIPT){n._err(pt.nestedNoscriptInHead)}else{Pa(n,e)}}function X8(n,e){const t=e.tagName;if(t===g.NOSCRIPT){n.openElements.pop();n.insertionMode=Br}else if(t===g.BR){Pa(n,e)}else{n._err(pt.endTagWithoutMatchingOpenElement)}}function Pa(n,e){const t=e.type===A.EOF_TOKEN?pt.openElementsLeftAfterEof:pt.disallowedContentInNoscriptInHead;n._err(t);n.openElements.pop();n.insertionMode=Br;n._processToken(e)}function J8(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.BODY){n._insertElement(e,X.HTML);n.framesetOk=false;n.insertionMode=Vn}else if(t===g.FRAMESET){n._insertElement(e,X.HTML);n.insertionMode=md}else if(t===g.BASE||t===g.BASEFONT||t===g.BGSOUND||t===g.LINK||t===g.META||t===g.NOFRAMES||t===g.SCRIPT||t===g.STYLE||t===g.TEMPLATE||t===g.TITLE){n._err(pt.abandonedHeadElementChild);n.openElements.push(n.headElement);rt(n,e);n.openElements.remove(n.headElement)}else if(t===g.HEAD){n._err(pt.misplacedStartTagForHeadElement)}else{_a(n,e)}}function Z8(n,e){const t=e.tagName;if(t===g.BODY||t===g.HTML||t===g.BR){_a(n,e)}else if(t===g.TEMPLATE){$s(n,e)}else{n._err(pt.endTagWithoutMatchingOpenElement)}}function _a(n,e){n._insertFakeElement(g.BODY);n.insertionMode=Vn;n._processToken(e)}function Ns(n,e){n._reconstructActiveFormattingElements();n._insertCharacters(e)}function sd(n,e){n._reconstructActiveFormattingElements();n._insertCharacters(e);n.framesetOk=false}function eL(n,e){if(n.openElements.tmplCount===0){n.treeAdapter.adoptAttributes(n.openElements.items[0],e.attrs)}}function tL(n,e){const t=n.openElements.tryPeekProperlyNestedBodyElement();if(t&&n.openElements.tmplCount===0){n.framesetOk=false;n.treeAdapter.adoptAttributes(t,e.attrs)}}function nL(n,e){const t=n.openElements.tryPeekProperlyNestedBodyElement();if(n.framesetOk&&t){n.treeAdapter.detachNode(t);n.openElements.popAllUpToHtmlElement();n._insertElement(e,X.HTML);n.insertionMode=md}}function di(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML)}function iL(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}const t=n.openElements.currentTagName;if(t===g.H1||t===g.H2||t===g.H3||t===g.H4||t===g.H5||t===g.H6){n.openElements.pop()}n._insertElement(e,X.HTML)}function KC(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML);n.skipNextNewLine=true;n.framesetOk=false}function sL(n,e){const t=n.openElements.tmplCount>0;if(!n.formElement||t){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML);if(!t){n.formElement=n.openElements.current}}}function rL(n,e){n.framesetOk=false;const t=e.tagName;for(let i=n.openElements.stackTop;i>=0;i--){const s=n.openElements.items[i];const r=n.treeAdapter.getTagName(s);let o=null;if(t===g.LI&&r===g.LI){o=g.LI}else if((t===g.DD||t===g.DT)&&(r===g.DD||r===g.DT)){o=r}if(o){n.openElements.generateImpliedEndTagsWithExclusion(o);n.openElements.popUntilTagNamePopped(o);break}if(r!==g.ADDRESS&&r!==g.DIV&&r!==g.P&&n._isSpecialElement(s)){break}}if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML)}function oL(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML);n.tokenizer.state=A.MODE.PLAINTEXT}function aL(n,e){if(n.openElements.hasInScope(g.BUTTON)){n.openElements.generateImpliedEndTags();n.openElements.popUntilTagNamePopped(g.BUTTON)}n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML);n.framesetOk=false}function uL(n,e){const t=n.activeFormattingElements.getElementEntryInScopeWithTagName(g.A);if(t){Ji(n,e);n.openElements.remove(t.element);n.activeFormattingElements.removeEntry(t)}n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML);n.activeFormattingElements.pushElement(n.openElements.current,e)}function Fr(n,e){n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML);n.activeFormattingElements.pushElement(n.openElements.current,e)}function lL(n,e){n._reconstructActiveFormattingElements();if(n.openElements.hasInScope(g.NOBR)){Ji(n,e);n._reconstructActiveFormattingElements()}n._insertElement(e,X.HTML);n.activeFormattingElements.pushElement(n.openElements.current,e)}function WC(n,e){n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML);n.activeFormattingElements.insertMarker();n.framesetOk=false}function dL(n,e){if(n.treeAdapter.getDocumentMode(n.document)!==Fs.DOCUMENT_MODE.QUIRKS&&n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML);n.framesetOk=false;n.insertionMode=Ct}function $r(n,e){n._reconstructActiveFormattingElements();n._appendElement(e,X.HTML);n.framesetOk=false;e.ackSelfClosing=true}function cL(n,e){n._reconstructActiveFormattingElements();n._appendElement(e,X.HTML);const t=A.getTokenAttr(e,YC.TYPE);if(!t||t.toLowerCase()!==XC){n.framesetOk=false}e.ackSelfClosing=true}function jC(n,e){n._appendElement(e,X.HTML);e.ackSelfClosing=true}function hL(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._appendElement(e,X.HTML);n.framesetOk=false;n.ackSelfClosing=true}function pL(n,e){e.tagName=g.IMG;$r(n,e)}function mL(n,e){n._insertElement(e,X.HTML);n.skipNextNewLine=true;n.tokenizer.state=A.MODE.RCDATA;n.originalInsertionMode=n.insertionMode;n.framesetOk=false;n.insertionMode=od}function fL(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._reconstructActiveFormattingElements();n.framesetOk=false;n._switchToTextParsing(e,A.MODE.RAWTEXT)}function gL(n,e){n.framesetOk=false;n._switchToTextParsing(e,A.MODE.RAWTEXT)}function VC(n,e){n._switchToTextParsing(e,A.MODE.RAWTEXT)}function yL(n,e){n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML);n.framesetOk=false;if(n.insertionMode===Ct||n.insertionMode===hd||n.insertionMode===mn||n.insertionMode===pi||n.insertionMode===pd){n.insertionMode=t1}else{n.insertionMode=e1}}function GC(n,e){if(n.openElements.currentTagName===g.OPTION){n.openElements.pop()}n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML)}function zC(n,e){if(n.openElements.hasInScope(g.RUBY)){n.openElements.generateImpliedEndTags()}n._insertElement(e,X.HTML)}function TL(n,e){if(n.openElements.hasInScope(g.RUBY)){n.openElements.generateImpliedEndTagsWithExclusion(g.RTC)}n._insertElement(e,X.HTML)}function bL(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML)}function vL(n,e){n._reconstructActiveFormattingElements();jn.adjustTokenMathMLAttrs(e);jn.adjustTokenXMLAttrs(e);if(e.selfClosing){n._appendElement(e,X.MATHML)}else{n._insertElement(e,X.MATHML)}e.ackSelfClosing=true}function SL(n,e){n._reconstructActiveFormattingElements();jn.adjustTokenSVGAttrs(e);jn.adjustTokenXMLAttrs(e);if(e.selfClosing){n._appendElement(e,X.SVG)}else{n._insertElement(e,X.SVG)}e.ackSelfClosing=true}function hn(n,e){n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML)}function Ft(n,e){const t=e.tagName;switch(t.length){case 1:if(t===g.I||t===g.S||t===g.B||t===g.U){Fr(n,e)}else if(t===g.P){di(n,e)}else if(t===g.A){uL(n,e)}else{hn(n,e)}break;case 2:if(t===g.DL||t===g.OL||t===g.UL){di(n,e)}else if(t===g.H1||t===g.H2||t===g.H3||t===g.H4||t===g.H5||t===g.H6){iL(n,e)}else if(t===g.LI||t===g.DD||t===g.DT){rL(n,e)}else if(t===g.EM||t===g.TT){Fr(n,e)}else if(t===g.BR){$r(n,e)}else if(t===g.HR){hL(n,e)}else if(t===g.RB){zC(n,e)}else if(t===g.RT||t===g.RP){TL(n,e)}else if(t!==g.TH&&t!==g.TD&&t!==g.TR){hn(n,e)}break;case 3:if(t===g.DIV||t===g.DIR||t===g.NAV){di(n,e)}else if(t===g.PRE){KC(n,e)}else if(t===g.BIG){Fr(n,e)}else if(t===g.IMG||t===g.WBR){$r(n,e)}else if(t===g.XMP){fL(n,e)}else if(t===g.SVG){SL(n,e)}else if(t===g.RTC){zC(n,e)}else if(t!==g.COL){hn(n,e)}break;case 4:if(t===g.HTML){eL(n,e)}else if(t===g.BASE||t===g.LINK||t===g.META){rt(n,e)}else if(t===g.BODY){tL(n,e)}else if(t===g.MAIN||t===g.MENU){di(n,e)}else if(t===g.FORM){sL(n,e)}else if(t===g.CODE||t===g.FONT){Fr(n,e)}else if(t===g.NOBR){lL(n,e)}else if(t===g.AREA){$r(n,e)}else if(t===g.MATH){vL(n,e)}else if(t===g.MENU){bL(n,e)}else if(t!==g.HEAD){hn(n,e)}break;case 5:if(t===g.STYLE||t===g.TITLE){rt(n,e)}else if(t===g.ASIDE){di(n,e)}else if(t===g.SMALL){Fr(n,e)}else if(t===g.TABLE){dL(n,e)}else if(t===g.EMBED){$r(n,e)}else if(t===g.INPUT){cL(n,e)}else if(t===g.PARAM||t===g.TRACK){jC(n,e)}else if(t===g.IMAGE){pL(n,e)}else if(t!==g.FRAME&&t!==g.TBODY&&t!==g.TFOOT&&t!==g.THEAD){hn(n,e)}break;case 6:if(t===g.SCRIPT){rt(n,e)}else if(t===g.CENTER||t===g.FIGURE||t===g.FOOTER||t===g.HEADER||t===g.HGROUP||t===g.DIALOG){di(n,e)}else if(t===g.BUTTON){aL(n,e)}else if(t===g.STRIKE||t===g.STRONG){Fr(n,e)}else if(t===g.APPLET||t===g.OBJECT){WC(n,e)}else if(t===g.KEYGEN){$r(n,e)}else if(t===g.SOURCE){jC(n,e)}else if(t===g.IFRAME){gL(n,e)}else if(t===g.SELECT){yL(n,e)}else if(t===g.OPTION){GC(n,e)}else{hn(n,e)}break;case 7:if(t===g.BGSOUND){rt(n,e)}else if(t===g.DETAILS||t===g.ADDRESS||t===g.ARTICLE||t===g.SECTION||t===g.SUMMARY){di(n,e)}else if(t===g.LISTING){KC(n,e)}else if(t===g.MARQUEE){WC(n,e)}else if(t===g.NOEMBED){VC(n,e)}else if(t!==g.CAPTION){hn(n,e)}break;case 8:if(t===g.BASEFONT){rt(n,e)}else if(t===g.FRAMESET){nL(n,e)}else if(t===g.FIELDSET){di(n,e)}else if(t===g.TEXTAREA){mL(n,e)}else if(t===g.TEMPLATE){rt(n,e)}else if(t===g.NOSCRIPT){if(n.options.scriptingEnabled){VC(n,e)}else{hn(n,e)}}else if(t===g.OPTGROUP){GC(n,e)}else if(t!==g.COLGROUP){hn(n,e)}break;case 9:if(t===g.PLAINTEXT){oL(n,e)}else{hn(n,e)}break;case 10:if(t===g.BLOCKQUOTE||t===g.FIGCAPTION){di(n,e)}else{hn(n,e)}break;default:hn(n,e)}}function CL(n){if(n.openElements.hasInScope(g.BODY)){n.insertionMode=n1}}function xL(n,e){if(n.openElements.hasInScope(g.BODY)){n.insertionMode=n1;n._processToken(e)}}function Xi(n,e){const t=e.tagName;if(n.openElements.hasInScope(t)){n.openElements.generateImpliedEndTags();n.openElements.popUntilTagNamePopped(t)}}function wL(n){const e=n.openElements.tmplCount>0;const t=n.formElement;if(!e){n.formElement=null}if((t||e)&&n.openElements.hasInScope(g.FORM)){n.openElements.generateImpliedEndTags();if(e){n.openElements.popUntilTagNamePopped(g.FORM)}else{n.openElements.remove(t)}}}function IL(n){if(!n.openElements.hasInButtonScope(g.P)){n._insertFakeElement(g.P)}n._closePElement()}function ML(n){if(n.openElements.hasInListItemScope(g.LI)){n.openElements.generateImpliedEndTagsWithExclusion(g.LI);n.openElements.popUntilTagNamePopped(g.LI)}}function EL(n,e){const t=e.tagName;if(n.openElements.hasInScope(t)){n.openElements.generateImpliedEndTagsWithExclusion(t);n.openElements.popUntilTagNamePopped(t)}}function AL(n){if(n.openElements.hasNumberedHeaderInScope()){n.openElements.generateImpliedEndTags();n.openElements.popUntilNumberedHeaderPopped()}}function QC(n,e){const t=e.tagName;if(n.openElements.hasInScope(t)){n.openElements.generateImpliedEndTags();n.openElements.popUntilTagNamePopped(t);n.activeFormattingElements.clearToLastMarker()}}function RL(n){n._reconstructActiveFormattingElements();n._insertFakeElement(g.BR);n.openElements.pop();n.framesetOk=false}function En(n,e){const t=e.tagName;for(let i=n.openElements.stackTop;i>0;i--){const s=n.openElements.items[i];if(n.treeAdapter.getTagName(s)===t){n.openElements.generateImpliedEndTagsWithExclusion(t);n.openElements.popUntilElementPopped(s);break}if(n._isSpecialElement(s)){break}}}function i1(n,e){const t=e.tagName;switch(t.length){case 1:if(t===g.A||t===g.B||t===g.I||t===g.S||t===g.U){Ji(n,e)}else if(t===g.P){IL(n,e)}else{En(n,e)}break;case 2:if(t===g.DL||t===g.UL||t===g.OL){Xi(n,e)}else if(t===g.LI){ML(n,e)}else if(t===g.DD||t===g.DT){EL(n,e)}else if(t===g.H1||t===g.H2||t===g.H3||t===g.H4||t===g.H5||t===g.H6){AL(n,e)}else if(t===g.BR){RL(n,e)}else if(t===g.EM||t===g.TT){Ji(n,e)}else{En(n,e)}break;case 3:if(t===g.BIG){Ji(n,e)}else if(t===g.DIR||t===g.DIV||t===g.NAV||t===g.PRE){Xi(n,e)}else{En(n,e)}break;case 4:if(t===g.BODY){CL(n,e)}else if(t===g.HTML){xL(n,e)}else if(t===g.FORM){wL(n,e)}else if(t===g.CODE||t===g.FONT||t===g.NOBR){Ji(n,e)}else if(t===g.MAIN||t===g.MENU){Xi(n,e)}else{En(n,e)}break;case 5:if(t===g.ASIDE){Xi(n,e)}else if(t===g.SMALL){Ji(n,e)}else{En(n,e)}break;case 6:if(t===g.CENTER||t===g.FIGURE||t===g.FOOTER||t===g.HEADER||t===g.HGROUP||t===g.DIALOG){Xi(n,e)}else if(t===g.APPLET||t===g.OBJECT){QC(n,e)}else if(t===g.STRIKE||t===g.STRONG){Ji(n,e)}else{En(n,e)}break;case 7:if(t===g.ADDRESS||t===g.ARTICLE||t===g.DETAILS||t===g.SECTION||t===g.SUMMARY||t===g.LISTING){Xi(n,e)}else if(t===g.MARQUEE){QC(n,e)}else{En(n,e)}break;case 8:if(t===g.FIELDSET){Xi(n,e)}else if(t===g.TEMPLATE){$s(n,e)}else{En(n,e)}break;case 10:if(t===g.BLOCKQUOTE||t===g.FIGCAPTION){Xi(n,e)}else{En(n,e)}break;default:En(n,e)}}function ci(n,e){if(n.tmplInsertionModeStackTop>-1){ox(n,e)}else{n.stopped=true}}function kL(n,e){if(e.tagName===g.SCRIPT){n.pendingScript=n.openElements.current}n.openElements.pop();n.insertionMode=n.originalInsertionMode}function PL(n,e){n._err(pt.eofInElementThatCanContainOnlyText);n.openElements.pop();n.insertionMode=n.originalInsertionMode;n._processToken(e)}function hi(n,e){const t=n.openElements.currentTagName;if(t===g.TABLE||t===g.TBODY||t===g.TFOOT||t===g.THEAD||t===g.TR){n.pendingCharacterTokens=[];n.hasNonWhitespacePendingCharacterToken=false;n.originalInsertionMode=n.insertionMode;n.insertionMode=ex;n._processToken(e)}else{pn(n,e)}}function _L(n,e){n.openElements.clearBackToTableContext();n.activeFormattingElements.insertMarker();n._insertElement(e,X.HTML);n.insertionMode=hd}function LL(n,e){n.openElements.clearBackToTableContext();n._insertElement(e,X.HTML);n.insertionMode=La}function OL(n,e){n.openElements.clearBackToTableContext();n._insertFakeElement(g.COLGROUP);n.insertionMode=La;n._processToken(e)}function DL(n,e){n.openElements.clearBackToTableContext();n._insertElement(e,X.HTML);n.insertionMode=mn}function NL(n,e){n.openElements.clearBackToTableContext();n._insertFakeElement(g.TBODY);n.insertionMode=mn;n._processToken(e)}function FL(n,e){if(n.openElements.hasInTableScope(g.TABLE)){n.openElements.popUntilTagNamePopped(g.TABLE);n._resetInsertionMode();n._processToken(e)}}function $L(n,e){const t=A.getTokenAttr(e,YC.TYPE);if(t&&t.toLowerCase()===XC){n._appendElement(e,X.HTML)}else{pn(n,e)}e.ackSelfClosing=true}function BL(n,e){if(!n.formElement&&n.openElements.tmplCount===0){n._insertElement(e,X.HTML);n.formElement=n.openElements.current;n.openElements.pop()}}function s1(n,e){const t=e.tagName;switch(t.length){case 2:if(t===g.TD||t===g.TH||t===g.TR){NL(n,e)}else{pn(n,e)}break;case 3:if(t===g.COL){OL(n,e)}else{pn(n,e)}break;case 4:if(t===g.FORM){BL(n,e)}else{pn(n,e)}break;case 5:if(t===g.TABLE){FL(n,e)}else if(t===g.STYLE){rt(n,e)}else if(t===g.TBODY||t===g.TFOOT||t===g.THEAD){DL(n,e)}else if(t===g.INPUT){$L(n,e)}else{pn(n,e)}break;case 6:if(t===g.SCRIPT){rt(n,e)}else{pn(n,e)}break;case 7:if(t===g.CAPTION){_L(n,e)}else{pn(n,e)}break;case 8:if(t===g.COLGROUP){LL(n,e)}else if(t===g.TEMPLATE){rt(n,e)}else{pn(n,e)}break;default:pn(n,e)}}function r1(n,e){const t=e.tagName;if(t===g.TABLE){if(n.openElements.hasInTableScope(g.TABLE)){n.openElements.popUntilTagNamePopped(g.TABLE);n._resetInsertionMode()}}else if(t===g.TEMPLATE){$s(n,e)}else if(t!==g.BODY&&t!==g.CAPTION&&t!==g.COL&&t!==g.COLGROUP&&t!==g.HTML&&t!==g.TBODY&&t!==g.TD&&t!==g.TFOOT&&t!==g.TH&&t!==g.THEAD&&t!==g.TR){pn(n,e)}}function pn(n,e){const t=n.fosterParentingEnabled;n.fosterParentingEnabled=true;n._processTokenInBodyMode(e);n.fosterParentingEnabled=t}function qL(n,e){n.pendingCharacterTokens.push(e)}function HL(n,e){n.pendingCharacterTokens.push(e);n.hasNonWhitespacePendingCharacterToken=true}function Ea(n,e){let t=0;if(n.hasNonWhitespacePendingCharacterToken){for(;t<n.pendingCharacterTokens.length;t++){pn(n,n.pendingCharacterTokens[t])}}else{for(;t<n.pendingCharacterTokens.length;t++){n._insertCharacters(n.pendingCharacterTokens[t])}}n.insertionMode=n.originalInsertionMode;n._processToken(e)}function UL(n,e){const t=e.tagName;if(t===g.CAPTION||t===g.COL||t===g.COLGROUP||t===g.TBODY||t===g.TD||t===g.TFOOT||t===g.TH||t===g.THEAD||t===g.TR){if(n.openElements.hasInTableScope(g.CAPTION)){n.openElements.generateImpliedEndTags();n.openElements.popUntilTagNamePopped(g.CAPTION);n.activeFormattingElements.clearToLastMarker();n.insertionMode=Ct;n._processToken(e)}}else{Ft(n,e)}}function KL(n,e){const t=e.tagName;if(t===g.CAPTION||t===g.TABLE){if(n.openElements.hasInTableScope(g.CAPTION)){n.openElements.generateImpliedEndTags();n.openElements.popUntilTagNamePopped(g.CAPTION);n.activeFormattingElements.clearToLastMarker();n.insertionMode=Ct;if(t===g.TABLE){n._processToken(e)}}}else if(t!==g.BODY&&t!==g.COL&&t!==g.COLGROUP&&t!==g.HTML&&t!==g.TBODY&&t!==g.TD&&t!==g.TFOOT&&t!==g.TH&&t!==g.THEAD&&t!==g.TR){i1(n,e)}}function WL(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.COL){n._appendElement(e,X.HTML);e.ackSelfClosing=true}else if(t===g.TEMPLATE){rt(n,e)}else{ud(n,e)}}function jL(n,e){const t=e.tagName;if(t===g.COLGROUP){if(n.openElements.currentTagName===g.COLGROUP){n.openElements.pop();n.insertionMode=Ct}}else if(t===g.TEMPLATE){$s(n,e)}else if(t!==g.COL){ud(n,e)}}function ud(n,e){if(n.openElements.currentTagName===g.COLGROUP){n.openElements.pop();n.insertionMode=Ct;n._processToken(e)}}function VL(n,e){const t=e.tagName;if(t===g.TR){n.openElements.clearBackToTableBodyContext();n._insertElement(e,X.HTML);n.insertionMode=pi}else if(t===g.TH||t===g.TD){n.openElements.clearBackToTableBodyContext();n._insertFakeElement(g.TR);n.insertionMode=pi;n._processToken(e)}else if(t===g.CAPTION||t===g.COL||t===g.COLGROUP||t===g.TBODY||t===g.TFOOT||t===g.THEAD){if(n.openElements.hasTableBodyContextInTableScope()){n.openElements.clearBackToTableBodyContext();n.openElements.pop();n.insertionMode=Ct;n._processToken(e)}}else{s1(n,e)}}function GL(n,e){const t=e.tagName;if(t===g.TBODY||t===g.TFOOT||t===g.THEAD){if(n.openElements.hasInTableScope(t)){n.openElements.clearBackToTableBodyContext();n.openElements.pop();n.insertionMode=Ct}}else if(t===g.TABLE){if(n.openElements.hasTableBodyContextInTableScope()){n.openElements.clearBackToTableBodyContext();n.openElements.pop();n.insertionMode=Ct;n._processToken(e)}}else if(t!==g.BODY&&t!==g.CAPTION&&t!==g.COL&&t!==g.COLGROUP||t!==g.HTML&&t!==g.TD&&t!==g.TH&&t!==g.TR){r1(n,e)}}function zL(n,e){const t=e.tagName;if(t===g.TH||t===g.TD){n.openElements.clearBackToTableRowContext();n._insertElement(e,X.HTML);n.insertionMode=pd;n.activeFormattingElements.insertMarker()}else if(t===g.CAPTION||t===g.COL||t===g.COLGROUP||t===g.TBODY||t===g.TFOOT||t===g.THEAD||t===g.TR){if(n.openElements.hasInTableScope(g.TR)){n.openElements.clearBackToTableRowContext();n.openElements.pop();n.insertionMode=mn;n._processToken(e)}}else{s1(n,e)}}function QL(n,e){const t=e.tagName;if(t===g.TR){if(n.openElements.hasInTableScope(g.TR)){n.openElements.clearBackToTableRowContext();n.openElements.pop();n.insertionMode=mn}}else if(t===g.TABLE){if(n.openElements.hasInTableScope(g.TR)){n.openElements.clearBackToTableRowContext();n.openElements.pop();n.insertionMode=mn;n._processToken(e)}}else if(t===g.TBODY||t===g.TFOOT||t===g.THEAD){if(n.openElements.hasInTableScope(t)||n.openElements.hasInTableScope(g.TR)){n.openElements.clearBackToTableRowContext();n.openElements.pop();n.insertionMode=mn;n._processToken(e)}}else if(t!==g.BODY&&t!==g.CAPTION&&t!==g.COL&&t!==g.COLGROUP||t!==g.HTML&&t!==g.TD&&t!==g.TH){r1(n,e)}}function YL(n,e){const t=e.tagName;if(t===g.CAPTION||t===g.COL||t===g.COLGROUP||t===g.TBODY||t===g.TD||t===g.TFOOT||t===g.TH||t===g.THEAD||t===g.TR){if(n.openElements.hasInTableScope(g.TD)||n.openElements.hasInTableScope(g.TH)){n._closeTableCell();n._processToken(e)}}else{Ft(n,e)}}function XL(n,e){const t=e.tagName;if(t===g.TD||t===g.TH){if(n.openElements.hasInTableScope(t)){n.openElements.generateImpliedEndTags();n.openElements.popUntilTagNamePopped(t);n.activeFormattingElements.clearToLastMarker();n.insertionMode=pi}}else if(t===g.TABLE||t===g.TBODY||t===g.TFOOT||t===g.THEAD||t===g.TR){if(n.openElements.hasInTableScope(t)){n._closeTableCell();n._processToken(e)}}else if(t!==g.BODY&&t!==g.CAPTION&&t!==g.COL&&t!==g.COLGROUP&&t!==g.HTML){i1(n,e)}}function sx(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.OPTION){if(n.openElements.currentTagName===g.OPTION){n.openElements.pop()}n._insertElement(e,X.HTML)}else if(t===g.OPTGROUP){if(n.openElements.currentTagName===g.OPTION){n.openElements.pop()}if(n.openElements.currentTagName===g.OPTGROUP){n.openElements.pop()}n._insertElement(e,X.HTML)}else if(t===g.INPUT||t===g.KEYGEN||t===g.TEXTAREA||t===g.SELECT){if(n.openElements.hasInSelectScope(g.SELECT)){n.openElements.popUntilTagNamePopped(g.SELECT);n._resetInsertionMode();if(t!==g.SELECT){n._processToken(e)}}}else if(t===g.SCRIPT||t===g.TEMPLATE){rt(n,e)}}function rx(n,e){const t=e.tagName;if(t===g.OPTGROUP){const i=n.openElements.items[n.openElements.stackTop-1];const s=i&&n.treeAdapter.getTagName(i);if(n.openElements.currentTagName===g.OPTION&&s===g.OPTGROUP){n.openElements.pop()}if(n.openElements.currentTagName===g.OPTGROUP){n.openElements.pop()}}else if(t===g.OPTION){if(n.openElements.currentTagName===g.OPTION){n.openElements.pop()}}else if(t===g.SELECT&&n.openElements.hasInSelectScope(g.SELECT)){n.openElements.popUntilTagNamePopped(g.SELECT);n._resetInsertionMode()}else if(t===g.TEMPLATE){$s(n,e)}}function JL(n,e){const t=e.tagName;if(t===g.CAPTION||t===g.TABLE||t===g.TBODY||t===g.TFOOT||t===g.THEAD||t===g.TR||t===g.TD||t===g.TH){n.openElements.popUntilTagNamePopped(g.SELECT);n._resetInsertionMode();n._processToken(e)}else{sx(n,e)}}function ZL(n,e){const t=e.tagName;if(t===g.CAPTION||t===g.TABLE||t===g.TBODY||t===g.TFOOT||t===g.THEAD||t===g.TR||t===g.TD||t===g.TH){if(n.openElements.hasInTableScope(t)){n.openElements.popUntilTagNamePopped(g.SELECT);n._resetInsertionMode();n._processToken(e)}}else{rx(n,e)}}function eO(n,e){const t=e.tagName;if(t===g.BASE||t===g.BASEFONT||t===g.BGSOUND||t===g.LINK||t===g.META||t===g.NOFRAMES||t===g.SCRIPT||t===g.STYLE||t===g.TEMPLATE||t===g.TITLE){rt(n,e)}else{const i=F8[t]||Vn;n._popTmplInsertionMode();n._pushTmplInsertionMode(i);n.insertionMode=i;n._processToken(e)}}function tO(n,e){if(e.tagName===g.TEMPLATE){$s(n,e)}}function ox(n,e){if(n.openElements.tmplCount>0){n.openElements.popUntilTagNamePopped(g.TEMPLATE);n.activeFormattingElements.clearToLastMarker();n._popTmplInsertionMode();n._resetInsertionMode();n._processToken(e)}else{n.stopped=true}}function nO(n,e){if(e.tagName===g.HTML){Ft(n,e)}else{ld(n,e)}}function iO(n,e){if(e.tagName===g.HTML){if(!n.fragmentContext){n.insertionMode=nx}}else{ld(n,e)}}function ld(n,e){n.insertionMode=Vn;n._processToken(e)}function sO(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.FRAMESET){n._insertElement(e,X.HTML)}else if(t===g.FRAME){n._appendElement(e,X.HTML);e.ackSelfClosing=true}else if(t===g.NOFRAMES){rt(n,e)}}function rO(n,e){if(e.tagName===g.FRAMESET&&!n.openElements.isRootHtmlElementCurrent()){n.openElements.pop();if(!n.fragmentContext&&n.openElements.currentTagName!==g.FRAMESET){n.insertionMode=tx}}}function oO(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.NOFRAMES){rt(n,e)}}function aO(n,e){if(e.tagName===g.HTML){n.insertionMode=ix}}function uO(n,e){if(e.tagName===g.HTML){Ft(n,e)}else{rd(n,e)}}function rd(n,e){n.insertionMode=Vn;n._processToken(e)}function lO(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.NOFRAMES){rt(n,e)}}function dO(n,e){e.chars=_8.REPLACEMENT_CHARACTER;n._insertCharacters(e)}function cO(n,e){n._insertCharacters(e);n.framesetOk=false}function hO(n,e){if(jn.causesExit(e)&&!n.fragmentContext){while(n.treeAdapter.getNamespaceURI(n.openElements.current)!==X.HTML&&!n._isIntegrationPoint(n.openElements.current)){n.openElements.pop()}n._processToken(e)}else{const t=n._getAdjustedCurrentElement();const i=n.treeAdapter.getNamespaceURI(t);if(i===X.MATHML){jn.adjustTokenMathMLAttrs(e)}else if(i===X.SVG){jn.adjustTokenSVGTagName(e);jn.adjustTokenSVGAttrs(e)}jn.adjustTokenXMLAttrs(e);if(e.selfClosing){n._appendElement(e,i)}else{n._insertElement(e,i)}e.ackSelfClosing=true}}function pO(n,e){for(let t=n.openElements.stackTop;t>0;t--){const i=n.openElements.items[t];if(n.treeAdapter.getNamespaceURI(i)===X.HTML){n._processToken(e);break}if(n.treeAdapter.getTagName(i).toLowerCase()===e.tagName){n.openElements.popUntilElementPopped(i);break}}}});var cx=ce((mX,dx)=>{"use strict";var mO=Gf();var fO=zf();var gO=Qf();var lx=Qi();var Oe=lx.TAG_NAMES;var fd=lx.NAMESPACES;var yO={treeAdapter:mO};var TO=/&/g;var bO=/\u00a0/g;var vO=/"/g;var SO=/</g;var CO=/>/g;var gd=class n{constructor(e,t){this.options=fO(yO,t);this.treeAdapter=this.options.treeAdapter;this.html="";this.startNode=e}serialize(){this._serializeChildNodes(this.startNode);return this.html}_serializeChildNodes(e){const t=this.treeAdapter.getChildNodes(e);if(t){for(let i=0,s=t.length;i<s;i++){const r=t[i];if(this.treeAdapter.isElementNode(r)){this._serializeElement(r)}else if(this.treeAdapter.isTextNode(r)){this._serializeTextNode(r)}else if(this.treeAdapter.isCommentNode(r)){this._serializeCommentNode(r)}else if(this.treeAdapter.isDocumentTypeNode(r)){this._serializeDocumentTypeNode(r)}}}}_serializeElement(e){const t=this.treeAdapter.getTagName(e);const i=this.treeAdapter.getNamespaceURI(e);this.html+="<"+t;this._serializeAttributes(e);this.html+=">";if(t!==Oe.AREA&&t!==Oe.BASE&&t!==Oe.BASEFONT&&t!==Oe.BGSOUND&&t!==Oe.BR&&t!==Oe.COL&&t!==Oe.EMBED&&t!==Oe.FRAME&&t!==Oe.HR&&t!==Oe.IMG&&t!==Oe.INPUT&&t!==Oe.KEYGEN&&t!==Oe.LINK&&t!==Oe.META&&t!==Oe.PARAM&&t!==Oe.SOURCE&&t!==Oe.TRACK&&t!==Oe.WBR){const s=t===Oe.TEMPLATE&&i===fd.HTML?this.treeAdapter.getTemplateContent(e):e;this._serializeChildNodes(s);this.html+="</"+t+">"}}_serializeAttributes(e){const t=this.treeAdapter.getAttrList(e);for(let i=0,s=t.length;i<s;i++){const r=t[i];const o=n.escapeString(r.value,true);this.html+=" ";if(!r.namespace){this.html+=r.name}else if(r.namespace===fd.XML){this.html+="xml:"+r.name}else if(r.namespace===fd.XMLNS){if(r.name!=="xmlns"){this.html+="xmlns:"}this.html+=r.name}else if(r.namespace===fd.XLINK){this.html+="xlink:"+r.name}else{this.html+=r.prefix+":"+r.name}this.html+='="'+o+'"'}}_serializeTextNode(e){const t=this.treeAdapter.getTextNodeContent(e);const i=this.treeAdapter.getParentNode(e);let s=void 0;if(i&&this.treeAdapter.isElementNode(i)){s=this.treeAdapter.getTagName(i)}if(s===Oe.STYLE||s===Oe.SCRIPT||s===Oe.XMP||s===Oe.IFRAME||s===Oe.NOEMBED||s===Oe.NOFRAMES||s===Oe.PLAINTEXT||s===Oe.NOSCRIPT){this.html+=t}else{this.html+=n.escapeString(t,false)}}_serializeCommentNode(e){this.html+="<!--"+this.treeAdapter.getCommentNodeContent(e)+"-->"}_serializeDocumentTypeNode(e){const t=this.treeAdapter.getDocumentTypeNodeName(e);this.html+="<"+gO.serializeContent(t,null,null)+">"}};gd.escapeString=function(n,e){n=n.replace(TO,"&").replace(bO," ");if(e){n=n.replace(vO,""")}else{n=n.replace(SO,"<").replace(CO,">")}return n};dx.exports=gd});var px=ce(yd=>{"use strict";var hx=ux();var xO=cx();yd.parse=function n(e,t){const i=new hx(t);return i.parse(e)};yd.parseFragment=function n(e,t,i){if(typeof e==="string"){i=t;t=e;e=null}const s=new hx(i);return s.parseFragment(t,e)};yd.serialize=function(n,e){const t=new xO(n,e);return t.serialize()}});var a1=ce(qr=>{"use strict";var o1=qr.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};qr.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"};qr.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};var U=qr.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};qr.SPECIAL_ELEMENTS={[o1.HTML]:{[U.ADDRESS]:true,[U.APPLET]:true,[U.AREA]:true,[U.ARTICLE]:true,[U.ASIDE]:true,[U.BASE]:true,[U.BASEFONT]:true,[U.BGSOUND]:true,[U.BLOCKQUOTE]:true,[U.BODY]:true,[U.BR]:true,[U.BUTTON]:true,[U.CAPTION]:true,[U.CENTER]:true,[U.COL]:true,[U.COLGROUP]:true,[U.DD]:true,[U.DETAILS]:true,[U.DIR]:true,[U.DIV]:true,[U.DL]:true,[U.DT]:true,[U.EMBED]:true,[U.FIELDSET]:true,[U.FIGCAPTION]:true,[U.FIGURE]:true,[U.FOOTER]:true,[U.FORM]:true,[U.FRAME]:true,[U.FRAMESET]:true,[U.H1]:true,[U.H2]:true,[U.H3]:true,[U.H4]:true,[U.H5]:true,[U.H6]:true,[U.HEAD]:true,[U.HEADER]:true,[U.HGROUP]:true,[U.HR]:true,[U.HTML]:true,[U.IFRAME]:true,[U.IMG]:true,[U.INPUT]:true,[U.LI]:true,[U.LINK]:true,[U.LISTING]:true,[U.MAIN]:true,[U.MARQUEE]:true,[U.MENU]:true,[U.META]:true,[U.NAV]:true,[U.NOEMBED]:true,[U.NOFRAMES]:true,[U.NOSCRIPT]:true,[U.OBJECT]:true,[U.OL]:true,[U.P]:true,[U.PARAM]:true,[U.PLAINTEXT]:true,[U.PRE]:true,[U.SCRIPT]:true,[U.SECTION]:true,[U.SELECT]:true,[U.SOURCE]:true,[U.STYLE]:true,[U.SUMMARY]:true,[U.TABLE]:true,[U.TBODY]:true,[U.TD]:true,[U.TEMPLATE]:true,[U.TEXTAREA]:true,[U.TFOOT]:true,[U.TH]:true,[U.THEAD]:true,[U.TITLE]:true,[U.TR]:true,[U.TRACK]:true,[U.UL]:true,[U.WBR]:true,[U.XMP]:true},[o1.MATHML]:{[U.MI]:true,[U.MO]:true,[U.MN]:true,[U.MS]:true,[U.MTEXT]:true,[U.ANNOTATION_XML]:true},[o1.SVG]:{[U.TITLE]:true,[U.FOREIGN_OBJECT]:true,[U.DESC]:true}}});var bx=ce(Td=>{"use strict";var{DOCUMENT_MODE:Hr}=a1();var gx="html";var wO="about:legacy-compat";var IO="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd";var yx=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"];var MO=yx.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);var EO=["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"];var Tx=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"];var AO=Tx.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);function mx(n){const e=n.indexOf('"')!==-1?"'":'"';return e+n+e}function fx(n,e){for(let t=0;t<e.length;t++){if(n.indexOf(e[t])===0){return true}}return false}Td.isConforming=function(n){return n.name===gx&&n.publicId===null&&(n.systemId===null||n.systemId===wO)};Td.getDocumentMode=function(n){if(n.name!==gx){return Hr.QUIRKS}const e=n.systemId;if(e&&e.toLowerCase()===IO){return Hr.QUIRKS}let t=n.publicId;if(t!==null){t=t.toLowerCase();if(EO.indexOf(t)>-1){return Hr.QUIRKS}let i=e===null?MO:yx;if(fx(t,i)){return Hr.QUIRKS}i=e===null?Tx:AO;if(fx(t,i)){return Hr.LIMITED_QUIRKS}}return Hr.NO_QUIRKS};Td.serializeContent=function(n,e,t){let i="!DOCTYPE ";if(n){i+=n}if(e){i+=" PUBLIC "+mx(e)}else if(t){i+=" SYSTEM"}if(t!==null){i+=" "+mx(t)}return i}});var xx=ce(be=>{"use strict";var RO=bx();var{DOCUMENT_MODE:kO}=a1();var vx={element:1,text:3,cdata:4,comment:8};var Sx={tagName:"name",childNodes:"children",parentNode:"parent",previousSibling:"prev",nextSibling:"next",nodeValue:"data"};var mi=class{constructor(e){for(const t of Object.keys(e)){this[t]=e[t]}}get firstChild(){const e=this.children;return e&&e[0]||null}get lastChild(){const e=this.children;return e&&e[e.length-1]||null}get nodeType(){return vx[this.type]||vx.element}};Object.keys(Sx).forEach(n=>{const e=Sx[n];Object.defineProperty(mi.prototype,n,{get:function(){return this[e]||null},set:function(t){this[e]=t;return t}})});be.createDocument=function(){return new mi({type:"root",name:"root",parent:null,prev:null,next:null,children:[],"x-mode":kO.NO_QUIRKS})};be.createDocumentFragment=function(){return new mi({type:"root",name:"root",parent:null,prev:null,next:null,children:[]})};be.createElement=function(n,e,t){const i=Object.create(null);const s=Object.create(null);const r=Object.create(null);for(let o=0;o<t.length;o++){const a=t[o].name;i[a]=t[o].value;s[a]=t[o].namespace;r[a]=t[o].prefix}return new mi({type:n==="script"||n==="style"?n:"tag",name:n,namespace:e,attribs:i,"x-attribsNamespace":s,"x-attribsPrefix":r,children:[],parent:null,prev:null,next:null})};be.createCommentNode=function(n){return new mi({type:"comment",data:n,parent:null,prev:null,next:null})};var Cx=function(n){return new mi({type:"text",data:n,parent:null,prev:null,next:null})};var u1=be.appendChild=function(n,e){const t=n.children[n.children.length-1];if(t){t.next=e;e.prev=t}n.children.push(e);e.parent=n};var PO=be.insertBefore=function(n,e,t){const i=n.children.indexOf(t);const s=t.prev;if(s){s.next=e;e.prev=s}t.prev=e;e.next=t;n.children.splice(i,0,e);e.parent=n};be.setTemplateContent=function(n,e){u1(n,e)};be.getTemplateContent=function(n){return n.children[0]};be.setDocumentType=function(n,e,t,i){const s=RO.serializeContent(e,t,i);let r=null;for(let o=0;o<n.children.length;o++){if(n.children[o].type==="directive"&&n.children[o].name==="!doctype"){r=n.children[o];break}}if(r){r.data=s;r["x-name"]=e;r["x-publicId"]=t;r["x-systemId"]=i}else{u1(n,new mi({type:"directive",name:"!doctype",data:s,"x-name":e,"x-publicId":t,"x-systemId":i}))}};be.setDocumentMode=function(n,e){n["x-mode"]=e};be.getDocumentMode=function(n){return n["x-mode"]};be.detachNode=function(n){if(n.parent){const e=n.parent.children.indexOf(n);const t=n.prev;const i=n.next;n.prev=null;n.next=null;if(t){t.next=i}if(i){i.prev=t}n.parent.children.splice(e,1);n.parent=null}};be.insertText=function(n,e){const t=n.children[n.children.length-1];if(t&&t.type==="text"){t.data+=e}else{u1(n,Cx(e))}};be.insertTextBefore=function(n,e,t){const i=n.children[n.children.indexOf(t)-1];if(i&&i.type==="text"){i.data+=e}else{PO(n,Cx(e),t)}};be.adoptAttributes=function(n,e){for(let t=0;t<e.length;t++){const i=e[t].name;if(typeof n.attribs[i]==="undefined"){n.attribs[i]=e[t].value;n["x-attribsNamespace"][i]=e[t].namespace;n["x-attribsPrefix"][i]=e[t].prefix}}};be.getFirstChild=function(n){return n.children[0]};be.getChildNodes=function(n){return n.children};be.getParentNode=function(n){return n.parent};be.getAttrList=function(n){const e=[];for(const t in n.attribs){e.push({name:t,value:n.attribs[t],namespace:n["x-attribsNamespace"][t],prefix:n["x-attribsPrefix"][t]})}return e};be.getTagName=function(n){return n.name};be.getNamespaceURI=function(n){return n.namespace};be.getTextNodeContent=function(n){return n.data};be.getCommentNodeContent=function(n){return n.data};be.getDocumentTypeNodeName=function(n){return n["x-name"]};be.getDocumentTypeNodePublicId=function(n){return n["x-publicId"]};be.getDocumentTypeNodeSystemId=function(n){return n["x-systemId"]};be.isTextNode=function(n){return n.type==="text"};be.isCommentNode=function(n){return n.type==="comment"};be.isDocumentTypeNode=function(n){return n.type==="directive"&&n.name==="!doctype"};be.isElementNode=function(n){return!!n.attribs};be.setNodeSourceCodeLocation=function(n,e){n.sourceCodeLocation=e};be.getNodeSourceCodeLocation=function(n){return n.sourceCodeLocation};be.updateNodeSourceCodeLocation=function(n,e){n.sourceCodeLocation=Object.assign(n.sourceCodeLocation,e)}});var Ix=ce((bX,wx)=>{"use strict";wx.exports={"aliceblue":[240,248,255],"antiquewhite":[250,235,215],"aqua":[0,255,255],"aquamarine":[127,255,212],"azure":[240,255,255],"beige":[245,245,220],"bisque":[255,228,196],"black":[0,0,0],"blanchedalmond":[255,235,205],"blue":[0,0,255],"blueviolet":[138,43,226],"brown":[165,42,42],"burlywood":[222,184,135],"cadetblue":[95,158,160],"chartreuse":[127,255,0],"chocolate":[210,105,30],"coral":[255,127,80],"cornflowerblue":[100,149,237],"cornsilk":[255,248,220],"crimson":[220,20,60],"cyan":[0,255,255],"darkblue":[0,0,139],"darkcyan":[0,139,139],"darkgoldenrod":[184,134,11],"darkgray":[169,169,169],"darkgreen":[0,100,0],"darkgrey":[169,169,169],"darkkhaki":[189,183,107],"darkmagenta":[139,0,139],"darkolivegreen":[85,107,47],"darkorange":[255,140,0],"darkorchid":[153,50,204],"darkred":[139,0,0],"darksalmon":[233,150,122],"darkseagreen":[143,188,143],"darkslateblue":[72,61,139],"darkslategray":[47,79,79],"darkslategrey":[47,79,79],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[105,105,105],"dimgrey":[105,105,105],"dodgerblue":[30,144,255],"firebrick":[178,34,34],"floralwhite":[255,250,240],"forestgreen":[34,139,34],"fuchsia":[255,0,255],"gainsboro":[220,220,220],"ghostwhite":[248,248,255],"gold":[255,215,0],"goldenrod":[218,165,32],"gray":[128,128,128],"green":[0,128,0],"greenyellow":[173,255,47],"grey":[128,128,128],"honeydew":[240,255,240],"hotpink":[255,105,180],"indianred":[205,92,92],"indigo":[75,0,130],"ivory":[255,255,240],"khaki":[240,230,140],"lavender":[230,230,250],"lavenderblush":[255,240,245],"lawngreen":[124,252,0],"lemonchiffon":[255,250,205],"lightblue":[173,216,230],"lightcoral":[240,128,128],"lightcyan":[224,255,255],"lightgoldenrodyellow":[250,250,210],"lightgray":[211,211,211],"lightgreen":[144,238,144],"lightgrey":[211,211,211],"lightpink":[255,182,193],"lightsalmon":[255,160,122],"lightseagreen":[32,178,170],"lightskyblue":[135,206,250],"lightslategray":[119,136,153],"lightslategrey":[119,136,153],"lightsteelblue":[176,196,222],"lightyellow":[255,255,224],"lime":[0,255,0],"limegreen":[50,205,50],"linen":[250,240,230],"magenta":[255,0,255],"maroon":[128,0,0],"mediumaquamarine":[102,205,170],"mediumblue":[0,0,205],"mediumorchid":[186,85,211],"mediumpurple":[147,112,219],"mediumseagreen":[60,179,113],"mediumslateblue":[123,104,238],"mediumspringgreen":[0,250,154],"mediumturquoise":[72,209,204],"mediumvioletred":[199,21,133],"midnightblue":[25,25,112],"mintcream":[245,255,250],"mistyrose":[255,228,225],"moccasin":[255,228,181],"navajowhite":[255,222,173],"navy":[0,0,128],"oldlace":[253,245,230],"olive":[128,128,0],"olivedrab":[107,142,35],"orange":[255,165,0],"orangered":[255,69,0],"orchid":[218,112,214],"palegoldenrod":[238,232,170],"palegreen":[152,251,152],"paleturquoise":[175,238,238],"palevioletred":[219,112,147],"papayawhip":[255,239,213],"peachpuff":[255,218,185],"peru":[205,133,63],"pink":[255,192,203],"plum":[221,160,221],"powderblue":[176,224,230],"purple":[128,0,128],"rebeccapurple":[102,51,153],"red":[255,0,0],"rosybrown":[188,143,143],"royalblue":[65,105,225],"saddlebrown":[139,69,19],"salmon":[250,128,114],"sandybrown":[244,164,96],"seagreen":[46,139,87],"seashell":[255,245,238],"sienna":[160,82,45],"silver":[192,192,192],"skyblue":[135,206,235],"slateblue":[106,90,205],"slategray":[112,128,144],"slategrey":[112,128,144],"snow":[255,250,250],"springgreen":[0,255,127],"steelblue":[70,130,180],"tan":[210,180,140],"teal":[0,128,128],"thistle":[216,191,216],"tomato":[255,99,71],"turquoise":[64,224,208],"violet":[238,130,238],"wheat":[245,222,179],"white":[255,255,255],"whitesmoke":[245,245,245],"yellow":[255,255,0],"yellowgreen":[154,205,50]}});var l1=ce((vX,Ex)=>{var Oa=Ix();var Mx={};for(const n of Object.keys(Oa)){Mx[Oa[n]]=n}var Z={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Ex.exports=Z;for(const n of Object.keys(Z)){if(!("channels"in Z[n])){throw new Error("missing channels property: "+n)}if(!("labels"in Z[n])){throw new Error("missing channel labels property: "+n)}if(Z[n].labels.length!==Z[n].channels){throw new Error("channel and label counts mismatch: "+n)}const{channels:e,labels:t}=Z[n];delete Z[n].channels;delete Z[n].labels;Object.defineProperty(Z[n],"channels",{value:e});Object.defineProperty(Z[n],"labels",{value:t})}Z.rgb.hsl=function(n){const e=n[0]/255;const t=n[1]/255;const i=n[2]/255;const s=Math.min(e,t,i);const r=Math.max(e,t,i);const o=r-s;let a;let u;if(r===s){a=0}else if(e===r){a=(t-i)/o}else if(t===r){a=2+(i-e)/o}else if(i===r){a=4+(e-t)/o}a=Math.min(a*60,360);if(a<0){a+=360}const l=(s+r)/2;if(r===s){u=0}else if(l<=.5){u=o/(r+s)}else{u=o/(2-r-s)}return[a,u*100,l*100]};Z.rgb.hsv=function(n){let e;let t;let i;let s;let r;const o=n[0]/255;const a=n[1]/255;const u=n[2]/255;const l=Math.max(o,a,u);const d=l-Math.min(o,a,u);const h=function(m){return(l-m)/6/d+1/2};if(d===0){s=0;r=0}else{r=d/l;e=h(o);t=h(a);i=h(u);if(o===l){s=i-t}else if(a===l){s=1/3+e-i}else if(u===l){s=2/3+t-e}if(s<0){s+=1}else if(s>1){s-=1}}return[s*360,r*100,l*100]};Z.rgb.hwb=function(n){const e=n[0];const t=n[1];let i=n[2];const s=Z.rgb.hsl(n)[0];const r=1/255*Math.min(e,Math.min(t,i));i=1-1/255*Math.max(e,Math.max(t,i));return[s,r*100,i*100]};Z.rgb.cmyk=function(n){const e=n[0]/255;const t=n[1]/255;const i=n[2]/255;const s=Math.min(1-e,1-t,1-i);const r=(1-e-s)/(1-s)||0;const o=(1-t-s)/(1-s)||0;const a=(1-i-s)/(1-s)||0;return[r*100,o*100,a*100,s*100]};function _O(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}Z.rgb.keyword=function(n){const e=Mx[n];if(e){return e}let t=Infinity;let i;for(const s of Object.keys(Oa)){const r=Oa[s];const o=_O(n,r);if(o<t){t=o;i=s}}return i};Z.keyword.rgb=function(n){return Oa[n]};Z.rgb.xyz=function(n){let e=n[0]/255;let t=n[1]/255;let i=n[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92;i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;const s=e*.4124+t*.3576+i*.1805;const r=e*.2126+t*.7152+i*.0722;const o=e*.0193+t*.1192+i*.9505;return[s*100,r*100,o*100]};Z.rgb.lab=function(n){const e=Z.rgb.xyz(n);let t=e[0];let i=e[1];let s=e[2];t/=95.047;i/=100;s/=108.883;t=t>.008856?t**(1/3):7.787*t+16/116;i=i>.008856?i**(1/3):7.787*i+16/116;s=s>.008856?s**(1/3):7.787*s+16/116;const r=116*i-16;const o=500*(t-i);const a=200*(i-s);return[r,o,a]};Z.hsl.rgb=function(n){const e=n[0]/360;const t=n[1]/100;const i=n[2]/100;let s;let r;let o;if(t===0){o=i*255;return[o,o,o]}if(i<.5){s=i*(1+t)}else{s=i+t-i*t}const a=2*i-s;const u=[0,0,0];for(let l=0;l<3;l++){r=e+1/3*-(l-1);if(r<0){r++}if(r>1){r--}if(6*r<1){o=a+(s-a)*6*r}else if(2*r<1){o=s}else if(3*r<2){o=a+(s-a)*(2/3-r)*6}else{o=a}u[l]=o*255}return u};Z.hsl.hsv=function(n){const e=n[0];let t=n[1]/100;let i=n[2]/100;let s=t;const r=Math.max(i,.01);i*=2;t*=i<=1?i:2-i;s*=r<=1?r:2-r;const o=(i+t)/2;const a=i===0?2*s/(r+s):2*t/(i+t);return[e,a*100,o*100]};Z.hsv.rgb=function(n){const e=n[0]/60;const t=n[1]/100;let i=n[2]/100;const s=Math.floor(e)%6;const r=e-Math.floor(e);const o=255*i*(1-t);const a=255*i*(1-t*r);const u=255*i*(1-t*(1-r));i*=255;switch(s){case 0:return[i,u,o];case 1:return[a,i,o];case 2:return[o,i,u];case 3:return[o,a,i];case 4:return[u,o,i];case 5:return[i,o,a]}};Z.hsv.hsl=function(n){const e=n[0];const t=n[1]/100;const i=n[2]/100;const s=Math.max(i,.01);let r;let o;o=(2-t)*i;const a=(2-t)*s;r=t*s;r/=a<=1?a:2-a;r=r||0;o/=2;return[e,r*100,o*100]};Z.hwb.rgb=function(n){const e=n[0]/360;let t=n[1]/100;let i=n[2]/100;const s=t+i;let r;if(s>1){t/=s;i/=s}const o=Math.floor(6*e);const a=1-i;r=6*e-o;if((o&1)!==0){r=1-r}const u=t+r*(a-t);let l;let d;let h;switch(o){default:case 6:case 0:l=a;d=u;h=t;break;case 1:l=u;d=a;h=t;break;case 2:l=t;d=a;h=u;break;case 3:l=t;d=u;h=a;break;case 4:l=u;d=t;h=a;break;case 5:l=a;d=t;h=u;break}return[l*255,d*255,h*255]};Z.cmyk.rgb=function(n){const e=n[0]/100;const t=n[1]/100;const i=n[2]/100;const s=n[3]/100;const r=1-Math.min(1,e*(1-s)+s);const o=1-Math.min(1,t*(1-s)+s);const a=1-Math.min(1,i*(1-s)+s);return[r*255,o*255,a*255]};Z.xyz.rgb=function(n){const e=n[0]/100;const t=n[1]/100;const i=n[2]/100;let s;let r;let o;s=e*3.2406+t*-1.5372+i*-.4986;r=e*-.9689+t*1.8758+i*.0415;o=e*.0557+t*-.204+i*1.057;s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92;r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92;o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92;s=Math.min(Math.max(0,s),1);r=Math.min(Math.max(0,r),1);o=Math.min(Math.max(0,o),1);return[s*255,r*255,o*255]};Z.xyz.lab=function(n){let e=n[0];let t=n[1];let i=n[2];e/=95.047;t/=100;i/=108.883;e=e>.008856?e**(1/3):7.787*e+16/116;t=t>.008856?t**(1/3):7.787*t+16/116;i=i>.008856?i**(1/3):7.787*i+16/116;const s=116*t-16;const r=500*(e-t);const o=200*(t-i);return[s,r,o]};Z.lab.xyz=function(n){const e=n[0];const t=n[1];const i=n[2];let s;let r;let o;r=(e+16)/116;s=t/500+r;o=r-i/200;const a=r**3;const u=s**3;const l=o**3;r=a>.008856?a:(r-16/116)/7.787;s=u>.008856?u:(s-16/116)/7.787;o=l>.008856?l:(o-16/116)/7.787;s*=95.047;r*=100;o*=108.883;return[s,r,o]};Z.lab.lch=function(n){const e=n[0];const t=n[1];const i=n[2];let s;const r=Math.atan2(i,t);s=r*360/2/Math.PI;if(s<0){s+=360}const o=Math.sqrt(t*t+i*i);return[e,o,s]};Z.lch.lab=function(n){const e=n[0];const t=n[1];const i=n[2];const s=i/360*2*Math.PI;const r=t*Math.cos(s);const o=t*Math.sin(s);return[e,r,o]};Z.rgb.ansi16=function(n,e=null){const[t,i,s]=n;let r=e===null?Z.rgb.hsv(n)[2]:e;r=Math.round(r/50);if(r===0){return 30}let o=30+(Math.round(s/255)<<2|Math.round(i/255)<<1|Math.round(t/255));if(r===2){o+=60}return o};Z.hsv.ansi16=function(n){return Z.rgb.ansi16(Z.hsv.rgb(n),n[2])};Z.rgb.ansi256=function(n){const e=n[0];const t=n[1];const i=n[2];if(e===t&&t===i){if(e<8){return 16}if(e>248){return 231}return Math.round((e-8)/247*24)+232}const s=16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(i/255*5);return s};Z.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7){if(n>50){e+=3.5}e=e/10.5*255;return[e,e,e]}const t=(~~(n>50)+1)*.5;const i=(e&1)*t*255;const s=(e>>1&1)*t*255;const r=(e>>2&1)*t*255;return[i,s,r]};Z.ansi256.rgb=function(n){if(n>=232){const r=(n-232)*10+8;return[r,r,r]}n-=16;let e;const t=Math.floor(n/36)/5*255;const i=Math.floor((e=n%36)/6)/5*255;const s=e%6/5*255;return[t,i,s]};Z.rgb.hex=function(n){const e=((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255);const t=e.toString(16).toUpperCase();return"000000".substring(t.length)+t};Z.hex.rgb=function(n){const e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e){return[0,0,0]}let t=e[0];if(e[0].length===3){t=t.split("").map(a=>{return a+a}).join("")}const i=parseInt(t,16);const s=i>>16&255;const r=i>>8&255;const o=i&255;return[s,r,o]};Z.rgb.hcg=function(n){const e=n[0]/255;const t=n[1]/255;const i=n[2]/255;const s=Math.max(Math.max(e,t),i);const r=Math.min(Math.min(e,t),i);const o=s-r;let a;let u;if(o<1){a=r/(1-o)}else{a=0}if(o<=0){u=0}else if(s===e){u=(t-i)/o%6}else if(s===t){u=2+(i-e)/o}else{u=4+(e-t)/o}u/=6;u%=1;return[u*360,o*100,a*100]};Z.hsl.hcg=function(n){const e=n[1]/100;const t=n[2]/100;const i=t<.5?2*e*t:2*e*(1-t);let s=0;if(i<1){s=(t-.5*i)/(1-i)}return[n[0],i*100,s*100]};Z.hsv.hcg=function(n){const e=n[1]/100;const t=n[2]/100;const i=e*t;let s=0;if(i<1){s=(t-i)/(1-i)}return[n[0],i*100,s*100]};Z.hcg.rgb=function(n){const e=n[0]/360;const t=n[1]/100;const i=n[2]/100;if(t===0){return[i*255,i*255,i*255]}const s=[0,0,0];const r=e%1*6;const o=r%1;const a=1-o;let u=0;switch(Math.floor(r)){case 0:s[0]=1;s[1]=o;s[2]=0;break;case 1:s[0]=a;s[1]=1;s[2]=0;break;case 2:s[0]=0;s[1]=1;s[2]=o;break;case 3:s[0]=0;s[1]=a;s[2]=1;break;case 4:s[0]=o;s[1]=0;s[2]=1;break;default:s[0]=1;s[1]=0;s[2]=a}u=(1-t)*i;return[(t*s[0]+u)*255,(t*s[1]+u)*255,(t*s[2]+u)*255]};Z.hcg.hsv=function(n){const e=n[1]/100;const t=n[2]/100;const i=e+t*(1-e);let s=0;if(i>0){s=e/i}return[n[0],s*100,i*100]};Z.hcg.hsl=function(n){const e=n[1]/100;const t=n[2]/100;const i=t*(1-e)+.5*e;let s=0;if(i>0&&i<.5){s=e/(2*i)}else if(i>=.5&&i<1){s=e/(2*(1-i))}return[n[0],s*100,i*100]};Z.hcg.hwb=function(n){const e=n[1]/100;const t=n[2]/100;const i=e+t*(1-e);return[n[0],(i-e)*100,(1-i)*100]};Z.hwb.hcg=function(n){const e=n[1]/100;const t=n[2]/100;const i=1-t;const s=i-e;let r=0;if(s<1){r=(i-s)/(1-s)}return[n[0],s*100,r*100]};Z.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};Z.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};Z.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};Z.gray.hsl=function(n){return[0,0,n[0]]};Z.gray.hsv=Z.gray.hsl;Z.gray.hwb=function(n){return[0,100,n[0]]};Z.gray.cmyk=function(n){return[0,0,0,n[0]]};Z.gray.lab=function(n){return[n[0],0,0]};Z.gray.hex=function(n){const e=Math.round(n[0]/100*255)&255;const t=(e<<16)+(e<<8)+e;const i=t.toString(16).toUpperCase();return"000000".substring(i.length)+i};Z.rgb.gray=function(n){const e=(n[0]+n[1]+n[2])/3;return[e/255*100]}});var Rx=ce((SX,Ax)=>{var bd=l1();function LO(){const n={};const e=Object.keys(bd);for(let t=e.length,i=0;i<t;i++){n[e[i]]={distance:-1,parent:null}}return n}function OO(n){const e=LO();const t=[n];e[n].distance=0;while(t.length){const i=t.pop();const s=Object.keys(bd[i]);for(let r=s.length,o=0;o<r;o++){const a=s[o];const u=e[a];if(u.distance===-1){u.distance=e[i].distance+1;u.parent=i;t.unshift(a)}}}return e}function DO(n,e){return function(t){return e(n(t))}}function NO(n,e){const t=[e[n].parent,n];let i=bd[e[n].parent][n];let s=e[n].parent;while(e[s].parent){t.unshift(e[s].parent);i=DO(bd[e[s].parent][s],i);s=e[s].parent}i.conversion=t;return i}Ax.exports=function(n){const e=OO(n);const t={};const i=Object.keys(e);for(let s=i.length,r=0;r<s;r++){const o=i[r];const a=e[o];if(a.parent===null){continue}t[o]=NO(o,e)}return t}});var Px=ce((CX,kx)=>{var d1=l1();var FO=Rx();var Ur={};var $O=Object.keys(d1);function BO(n){const e=function(...t){const i=t[0];if(i===void 0||i===null){return i}if(i.length>1){t=i}return n(t)};if("conversion"in n){e.conversion=n.conversion}return e}function qO(n){const e=function(...t){const i=t[0];if(i===void 0||i===null){return i}if(i.length>1){t=i}const s=n(t);if(typeof s==="object"){for(let r=s.length,o=0;o<r;o++){s[o]=Math.round(s[o])}}return s};if("conversion"in n){e.conversion=n.conversion}return e}$O.forEach(n=>{Ur[n]={};Object.defineProperty(Ur[n],"channels",{value:d1[n].channels});Object.defineProperty(Ur[n],"labels",{value:d1[n].labels});const e=FO(n);const t=Object.keys(e);t.forEach(i=>{const s=e[i];Ur[n][i]=qO(s);Ur[n][i].raw=BO(s)})});kx.exports=Ur});var Fx=ce((xX,Nx)=>{"use strict";var _x=(n,e)=>(...t)=>{const i=n(...t);return`\x1B[${i+e}m`};var Lx=(n,e)=>(...t)=>{const i=n(...t);return`\x1B[${38+e};5;${i}m`};var Ox=(n,e)=>(...t)=>{const i=n(...t);return`\x1B[${38+e};2;${i[0]};${i[1]};${i[2]}m`};var vd=n=>n;var Dx=(n,e,t)=>[n,e,t];var Kr=(n,e,t)=>{Object.defineProperty(n,e,{get:()=>{const i=t();Object.defineProperty(n,e,{value:i,enumerable:true,configurable:true});return i},enumerable:true,configurable:true})};var c1;var Wr=(n,e,t,i)=>{if(c1===void 0){c1=Px()}const s=i?10:0;const r={};for(const[o,a]of Object.entries(c1)){const u=o==="ansi16"?"ansi":o;if(o===e){r[u]=n(t,s)}else if(typeof a==="object"){r[u]=n(a[e],s)}}return r};function HO(){const n=new Map;const e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright;e.bgColor.bgGray=e.bgColor.bgBlackBright;e.color.grey=e.color.blackBright;e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(const[t,i]of Object.entries(e)){for(const[s,r]of Object.entries(i)){e[s]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`};i[s]=e[s];n.set(r[0],r[1])}Object.defineProperty(e,t,{value:i,enumerable:false})}Object.defineProperty(e,"codes",{value:n,enumerable:false});e.color.close="\x1B[39m";e.bgColor.close="\x1B[49m";Kr(e.color,"ansi",()=>Wr(_x,"ansi16",vd,false));Kr(e.color,"ansi256",()=>Wr(Lx,"ansi256",vd,false));Kr(e.color,"ansi16m",()=>Wr(Ox,"rgb",Dx,false));Kr(e.bgColor,"ansi",()=>Wr(_x,"ansi16",vd,true));Kr(e.bgColor,"ansi256",()=>Wr(Lx,"ansi256",vd,true));Kr(e.bgColor,"ansi16m",()=>Wr(Ox,"rgb",Dx,true));return e}Object.defineProperty(Nx,"exports",{enumerable:true,get:HO})});var Bx=ce((wX,$x)=>{"use strict";var UO=(n,e,t)=>{let i=n.indexOf(e);if(i===-1){return n}const s=e.length;let r=0;let o="";do{o+=n.substr(r,i-r)+e+t;r=i+s;i=n.indexOf(e,r)}while(i!==-1);o+=n.substr(r);return o};var KO=(n,e,t,i)=>{let s=0;let r="";do{const o=n[i-1]==="\r";r+=n.substr(s,(o?i-1:i)-s)+e+(o?"\r\n":"\n")+t;s=i+1;i=n.indexOf("\n",s)}while(i!==-1);r+=n.substr(s);return r};$x.exports={stringReplaceAll:UO,stringEncaseCRLFWithFirstIndex:KO}});var Wx=ce((IX,Kx)=>{"use strict";var WO=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;var qx=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;var jO=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;var VO=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;var GO=new Map([["n","\n"],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Ux(n){const e=n[0]==="u";const t=n[1]==="{";if(e&&!t&&n.length===5||n[0]==="x"&&n.length===3){return String.fromCharCode(parseInt(n.slice(1),16))}if(e&&t){return String.fromCodePoint(parseInt(n.slice(2,-1),16))}return GO.get(n)||n}function zO(n,e){const t=[];const i=e.trim().split(/\s*,\s*/g);let s;for(const r of i){const o=Number(r);if(!Number.isNaN(o)){t.push(o)}else if(s=r.match(jO)){t.push(s[2].replace(VO,(a,u,l)=>u?Ux(u):l))}else{throw new Error(`Invalid Chalk template style argument: ${r} (in style '${n}')`)}}return t}function QO(n){qx.lastIndex=0;const e=[];let t;while((t=qx.exec(n))!==null){const i=t[1];if(t[2]){const s=zO(i,t[2]);e.push([i].concat(s))}else{e.push([i])}}return e}function Hx(n,e){const t={};for(const s of e){for(const r of s.styles){t[r[0]]=s.inverse?null:r.slice(1)}}let i=n;for(const[s,r]of Object.entries(t)){if(!Array.isArray(r)){continue}if(!(s in i)){throw new Error(`Unknown Chalk style: ${s}`)}i=r.length>0?i[s](...r):i[s]}return i}Kx.exports=(n,e)=>{const t=[];const i=[];let s=[];e.replace(WO,(r,o,a,u,l,d)=>{if(o){s.push(Ux(o))}else if(u){const h=s.join("");s=[];i.push(t.length===0?h:Hx(n,t)(h));t.push({inverse:a,styles:QO(u)})}else if(l){if(t.length===0){throw new Error("Found extraneous } in Chalk template literal")}i.push(Hx(n,t)(s.join("")));s=[];t.pop()}else{s.push(d)}});i.push(s.join(""));if(t.length>0){const r=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return i.join("")}});var Xx=ce((MX,Yx)=>{"use strict";var Da=Fx();var{stdout:p1,stderr:m1}=w9();var{stringReplaceAll:YO,stringEncaseCRLFWithFirstIndex:XO}=Bx();var{isArray:Sd}=Array;var Vx=["ansi","ansi","ansi256","ansi16m"];var jr=Object.create(null);var JO=(n,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3)){throw new Error("The `level` option should be an integer from 0 to 3")}const t=p1?p1.level:0;n.level=e.level===void 0?t:e.level};var f1=class{constructor(e){return Gx(e)}};var Gx=n=>{const e={};JO(e,n);e.template=(...t)=>Qx(e.template,...t);Object.setPrototypeOf(e,Cd.prototype);Object.setPrototypeOf(e.template,e);e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")};e.template.Instance=f1;return e.template};function Cd(n){return Gx(n)}for(const[n,e]of Object.entries(Da)){jr[n]={get(){const t=xd(this,g1(e.open,e.close,this._styler),this._isEmpty);Object.defineProperty(this,n,{value:t});return t}}}jr.visible={get(){const n=xd(this,this._styler,true);Object.defineProperty(this,"visible",{value:n});return n}};var zx=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(const n of zx){jr[n]={get(){const{level:e}=this;return function(...t){const i=g1(Da.color[Vx[e]][n](...t),Da.color.close,this._styler);return xd(this,i,this._isEmpty)}}}}for(const n of zx){const e="bg"+n[0].toUpperCase()+n.slice(1);jr[e]={get(){const{level:t}=this;return function(...i){const s=g1(Da.bgColor[Vx[t]][n](...i),Da.bgColor.close,this._styler);return xd(this,s,this._isEmpty)}}}}var ZO=Object.defineProperties(()=>{},{...jr,level:{enumerable:true,get(){return this._generator.level},set(n){this._generator.level=n}}});var g1=(n,e,t)=>{let i;let s;if(t===void 0){i=n;s=e}else{i=t.openAll+n;s=e+t.closeAll}return{open:n,close:e,openAll:i,closeAll:s,parent:t}};var xd=(n,e,t)=>{const i=(...s)=>{if(Sd(s[0])&&Sd(s[0].raw)){return jx(i,Qx(i,...s))}return jx(i,s.length===1?""+s[0]:s.join(" "))};Object.setPrototypeOf(i,ZO);i._generator=n;i._styler=e;i._isEmpty=t;return i};var jx=(n,e)=>{if(n.level<=0||!e){return n._isEmpty?"":e}let t=n._styler;if(t===void 0){return e}const{openAll:i,closeAll:s}=t;if(e.indexOf("\x1B")!==-1){while(t!==void 0){e=YO(e,t.close,t.open);t=t.parent}}const r=e.indexOf("\n");if(r!==-1){e=XO(e,s,i,r)}return i+e+s};var h1;var Qx=(n,...e)=>{const[t]=e;if(!Sd(t)||!Sd(t.raw)){return e.join(" ")}const i=e.slice(1);const s=[t.raw[0]];for(let r=1;r<t.length;r++){s.push(String(i[r-1]).replace(/[{}\\]/g,"\\$&"),String(t.raw[r]))}if(h1===void 0){h1=Wx()}return h1(n,s.join(""))};Object.defineProperties(Cd.prototype,jr);var wd=Cd();wd.supportsColor=p1;wd.stderr=Cd({level:m1?m1.level:0});wd.stderr.supportsColor=m1;Yx.exports=wd});var y1=ce(ue=>{"use strict";var e6=ue&&ue.__importDefault||function(n){return n&&n.__esModule?n:{"default":n}};Object.defineProperty(ue,"__esModule",{value:true});ue.parse=ue.stringify=ue.toJson=ue.fromJson=ue.DEFAULT_THEME=ue.plain=void 0;var ze=e6(Xx());var t6=function(n){return n};ue.plain=t6;ue.DEFAULT_THEME={keyword:ze.default.blue,built_in:ze.default.cyan,type:ze.default.cyan.dim,literal:ze.default.blue,number:ze.default.green,regexp:ze.default.red,string:ze.default.red,subst:ue.plain,symbol:ue.plain,class:ze.default.blue,function:ze.default.yellow,title:ue.plain,params:ue.plain,comment:ze.default.green,doctag:ze.default.green,meta:ze.default.grey,"meta-keyword":ue.plain,"meta-string":ue.plain,section:ue.plain,tag:ze.default.grey,name:ze.default.blue,"builtin-name":ue.plain,attr:ze.default.cyan,attribute:ue.plain,variable:ue.plain,bullet:ue.plain,code:ue.plain,emphasis:ze.default.italic,strong:ze.default.bold,formula:ue.plain,link:ze.default.underline,quote:ue.plain,"selector-tag":ue.plain,"selector-id":ue.plain,"selector-class":ue.plain,"selector-attr":ue.plain,"selector-pseudo":ue.plain,"template-tag":ue.plain,"template-variable":ue.plain,addition:ze.default.green,deletion:ze.default.red,default:ue.plain};function Jx(n){var e={};for(var t=0,i=Object.keys(n);t<i.length;t++){var s=i[t];var r=n[s];if(Array.isArray(r)){;e[s]=r.reduce(function(o,a){return a==="plain"?ue.plain:o[a]},ze.default)}else{;e[s]=ze.default[r]}}return e}ue.fromJson=Jx;function Zx(n){var e={};for(var t=0,i=Object.keys(e);t<i.length;t++){var s=i[t];var r=e[s];e[s]=r._styles}return e}ue.toJson=Zx;function n6(n){return JSON.stringify(Zx(n))}ue.stringify=n6;function i6(n){return Jx(JSON.parse(n))}ue.parse=i6});var iw=ce(Xe=>{"use strict";var ew=Xe&&Xe.__createBinding||(Object.create?(function(n,e,t,i){if(i===void 0)i=t;Object.defineProperty(n,i,{enumerable:true,get:function(){return e[t]}})}):(function(n,e,t,i){if(i===void 0)i=t;n[i]=e[t]}));var s6=Xe&&Xe.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:true,value:e})}):function(n,e){n["default"]=e});var tw=Xe&&Xe.__importStar||function(n){if(n&&n.__esModule)return n;var e={};if(n!=null){for(var t in n)if(t!=="default"&&Object.prototype.hasOwnProperty.call(n,t))ew(e,n,t)}s6(e,n);return e};var r6=Xe&&Xe.__exportStar||function(n,e){for(var t in n)if(t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t))ew(e,n,t)};var o6=Xe&&Xe.__importDefault||function(n){return n&&n.__esModule?n:{"default":n}};Object.defineProperty(Xe,"__esModule",{value:true});Xe.supportsLanguage=Xe.listLanguages=Xe.highlight=void 0;var Md=tw(I9());var a6=tw(px());var u6=o6(xx());var Id=y1();function T1(n,e,t){if(e===void 0){e={}}switch(n.type){case"text":{var i=n.data;if(t===void 0){return(e.default||Id.DEFAULT_THEME.default||Id.plain)(i)}return i}case"tag":{var s=/hljs-(\w+)/.exec(n.attribs.class);if(s){var r=s[1];var o=n.childNodes.map(function(a){return T1(a,e,r)}).join("");return(e[r]||Id.DEFAULT_THEME[r]||Id.plain)(o)}return n.childNodes.map(function(a){return T1(a,e)}).join("")}}throw new Error("Invalid node type "+n.type)}function l6(n,e){if(e===void 0){e={}}var t=a6.parseFragment(n,{treeAdapter:u6.default});return t.childNodes.map(function(i){return T1(i,e)}).join("")}function nw(n,e){if(e===void 0){e={}}var t;if(e.language){t=Md.highlight(n,{language:e.language,ignoreIllegals:e.ignoreIllegals}).value}else{t=Md.highlightAuto(n,e.languageSubset).value}return l6(t,e.theme)}Xe.highlight=nw;function d6(){return Md.listLanguages()}Xe.listLanguages=d6;function c6(n){return!!Md.getLanguage(n)}Xe.supportsLanguage=c6;Xe.default=nw;r6(y1(),Xe)});import{spawn as dj}from"node:child_process";import{existsSync as cj,statSync as hj}from"node:fs";import{homedir as pj}from"node:os";import mj from"node:path";import{performance as On}from"node:perf_hooks";function Tm(){return{async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var bs=Tm();function Rb(n){bs=n}var ys={exec:()=>null};function rr(n){let e=[];return t=>{let i=Math.max(0,Math.min(3,t-1)),s=e[i];return s||(s=n(i),e[i]=s),s}}function le(n,e=""){let t=typeof n=="string"?n:n.source,i={replace:(s,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(vt.caret,"$1"),t=t.replace(s,o),i},getRegex:()=>new RegExp(t,e)};return i}var E9=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return false}})();var vt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:rr(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:rr(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:rr(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:rr(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:rr(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:rr(n=>new RegExp(`^ {0,${n}}>`))};var A9=/^(?:[ \t]*(?:\n|$))+/;var R9=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;var k9=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;var jo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;var P9=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;var bm=/ {0,3}(?:[*+-]|\d{1,9}[.)])/;var kb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;var Pb=le(kb).replace(/bull/g,bm).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex();var _9=le(kb).replace(/bull/g,bm).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();var vm=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;var L9=/^[^\n]+/;var Sm=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;var O9=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Sm).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();var D9=le(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,bm).getRegex();var ju="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";var Cm=/<!--(?:-?>|[\s\S]*?(?:-->|$))/;var N9=le("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Cm).replace("tag",ju).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();var _b=n=>le(vm).replace("hr",jo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ju).getRegex();var F9=_b(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);var $9=_b(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);var B9=le(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",$9).getRegex();var xm={blockquote:B9,code:R9,def:O9,fences:k9,heading:P9,hr:jo,html:N9,lheading:Pb,list:D9,newline:A9,paragraph:F9,table:ys,text:L9};var Cb=le("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",jo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ju).getRegex();var q9={...xm,lheading:_9,table:Cb,paragraph:le(vm).replace("hr",jo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Cb).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ju).getRegex()};var H9={...xm,html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Cm).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:ys,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:le(vm).replace("hr",jo).replace("heading",` *#{1,6} *[^
|
|
2
|
+
import{c as um,d as lm,e as xT,g as wT,h as IT,i as DT}from"./chunk-BWR3NJFR.js";import{a as FT,b as hm,c as Ho,d as WT,e as jT,f as VT,h as pm}from"./chunk-NWMN2FDO.js";import{h as dm,o as ET}from"./chunk-K6C7372U.js";import{a as sn,b as JT,c as nb,d as ub}from"./chunk-RQJU3CYQ.js";import{a as vn,b as x,g as ZT,h as eb,i as tb,j as $i,k as Uo,m as ib,n as sb}from"./chunk-GS7TCNDK.js";import{a as ms,b as cb,c as Sb}from"./chunk-DBSRTVJC.js";import{a as rb}from"./chunk-QWGJTTQL.js";import"./chunk-THPIH2MC.js";import{a as ob}from"./chunk-L6OMXWRF.js";import{a as $T,b as BT,d as qT}from"./chunk-AKUP5CLI.js";import{b as Tb,c as bb}from"./chunk-ETWTIQXF.js";import{a as NT,b as gb,c as yb}from"./chunk-SRTYTXAC.js";import{b as hb,e as pb,f as mb,g as fb}from"./chunk-PGYNNAKS.js";import{a as zT,b as QT,c as YT,d as XT,e as qn,h as ab,k as gs,m as lb,n as Bi,o as db,p as Hu,q as mm}from"./chunk-UEPKZSE6.js";import{a as nr,b as ir,c as Nn,d as qo,e as N,h as ct,i as Fu}from"./chunk-U6RWF7BC.js";import{a as $n,b as HT,c as $u,f as UT,j as KT,k as fs,m as Bn,n as Bu,o as qu,q as Ni,r as GT,s as Fi}from"./chunk-CUPCI2YC.js";import{a as MT}from"./chunk-ME57CPMB.js";import{a as vb}from"./chunk-QMBFFQPV.js";import"./chunk-RZDVNG5Z.js";import{a as OT}from"./chunk-3LRARE6Z.js";import{a as I9}from"./chunk-JMC5JQHT.js";import{a as w9}from"./chunk-XVGF4Y4P.js";import{d as CT}from"./chunk-LC7ZI6EV.js";import{d as ST}from"./chunk-V6SXVN2Z.js";import"./chunk-7WOIEENL.js";import{d as bT,e as vT}from"./chunk-WUORF7YS.js";import{c as TT}from"./chunk-WHBWI5OQ.js";import{A as PT,B as _T,C as LT,l as AT,m as qt,o as RT,p as ps,u as kT}from"./chunk-O5EROATK.js";import"./chunk-NJAER6QW.js";import{a as Fn}from"./chunk-PIADSVUZ.js";import"./chunk-ZJZBXSNG.js";import"./chunk-OLQR4XQZ.js";import"./chunk-ASRGXT22.js";import"./chunk-FJEP2EHP.js";import"./chunk-HMLSH6YL.js";import"./chunk-PIV6YF7B.js";import"./chunk-D2BEUF36.js";import"./chunk-2EBHD6KJ.js";import"./chunk-3KTXNSLL.js";import"./chunk-SKLKXOH4.js";import"./chunk-QASV4FRT.js";import"./chunk-W7O5Y6VY.js";import"./chunk-E3RI7IHR.js";import"./chunk-NT6GUYYJ.js";import"./chunk-3ZEDGMQ4.js";import{a as gT,e as yT}from"./chunk-TRX2HFTB.js";import{na as hT,oa as pT,wa as mT}from"./chunk-XWNCITOR.js";import{l as am}from"./chunk-ISBSRM3S.js";import{o as Bo}from"./chunk-3MLT4F77.js";import"./chunk-UQL67NEA.js";import"./chunk-ZK7UCXBX.js";import"./chunk-2YX4JWQ4.js";import"./chunk-T4KXNSN3.js";import"./chunk-LVGBQ7NP.js";import"./chunk-SK4JBJDF.js";import"./chunk-YHXW6NMN.js";import"./chunk-NG2L523L.js";import{d as cm}from"./chunk-UE7MODZO.js";import"./chunk-HVCY6M5J.js";import"./chunk-XWU4BV73.js";import"./chunk-NUHYT7HY.js";import"./chunk-FHJWUDED.js";import"./chunk-4QXF4OT5.js";import"./chunk-6MFNDZP7.js";import"./chunk-4GGSPZK3.js";import"./chunk-IONMKU5J.js";import"./chunk-AODHXPQF.js";import{h as fT}from"./chunk-AUG3KCLV.js";import{nb as M9}from"./chunk-JEHPL5Z6.js";import"./chunk-DSIZQTS3.js";import"./chunk-7F3QKGB7.js";import"./chunk-OKOOSGFE.js";import"./chunk-INIZLM6Q.js";import"./chunk-ELQ5G4U6.js";import"./chunk-BF4U2LYQ.js";import"./chunk-GJ3NP2JO.js";import"./chunk-WXD24E23.js";import"./chunk-2PNC3MM4.js";import"./chunk-4QKCRKWB.js";import"./chunk-YNDFGYGN.js";import"./chunk-NEICESQ2.js";import"./chunk-TXWPPTYK.js";import"./chunk-5RFGU5IW.js";import"./chunk-QH5Z4N4A.js";import"./chunk-WTI4WCBV.js";import"./chunk-PTV7FFNF.js";import"./chunk-TAEC3WRM.js";import"./chunk-3XYKJXXO.js";import"./chunk-4A4KPPPE.js";import{a as sr}from"./chunk-VAARXN34.js";import{c as ce,e as cT}from"./chunk-FK3SSGJE.js";var Fl=ce(oi=>{"use strict";var K_=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];oi.REPLACEMENT_CHARACTER="\uFFFD";oi.CODE_POINTS={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533};oi.CODE_POINT_SEQUENCES={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]};oi.isSurrogate=function(n){return n>=55296&&n<=57343};oi.isSurrogatePair=function(n){return n>=56320&&n<=57343};oi.getSurrogatePairCodePoint=function(n,e){return(n-55296)*1024+9216+e};oi.isControlCodePoint=function(n){return n!==32&&n!==10&&n!==13&&n!==9&&n!==12&&n>=1&&n<=31||n>=127&&n<=159};oi.isUndefinedCodePoint=function(n){return n>=64976&&n<=65007||K_.indexOf(n)>-1}});var $l=ce((GY,nS)=>{"use strict";nS.exports={controlCharacterInInputStream:"control-character-in-input-stream",noncharacterInInputStream:"noncharacter-in-input-stream",surrogateInInputStream:"surrogate-in-input-stream",nonVoidHtmlElementStartTagWithTrailingSolidus:"non-void-html-element-start-tag-with-trailing-solidus",endTagWithAttributes:"end-tag-with-attributes",endTagWithTrailingSolidus:"end-tag-with-trailing-solidus",unexpectedSolidusInTag:"unexpected-solidus-in-tag",unexpectedNullCharacter:"unexpected-null-character",unexpectedQuestionMarkInsteadOfTagName:"unexpected-question-mark-instead-of-tag-name",invalidFirstCharacterOfTagName:"invalid-first-character-of-tag-name",unexpectedEqualsSignBeforeAttributeName:"unexpected-equals-sign-before-attribute-name",missingEndTagName:"missing-end-tag-name",unexpectedCharacterInAttributeName:"unexpected-character-in-attribute-name",unknownNamedCharacterReference:"unknown-named-character-reference",missingSemicolonAfterCharacterReference:"missing-semicolon-after-character-reference",unexpectedCharacterAfterDoctypeSystemIdentifier:"unexpected-character-after-doctype-system-identifier",unexpectedCharacterInUnquotedAttributeValue:"unexpected-character-in-unquoted-attribute-value",eofBeforeTagName:"eof-before-tag-name",eofInTag:"eof-in-tag",missingAttributeValue:"missing-attribute-value",missingWhitespaceBetweenAttributes:"missing-whitespace-between-attributes",missingWhitespaceAfterDoctypePublicKeyword:"missing-whitespace-after-doctype-public-keyword",missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:"missing-whitespace-between-doctype-public-and-system-identifiers",missingWhitespaceAfterDoctypeSystemKeyword:"missing-whitespace-after-doctype-system-keyword",missingQuoteBeforeDoctypePublicIdentifier:"missing-quote-before-doctype-public-identifier",missingQuoteBeforeDoctypeSystemIdentifier:"missing-quote-before-doctype-system-identifier",missingDoctypePublicIdentifier:"missing-doctype-public-identifier",missingDoctypeSystemIdentifier:"missing-doctype-system-identifier",abruptDoctypePublicIdentifier:"abrupt-doctype-public-identifier",abruptDoctypeSystemIdentifier:"abrupt-doctype-system-identifier",cdataInHtmlContent:"cdata-in-html-content",incorrectlyOpenedComment:"incorrectly-opened-comment",eofInScriptHtmlCommentLikeText:"eof-in-script-html-comment-like-text",eofInDoctype:"eof-in-doctype",nestedComment:"nested-comment",abruptClosingOfEmptyComment:"abrupt-closing-of-empty-comment",eofInComment:"eof-in-comment",incorrectlyClosedComment:"incorrectly-closed-comment",eofInCdata:"eof-in-cdata",absenceOfDigitsInNumericCharacterReference:"absence-of-digits-in-numeric-character-reference",nullCharacterReference:"null-character-reference",surrogateCharacterReference:"surrogate-character-reference",characterReferenceOutsideUnicodeRange:"character-reference-outside-unicode-range",controlCharacterReference:"control-character-reference",noncharacterCharacterReference:"noncharacter-character-reference",missingWhitespaceBeforeDoctypeName:"missing-whitespace-before-doctype-name",missingDoctypeName:"missing-doctype-name",invalidCharacterSequenceAfterDoctypeName:"invalid-character-sequence-after-doctype-name",duplicateAttribute:"duplicate-attribute",nonConformingDoctype:"non-conforming-doctype",missingDoctype:"missing-doctype",misplacedDoctype:"misplaced-doctype",endTagWithoutMatchingOpenElement:"end-tag-without-matching-open-element",closingOfElementWithOpenChildElements:"closing-of-element-with-open-child-elements",disallowedContentInNoscriptInHead:"disallowed-content-in-noscript-in-head",openElementsLeftAfterEof:"open-elements-left-after-eof",abandonedHeadElementChild:"abandoned-head-element-child",misplacedStartTagForHeadElement:"misplaced-start-tag-for-head-element",nestedNoscriptInHead:"nested-noscript-in-head",eofInElementThatCanContainOnlyText:"eof-in-element-that-can-contain-only-text"}});var sS=ce((zY,iS)=>{"use strict";var _r=Fl();var vf=$l();var _s=_r.CODE_POINTS;var W_=1<<16;var Sf=class{constructor(){this.html=null;this.pos=-1;this.lastGapPos=-1;this.lastCharPos=-1;this.gapStack=[];this.skipNextNewLine=false;this.lastChunkWritten=false;this.endOfChunkHit=false;this.bufferWaterline=W_}_err(){}_addGap(){this.gapStack.push(this.lastGapPos);this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.lastCharPos){const t=this.html.charCodeAt(this.pos+1);if(_r.isSurrogatePair(t)){this.pos++;this._addGap();return _r.getSurrogatePairCodePoint(e,t)}}else if(!this.lastChunkWritten){this.endOfChunkHit=true;return _s.EOF}this._err(vf.surrogateInInputStream);return e}dropParsedChunk(){if(this.pos>this.bufferWaterline){this.lastCharPos-=this.pos;this.html=this.html.substring(this.pos);this.pos=0;this.lastGapPos=-1;this.gapStack=[]}}write(e,t){if(this.html){this.html+=e}else{this.html=e}this.lastCharPos=this.html.length-1;this.endOfChunkHit=false;this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1,this.html.length);this.lastCharPos=this.html.length-1;this.endOfChunkHit=false}advance(){this.pos++;if(this.pos>this.lastCharPos){this.endOfChunkHit=!this.lastChunkWritten;return _s.EOF}let e=this.html.charCodeAt(this.pos);if(this.skipNextNewLine&&e===_s.LINE_FEED){this.skipNextNewLine=false;this._addGap();return this.advance()}if(e===_s.CARRIAGE_RETURN){this.skipNextNewLine=true;return _s.LINE_FEED}this.skipNextNewLine=false;if(_r.isSurrogate(e)){e=this._processSurrogate(e)}const t=e>31&&e<127||e===_s.LINE_FEED||e===_s.CARRIAGE_RETURN||e>159&&e<64976;if(!t){this._checkForProblematicCharacters(e)}return e}_checkForProblematicCharacters(e){if(_r.isControlCodePoint(e)){this._err(vf.controlCharacterInInputStream)}else if(_r.isUndefinedCodePoint(e)){this._err(vf.noncharacterInInputStream)}}retreat(){if(this.pos===this.lastGapPos){this.lastGapPos=this.gapStack.pop();this.pos--}this.pos--}};iS.exports=Sf});var oS=ce((QY,rS)=>{"use strict";rS.exports=new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4e3,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,1e4,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13e3,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204])});var xa=ce((YY,sC)=>{"use strict";var j_=sS();var ke=Fl();var Ds=oS();var F=$l();var M=ke.CODE_POINTS;var Ls=ke.CODE_POINT_SEQUENCES;var V_={128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376};var JS=1<<0;var ZS=1<<1;var eC=1<<2;var G_=JS|ZS|eC;var he="DATA_STATE";var Or="RCDATA_STATE";var Sa="RAWTEXT_STATE";var li="SCRIPT_DATA_STATE";var tC="PLAINTEXT_STATE";var aS="TAG_OPEN_STATE";var uS="END_TAG_OPEN_STATE";var Cf="TAG_NAME_STATE";var lS="RCDATA_LESS_THAN_SIGN_STATE";var dS="RCDATA_END_TAG_OPEN_STATE";var cS="RCDATA_END_TAG_NAME_STATE";var hS="RAWTEXT_LESS_THAN_SIGN_STATE";var pS="RAWTEXT_END_TAG_OPEN_STATE";var mS="RAWTEXT_END_TAG_NAME_STATE";var fS="SCRIPT_DATA_LESS_THAN_SIGN_STATE";var gS="SCRIPT_DATA_END_TAG_OPEN_STATE";var yS="SCRIPT_DATA_END_TAG_NAME_STATE";var TS="SCRIPT_DATA_ESCAPE_START_STATE";var bS="SCRIPT_DATA_ESCAPE_START_DASH_STATE";var In="SCRIPT_DATA_ESCAPED_STATE";var vS="SCRIPT_DATA_ESCAPED_DASH_STATE";var xf="SCRIPT_DATA_ESCAPED_DASH_DASH_STATE";var Bl="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE";var SS="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE";var CS="SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE";var xS="SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE";var ai="SCRIPT_DATA_DOUBLE_ESCAPED_STATE";var wS="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE";var IS="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE";var ql="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE";var MS="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE";var Kn="BEFORE_ATTRIBUTE_NAME_STATE";var Hl="ATTRIBUTE_NAME_STATE";var wf="AFTER_ATTRIBUTE_NAME_STATE";var If="BEFORE_ATTRIBUTE_VALUE_STATE";var Ul="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE";var Kl="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE";var Wl="ATTRIBUTE_VALUE_UNQUOTED_STATE";var Mf="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE";var ji="SELF_CLOSING_START_TAG_STATE";var ya="BOGUS_COMMENT_STATE";var ES="MARKUP_DECLARATION_OPEN_STATE";var AS="COMMENT_START_STATE";var RS="COMMENT_START_DASH_STATE";var Vi="COMMENT_STATE";var kS="COMMENT_LESS_THAN_SIGN_STATE";var PS="COMMENT_LESS_THAN_SIGN_BANG_STATE";var _S="COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE";var LS="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE";var jl="COMMENT_END_DASH_STATE";var Vl="COMMENT_END_STATE";var OS="COMMENT_END_BANG_STATE";var DS="DOCTYPE_STATE";var Gl="BEFORE_DOCTYPE_NAME_STATE";var zl="DOCTYPE_NAME_STATE";var NS="AFTER_DOCTYPE_NAME_STATE";var FS="AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE";var $S="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE";var Ef="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE";var Af="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE";var Rf="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE";var BS="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE";var qS="AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE";var HS="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE";var Ta="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE";var ba="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE";var kf="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE";var ui="BOGUS_DOCTYPE_STATE";var Ql="CDATA_SECTION_STATE";var US="CDATA_SECTION_BRACKET_STATE";var KS="CDATA_SECTION_END_STATE";var Lr="CHARACTER_REFERENCE_STATE";var WS="NAMED_CHARACTER_REFERENCE_STATE";var jS="AMBIGUOS_AMPERSAND_STATE";var VS="NUMERIC_CHARACTER_REFERENCE_STATE";var GS="HEXADEMICAL_CHARACTER_REFERENCE_START_STATE";var zS="DECIMAL_CHARACTER_REFERENCE_START_STATE";var QS="HEXADEMICAL_CHARACTER_REFERENCE_STATE";var YS="DECIMAL_CHARACTER_REFERENCE_STATE";var va="NUMERIC_CHARACTER_REFERENCE_END_STATE";function Be(n){return n===M.SPACE||n===M.LINE_FEED||n===M.TABULATION||n===M.FORM_FEED}function Ca(n){return n>=M.DIGIT_0&&n<=M.DIGIT_9}function Mn(n){return n>=M.LATIN_CAPITAL_A&&n<=M.LATIN_CAPITAL_Z}function Os(n){return n>=M.LATIN_SMALL_A&&n<=M.LATIN_SMALL_Z}function zi(n){return Os(n)||Mn(n)}function Pf(n){return zi(n)||Ca(n)}function nC(n){return n>=M.LATIN_CAPITAL_A&&n<=M.LATIN_CAPITAL_F}function iC(n){return n>=M.LATIN_SMALL_A&&n<=M.LATIN_SMALL_F}function z_(n){return Ca(n)||nC(n)||iC(n)}function Yl(n){return n+32}function Ge(n){if(n<=65535){return String.fromCharCode(n)}n-=65536;return String.fromCharCode(n>>>10&1023|55296)+String.fromCharCode(56320|n&1023)}function Gi(n){return String.fromCharCode(Yl(n))}function XS(n,e){const t=Ds[++n];let i=++n;let s=i+t-1;while(i<=s){const r=i+s>>>1;const o=Ds[r];if(o<e){i=r+1}else if(o>e){s=r-1}else{return Ds[r+t]}}return-1}var Dt=class n{constructor(){this.preprocessor=new j_;this.tokenQueue=[];this.allowCDATA=false;this.state=he;this.returnState="";this.charRefCode=-1;this.tempBuff=[];this.lastStartTagName="";this.consumedAfterSnapshot=-1;this.active=false;this.currentCharacterToken=null;this.currentToken=null;this.currentAttr=null}_err(){}_errOnNextCodePoint(e){this._consume();this._err(e);this._unconsume()}getNextToken(){while(!this.tokenQueue.length&&this.active){this.consumedAfterSnapshot=0;const e=this._consume();if(!this._ensureHibernation()){this[this.state](e)}}return this.tokenQueue.shift()}write(e,t){this.active=true;this.preprocessor.write(e,t)}insertHtmlAtCurrentPos(e){this.active=true;this.preprocessor.insertHtmlAtCurrentPos(e)}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--){this.preprocessor.retreat()}this.active=false;this.tokenQueue.push({type:n.HIBERNATION_TOKEN});return true}return false}_consume(){this.consumedAfterSnapshot++;return this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--;this.preprocessor.retreat()}_reconsumeInState(e){this.state=e;this._unconsume()}_consumeSequenceIfMatch(e,t,i){let s=0;let r=true;const o=e.length;let a=0;let u=t;let l=void 0;for(;a<o;a++){if(a>0){u=this._consume();s++}if(u===M.EOF){r=false;break}l=e[a];if(u!==l&&(i||u!==Yl(l))){r=false;break}}if(!r){while(s--){this._unconsume()}}return r}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==Ls.SCRIPT_STRING.length){return false}for(let e=0;e<this.tempBuff.length;e++){if(this.tempBuff[e]!==Ls.SCRIPT_STRING[e]){return false}}return true}_createStartTagToken(){this.currentToken={type:n.START_TAG_TOKEN,tagName:"",selfClosing:false,ackSelfClosing:false,attrs:[]}}_createEndTagToken(){this.currentToken={type:n.END_TAG_TOKEN,tagName:"",selfClosing:false,attrs:[]}}_createCommentToken(){this.currentToken={type:n.COMMENT_TOKEN,data:""}}_createDoctypeToken(e){this.currentToken={type:n.DOCTYPE_TOKEN,name:e,forceQuirks:false,publicId:null,systemId:null}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t}}_createEOFToken(){this.currentToken={type:n.EOF_TOKEN}}_createAttr(e){this.currentAttr={name:e,value:""}}_leaveAttrName(e){if(n.getTokenAttr(this.currentToken,this.currentAttr.name)===null){this.currentToken.attrs.push(this.currentAttr)}else{this._err(F.duplicateAttribute)}this.state=e}_leaveAttrValue(e){this.state=e}_emitCurrentToken(){this._emitCurrentCharacterToken();const e=this.currentToken;this.currentToken=null;if(e.type===n.START_TAG_TOKEN){this.lastStartTagName=e.tagName}else if(e.type===n.END_TAG_TOKEN){if(e.attrs.length>0){this._err(F.endTagWithAttributes)}if(e.selfClosing){this._err(F.endTagWithTrailingSolidus)}}this.tokenQueue.push(e)}_emitCurrentCharacterToken(){if(this.currentCharacterToken){this.tokenQueue.push(this.currentCharacterToken);this.currentCharacterToken=null}}_emitEOFToken(){this._createEOFToken();this._emitCurrentToken()}_appendCharToCurrentCharacterToken(e,t){if(this.currentCharacterToken&&this.currentCharacterToken.type!==e){this._emitCurrentCharacterToken()}if(this.currentCharacterToken){this.currentCharacterToken.chars+=t}else{this._createCharacterToken(e,t)}}_emitCodePoint(e){let t=n.CHARACTER_TOKEN;if(Be(e)){t=n.WHITESPACE_CHARACTER_TOKEN}else if(e===M.NULL){t=n.NULL_CHARACTER_TOKEN}this._appendCharToCurrentCharacterToken(t,Ge(e))}_emitSeveralCodePoints(e){for(let t=0;t<e.length;t++){this._emitCodePoint(e[t])}}_emitChars(e){this._appendCharToCurrentCharacterToken(n.CHARACTER_TOKEN,e)}_matchNamedCharacterReference(e){let t=null;let i=1;let s=XS(0,e);this.tempBuff.push(e);while(s>-1){const r=Ds[s];const o=r<G_;const a=o&&r&JS;if(a){t=r&ZS?[Ds[++s],Ds[++s]]:[Ds[++s]];i=0}const u=this._consume();this.tempBuff.push(u);i++;if(u===M.EOF){break}if(o){s=r&eC?XS(s,u):-1}else{s=u===r?++s:-1}}while(i--){this.tempBuff.pop();this._unconsume()}return t}_isCharacterReferenceInAttribute(){return this.returnState===Ul||this.returnState===Kl||this.returnState===Wl}_isCharacterReferenceAttributeQuirk(e){if(!e&&this._isCharacterReferenceInAttribute()){const t=this._consume();this._unconsume();return t===M.EQUALS_SIGN||Pf(t)}return false}_flushCodePointsConsumedAsCharacterReference(){if(this._isCharacterReferenceInAttribute()){for(let e=0;e<this.tempBuff.length;e++){this.currentAttr.value+=Ge(this.tempBuff[e])}}else{this._emitSeveralCodePoints(this.tempBuff)}this.tempBuff=[]}[he](e){this.preprocessor.dropParsedChunk();if(e===M.LESS_THAN_SIGN){this.state=aS}else if(e===M.AMPERSAND){this.returnState=he;this.state=Lr}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitCodePoint(e)}else if(e===M.EOF){this._emitEOFToken()}else{this._emitCodePoint(e)}}[Or](e){this.preprocessor.dropParsedChunk();if(e===M.AMPERSAND){this.returnState=Or;this.state=Lr}else if(e===M.LESS_THAN_SIGN){this.state=lS}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._emitEOFToken()}else{this._emitCodePoint(e)}}[Sa](e){this.preprocessor.dropParsedChunk();if(e===M.LESS_THAN_SIGN){this.state=hS}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._emitEOFToken()}else{this._emitCodePoint(e)}}[li](e){this.preprocessor.dropParsedChunk();if(e===M.LESS_THAN_SIGN){this.state=fS}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._emitEOFToken()}else{this._emitCodePoint(e)}}[tC](e){this.preprocessor.dropParsedChunk();if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._emitEOFToken()}else{this._emitCodePoint(e)}}[aS](e){if(e===M.EXCLAMATION_MARK){this.state=ES}else if(e===M.SOLIDUS){this.state=uS}else if(zi(e)){this._createStartTagToken();this._reconsumeInState(Cf)}else if(e===M.QUESTION_MARK){this._err(F.unexpectedQuestionMarkInsteadOfTagName);this._createCommentToken();this._reconsumeInState(ya)}else if(e===M.EOF){this._err(F.eofBeforeTagName);this._emitChars("<");this._emitEOFToken()}else{this._err(F.invalidFirstCharacterOfTagName);this._emitChars("<");this._reconsumeInState(he)}}[uS](e){if(zi(e)){this._createEndTagToken();this._reconsumeInState(Cf)}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingEndTagName);this.state=he}else if(e===M.EOF){this._err(F.eofBeforeTagName);this._emitChars("</");this._emitEOFToken()}else{this._err(F.invalidFirstCharacterOfTagName);this._createCommentToken();this._reconsumeInState(ya)}}[Cf](e){if(Be(e)){this.state=Kn}else if(e===M.SOLIDUS){this.state=ji}else if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(Mn(e)){this.currentToken.tagName+=Gi(e)}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.tagName+=ke.REPLACEMENT_CHARACTER}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this.currentToken.tagName+=Ge(e)}}[lS](e){if(e===M.SOLIDUS){this.tempBuff=[];this.state=dS}else{this._emitChars("<");this._reconsumeInState(Or)}}[dS](e){if(zi(e)){this._createEndTagToken();this._reconsumeInState(cS)}else{this._emitChars("</");this._reconsumeInState(Or)}}[cS](e){if(Mn(e)){this.currentToken.tagName+=Gi(e);this.tempBuff.push(e)}else if(Os(e)){this.currentToken.tagName+=Ge(e);this.tempBuff.push(e)}else{if(this.lastStartTagName===this.currentToken.tagName){if(Be(e)){this.state=Kn;return}if(e===M.SOLIDUS){this.state=ji;return}if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken();return}}this._emitChars("</");this._emitSeveralCodePoints(this.tempBuff);this._reconsumeInState(Or)}}[hS](e){if(e===M.SOLIDUS){this.tempBuff=[];this.state=pS}else{this._emitChars("<");this._reconsumeInState(Sa)}}[pS](e){if(zi(e)){this._createEndTagToken();this._reconsumeInState(mS)}else{this._emitChars("</");this._reconsumeInState(Sa)}}[mS](e){if(Mn(e)){this.currentToken.tagName+=Gi(e);this.tempBuff.push(e)}else if(Os(e)){this.currentToken.tagName+=Ge(e);this.tempBuff.push(e)}else{if(this.lastStartTagName===this.currentToken.tagName){if(Be(e)){this.state=Kn;return}if(e===M.SOLIDUS){this.state=ji;return}if(e===M.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=he;return}}this._emitChars("</");this._emitSeveralCodePoints(this.tempBuff);this._reconsumeInState(Sa)}}[fS](e){if(e===M.SOLIDUS){this.tempBuff=[];this.state=gS}else if(e===M.EXCLAMATION_MARK){this.state=TS;this._emitChars("<!")}else{this._emitChars("<");this._reconsumeInState(li)}}[gS](e){if(zi(e)){this._createEndTagToken();this._reconsumeInState(yS)}else{this._emitChars("</");this._reconsumeInState(li)}}[yS](e){if(Mn(e)){this.currentToken.tagName+=Gi(e);this.tempBuff.push(e)}else if(Os(e)){this.currentToken.tagName+=Ge(e);this.tempBuff.push(e)}else{if(this.lastStartTagName===this.currentToken.tagName){if(Be(e)){this.state=Kn;return}else if(e===M.SOLIDUS){this.state=ji;return}else if(e===M.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=he;return}}this._emitChars("</");this._emitSeveralCodePoints(this.tempBuff);this._reconsumeInState(li)}}[TS](e){if(e===M.HYPHEN_MINUS){this.state=bS;this._emitChars("-")}else{this._reconsumeInState(li)}}[bS](e){if(e===M.HYPHEN_MINUS){this.state=xf;this._emitChars("-")}else{this._reconsumeInState(li)}}[In](e){if(e===M.HYPHEN_MINUS){this.state=vS;this._emitChars("-")}else if(e===M.LESS_THAN_SIGN){this.state=Bl}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._err(F.eofInScriptHtmlCommentLikeText);this._emitEOFToken()}else{this._emitCodePoint(e)}}[vS](e){if(e===M.HYPHEN_MINUS){this.state=xf;this._emitChars("-")}else if(e===M.LESS_THAN_SIGN){this.state=Bl}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.state=In;this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._err(F.eofInScriptHtmlCommentLikeText);this._emitEOFToken()}else{this.state=In;this._emitCodePoint(e)}}[xf](e){if(e===M.HYPHEN_MINUS){this._emitChars("-")}else if(e===M.LESS_THAN_SIGN){this.state=Bl}else if(e===M.GREATER_THAN_SIGN){this.state=li;this._emitChars(">")}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.state=In;this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._err(F.eofInScriptHtmlCommentLikeText);this._emitEOFToken()}else{this.state=In;this._emitCodePoint(e)}}[Bl](e){if(e===M.SOLIDUS){this.tempBuff=[];this.state=SS}else if(zi(e)){this.tempBuff=[];this._emitChars("<");this._reconsumeInState(xS)}else{this._emitChars("<");this._reconsumeInState(In)}}[SS](e){if(zi(e)){this._createEndTagToken();this._reconsumeInState(CS)}else{this._emitChars("</");this._reconsumeInState(In)}}[CS](e){if(Mn(e)){this.currentToken.tagName+=Gi(e);this.tempBuff.push(e)}else if(Os(e)){this.currentToken.tagName+=Ge(e);this.tempBuff.push(e)}else{if(this.lastStartTagName===this.currentToken.tagName){if(Be(e)){this.state=Kn;return}if(e===M.SOLIDUS){this.state=ji;return}if(e===M.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=he;return}}this._emitChars("</");this._emitSeveralCodePoints(this.tempBuff);this._reconsumeInState(In)}}[xS](e){if(Be(e)||e===M.SOLIDUS||e===M.GREATER_THAN_SIGN){this.state=this._isTempBufferEqualToScriptString()?ai:In;this._emitCodePoint(e)}else if(Mn(e)){this.tempBuff.push(Yl(e));this._emitCodePoint(e)}else if(Os(e)){this.tempBuff.push(e);this._emitCodePoint(e)}else{this._reconsumeInState(In)}}[ai](e){if(e===M.HYPHEN_MINUS){this.state=wS;this._emitChars("-")}else if(e===M.LESS_THAN_SIGN){this.state=ql;this._emitChars("<")}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._err(F.eofInScriptHtmlCommentLikeText);this._emitEOFToken()}else{this._emitCodePoint(e)}}[wS](e){if(e===M.HYPHEN_MINUS){this.state=IS;this._emitChars("-")}else if(e===M.LESS_THAN_SIGN){this.state=ql;this._emitChars("<")}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.state=ai;this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._err(F.eofInScriptHtmlCommentLikeText);this._emitEOFToken()}else{this.state=ai;this._emitCodePoint(e)}}[IS](e){if(e===M.HYPHEN_MINUS){this._emitChars("-")}else if(e===M.LESS_THAN_SIGN){this.state=ql;this._emitChars("<")}else if(e===M.GREATER_THAN_SIGN){this.state=li;this._emitChars(">")}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.state=ai;this._emitChars(ke.REPLACEMENT_CHARACTER)}else if(e===M.EOF){this._err(F.eofInScriptHtmlCommentLikeText);this._emitEOFToken()}else{this.state=ai;this._emitCodePoint(e)}}[ql](e){if(e===M.SOLIDUS){this.tempBuff=[];this.state=MS;this._emitChars("/")}else{this._reconsumeInState(ai)}}[MS](e){if(Be(e)||e===M.SOLIDUS||e===M.GREATER_THAN_SIGN){this.state=this._isTempBufferEqualToScriptString()?In:ai;this._emitCodePoint(e)}else if(Mn(e)){this.tempBuff.push(Yl(e));this._emitCodePoint(e)}else if(Os(e)){this.tempBuff.push(e);this._emitCodePoint(e)}else{this._reconsumeInState(ai)}}[Kn](e){if(Be(e)){return}if(e===M.SOLIDUS||e===M.GREATER_THAN_SIGN||e===M.EOF){this._reconsumeInState(wf)}else if(e===M.EQUALS_SIGN){this._err(F.unexpectedEqualsSignBeforeAttributeName);this._createAttr("=");this.state=Hl}else{this._createAttr("");this._reconsumeInState(Hl)}}[Hl](e){if(Be(e)||e===M.SOLIDUS||e===M.GREATER_THAN_SIGN||e===M.EOF){this._leaveAttrName(wf);this._unconsume()}else if(e===M.EQUALS_SIGN){this._leaveAttrName(If)}else if(Mn(e)){this.currentAttr.name+=Gi(e)}else if(e===M.QUOTATION_MARK||e===M.APOSTROPHE||e===M.LESS_THAN_SIGN){this._err(F.unexpectedCharacterInAttributeName);this.currentAttr.name+=Ge(e)}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentAttr.name+=ke.REPLACEMENT_CHARACTER}else{this.currentAttr.name+=Ge(e)}}[wf](e){if(Be(e)){return}if(e===M.SOLIDUS){this.state=ji}else if(e===M.EQUALS_SIGN){this.state=If}else if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this._createAttr("");this._reconsumeInState(Hl)}}[If](e){if(Be(e)){return}if(e===M.QUOTATION_MARK){this.state=Ul}else if(e===M.APOSTROPHE){this.state=Kl}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingAttributeValue);this.state=he;this._emitCurrentToken()}else{this._reconsumeInState(Wl)}}[Ul](e){if(e===M.QUOTATION_MARK){this.state=Mf}else if(e===M.AMPERSAND){this.returnState=Ul;this.state=Lr}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentAttr.value+=ke.REPLACEMENT_CHARACTER}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this.currentAttr.value+=Ge(e)}}[Kl](e){if(e===M.APOSTROPHE){this.state=Mf}else if(e===M.AMPERSAND){this.returnState=Kl;this.state=Lr}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentAttr.value+=ke.REPLACEMENT_CHARACTER}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this.currentAttr.value+=Ge(e)}}[Wl](e){if(Be(e)){this._leaveAttrValue(Kn)}else if(e===M.AMPERSAND){this.returnState=Wl;this.state=Lr}else if(e===M.GREATER_THAN_SIGN){this._leaveAttrValue(he);this._emitCurrentToken()}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentAttr.value+=ke.REPLACEMENT_CHARACTER}else if(e===M.QUOTATION_MARK||e===M.APOSTROPHE||e===M.LESS_THAN_SIGN||e===M.EQUALS_SIGN||e===M.GRAVE_ACCENT){this._err(F.unexpectedCharacterInUnquotedAttributeValue);this.currentAttr.value+=Ge(e)}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this.currentAttr.value+=Ge(e)}}[Mf](e){if(Be(e)){this._leaveAttrValue(Kn)}else if(e===M.SOLIDUS){this._leaveAttrValue(ji)}else if(e===M.GREATER_THAN_SIGN){this._leaveAttrValue(he);this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this._err(F.missingWhitespaceBetweenAttributes);this._reconsumeInState(Kn)}}[ji](e){if(e===M.GREATER_THAN_SIGN){this.currentToken.selfClosing=true;this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInTag);this._emitEOFToken()}else{this._err(F.unexpectedSolidusInTag);this._reconsumeInState(Kn)}}[ya](e){if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._emitCurrentToken();this._emitEOFToken()}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.data+=ke.REPLACEMENT_CHARACTER}else{this.currentToken.data+=Ge(e)}}[ES](e){if(this._consumeSequenceIfMatch(Ls.DASH_DASH_STRING,e,true)){this._createCommentToken();this.state=AS}else if(this._consumeSequenceIfMatch(Ls.DOCTYPE_STRING,e,false)){this.state=DS}else if(this._consumeSequenceIfMatch(Ls.CDATA_START_STRING,e,true)){if(this.allowCDATA){this.state=Ql}else{this._err(F.cdataInHtmlContent);this._createCommentToken();this.currentToken.data="[CDATA[";this.state=ya}}else if(!this._ensureHibernation()){this._err(F.incorrectlyOpenedComment);this._createCommentToken();this._reconsumeInState(ya)}}[AS](e){if(e===M.HYPHEN_MINUS){this.state=RS}else if(e===M.GREATER_THAN_SIGN){this._err(F.abruptClosingOfEmptyComment);this.state=he;this._emitCurrentToken()}else{this._reconsumeInState(Vi)}}[RS](e){if(e===M.HYPHEN_MINUS){this.state=Vl}else if(e===M.GREATER_THAN_SIGN){this._err(F.abruptClosingOfEmptyComment);this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInComment);this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.data+="-";this._reconsumeInState(Vi)}}[Vi](e){if(e===M.HYPHEN_MINUS){this.state=jl}else if(e===M.LESS_THAN_SIGN){this.currentToken.data+="<";this.state=kS}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.data+=ke.REPLACEMENT_CHARACTER}else if(e===M.EOF){this._err(F.eofInComment);this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.data+=Ge(e)}}[kS](e){if(e===M.EXCLAMATION_MARK){this.currentToken.data+="!";this.state=PS}else if(e===M.LESS_THAN_SIGN){this.currentToken.data+="!"}else{this._reconsumeInState(Vi)}}[PS](e){if(e===M.HYPHEN_MINUS){this.state=_S}else{this._reconsumeInState(Vi)}}[_S](e){if(e===M.HYPHEN_MINUS){this.state=LS}else{this._reconsumeInState(jl)}}[LS](e){if(e!==M.GREATER_THAN_SIGN&&e!==M.EOF){this._err(F.nestedComment)}this._reconsumeInState(Vl)}[jl](e){if(e===M.HYPHEN_MINUS){this.state=Vl}else if(e===M.EOF){this._err(F.eofInComment);this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.data+="-";this._reconsumeInState(Vi)}}[Vl](e){if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(e===M.EXCLAMATION_MARK){this.state=OS}else if(e===M.HYPHEN_MINUS){this.currentToken.data+="-"}else if(e===M.EOF){this._err(F.eofInComment);this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.data+="--";this._reconsumeInState(Vi)}}[OS](e){if(e===M.HYPHEN_MINUS){this.currentToken.data+="--!";this.state=jl}else if(e===M.GREATER_THAN_SIGN){this._err(F.incorrectlyClosedComment);this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInComment);this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.data+="--!";this._reconsumeInState(Vi)}}[DS](e){if(Be(e)){this.state=Gl}else if(e===M.GREATER_THAN_SIGN){this._reconsumeInState(Gl)}else if(e===M.EOF){this._err(F.eofInDoctype);this._createDoctypeToken(null);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingWhitespaceBeforeDoctypeName);this._reconsumeInState(Gl)}}[Gl](e){if(Be(e)){return}if(Mn(e)){this._createDoctypeToken(Gi(e));this.state=zl}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this._createDoctypeToken(ke.REPLACEMENT_CHARACTER);this.state=zl}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingDoctypeName);this._createDoctypeToken(null);this.currentToken.forceQuirks=true;this._emitCurrentToken();this.state=he}else if(e===M.EOF){this._err(F.eofInDoctype);this._createDoctypeToken(null);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._createDoctypeToken(Ge(e));this.state=zl}}[zl](e){if(Be(e)){this.state=NS}else if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(Mn(e)){this.currentToken.name+=Gi(e)}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.name+=ke.REPLACEMENT_CHARACTER}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.name+=Ge(e)}}[NS](e){if(Be(e)){return}if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else if(this._consumeSequenceIfMatch(Ls.PUBLIC_STRING,e,false)){this.state=FS}else if(this._consumeSequenceIfMatch(Ls.SYSTEM_STRING,e,false)){this.state=qS}else if(!this._ensureHibernation()){this._err(F.invalidCharacterSequenceAfterDoctypeName);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[FS](e){if(Be(e)){this.state=$S}else if(e===M.QUOTATION_MARK){this._err(F.missingWhitespaceAfterDoctypePublicKeyword);this.currentToken.publicId="";this.state=Ef}else if(e===M.APOSTROPHE){this._err(F.missingWhitespaceAfterDoctypePublicKeyword);this.currentToken.publicId="";this.state=Af}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingDoctypePublicIdentifier);this.currentToken.forceQuirks=true;this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingQuoteBeforeDoctypePublicIdentifier);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[$S](e){if(Be(e)){return}if(e===M.QUOTATION_MARK){this.currentToken.publicId="";this.state=Ef}else if(e===M.APOSTROPHE){this.currentToken.publicId="";this.state=Af}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingDoctypePublicIdentifier);this.currentToken.forceQuirks=true;this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingQuoteBeforeDoctypePublicIdentifier);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[Ef](e){if(e===M.QUOTATION_MARK){this.state=Rf}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.publicId+=ke.REPLACEMENT_CHARACTER}else if(e===M.GREATER_THAN_SIGN){this._err(F.abruptDoctypePublicIdentifier);this.currentToken.forceQuirks=true;this._emitCurrentToken();this.state=he}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.publicId+=Ge(e)}}[Af](e){if(e===M.APOSTROPHE){this.state=Rf}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.publicId+=ke.REPLACEMENT_CHARACTER}else if(e===M.GREATER_THAN_SIGN){this._err(F.abruptDoctypePublicIdentifier);this.currentToken.forceQuirks=true;this._emitCurrentToken();this.state=he}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.publicId+=Ge(e)}}[Rf](e){if(Be(e)){this.state=BS}else if(e===M.GREATER_THAN_SIGN){this.state=he;this._emitCurrentToken()}else if(e===M.QUOTATION_MARK){this._err(F.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);this.currentToken.systemId="";this.state=Ta}else if(e===M.APOSTROPHE){this._err(F.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers);this.currentToken.systemId="";this.state=ba}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingQuoteBeforeDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[BS](e){if(Be(e)){return}if(e===M.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=he}else if(e===M.QUOTATION_MARK){this.currentToken.systemId="";this.state=Ta}else if(e===M.APOSTROPHE){this.currentToken.systemId="";this.state=ba}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingQuoteBeforeDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[qS](e){if(Be(e)){this.state=HS}else if(e===M.QUOTATION_MARK){this._err(F.missingWhitespaceAfterDoctypeSystemKeyword);this.currentToken.systemId="";this.state=Ta}else if(e===M.APOSTROPHE){this._err(F.missingWhitespaceAfterDoctypeSystemKeyword);this.currentToken.systemId="";this.state=ba}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingQuoteBeforeDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[HS](e){if(Be(e)){return}if(e===M.QUOTATION_MARK){this.currentToken.systemId="";this.state=Ta}else if(e===M.APOSTROPHE){this.currentToken.systemId="";this.state=ba}else if(e===M.GREATER_THAN_SIGN){this._err(F.missingDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this.state=he;this._emitCurrentToken()}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.missingQuoteBeforeDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this._reconsumeInState(ui)}}[Ta](e){if(e===M.QUOTATION_MARK){this.state=kf}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.systemId+=ke.REPLACEMENT_CHARACTER}else if(e===M.GREATER_THAN_SIGN){this._err(F.abruptDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this._emitCurrentToken();this.state=he}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.systemId+=Ge(e)}}[ba](e){if(e===M.APOSTROPHE){this.state=kf}else if(e===M.NULL){this._err(F.unexpectedNullCharacter);this.currentToken.systemId+=ke.REPLACEMENT_CHARACTER}else if(e===M.GREATER_THAN_SIGN){this._err(F.abruptDoctypeSystemIdentifier);this.currentToken.forceQuirks=true;this._emitCurrentToken();this.state=he}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this.currentToken.systemId+=Ge(e)}}[kf](e){if(Be(e)){return}if(e===M.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=he}else if(e===M.EOF){this._err(F.eofInDoctype);this.currentToken.forceQuirks=true;this._emitCurrentToken();this._emitEOFToken()}else{this._err(F.unexpectedCharacterAfterDoctypeSystemIdentifier);this._reconsumeInState(ui)}}[ui](e){if(e===M.GREATER_THAN_SIGN){this._emitCurrentToken();this.state=he}else if(e===M.NULL){this._err(F.unexpectedNullCharacter)}else if(e===M.EOF){this._emitCurrentToken();this._emitEOFToken()}}[Ql](e){if(e===M.RIGHT_SQUARE_BRACKET){this.state=US}else if(e===M.EOF){this._err(F.eofInCdata);this._emitEOFToken()}else{this._emitCodePoint(e)}}[US](e){if(e===M.RIGHT_SQUARE_BRACKET){this.state=KS}else{this._emitChars("]");this._reconsumeInState(Ql)}}[KS](e){if(e===M.GREATER_THAN_SIGN){this.state=he}else if(e===M.RIGHT_SQUARE_BRACKET){this._emitChars("]")}else{this._emitChars("]]");this._reconsumeInState(Ql)}}[Lr](e){this.tempBuff=[M.AMPERSAND];if(e===M.NUMBER_SIGN){this.tempBuff.push(e);this.state=VS}else if(Pf(e)){this._reconsumeInState(WS)}else{this._flushCodePointsConsumedAsCharacterReference();this._reconsumeInState(this.returnState)}}[WS](e){const t=this._matchNamedCharacterReference(e);if(this._ensureHibernation()){this.tempBuff=[M.AMPERSAND]}else if(t){const i=this.tempBuff[this.tempBuff.length-1]===M.SEMICOLON;if(!this._isCharacterReferenceAttributeQuirk(i)){if(!i){this._errOnNextCodePoint(F.missingSemicolonAfterCharacterReference)}this.tempBuff=t}this._flushCodePointsConsumedAsCharacterReference();this.state=this.returnState}else{this._flushCodePointsConsumedAsCharacterReference();this.state=jS}}[jS](e){if(Pf(e)){if(this._isCharacterReferenceInAttribute()){this.currentAttr.value+=Ge(e)}else{this._emitCodePoint(e)}}else{if(e===M.SEMICOLON){this._err(F.unknownNamedCharacterReference)}this._reconsumeInState(this.returnState)}}[VS](e){this.charRefCode=0;if(e===M.LATIN_SMALL_X||e===M.LATIN_CAPITAL_X){this.tempBuff.push(e);this.state=GS}else{this._reconsumeInState(zS)}}[GS](e){if(z_(e)){this._reconsumeInState(QS)}else{this._err(F.absenceOfDigitsInNumericCharacterReference);this._flushCodePointsConsumedAsCharacterReference();this._reconsumeInState(this.returnState)}}[zS](e){if(Ca(e)){this._reconsumeInState(YS)}else{this._err(F.absenceOfDigitsInNumericCharacterReference);this._flushCodePointsConsumedAsCharacterReference();this._reconsumeInState(this.returnState)}}[QS](e){if(nC(e)){this.charRefCode=this.charRefCode*16+e-55}else if(iC(e)){this.charRefCode=this.charRefCode*16+e-87}else if(Ca(e)){this.charRefCode=this.charRefCode*16+e-48}else if(e===M.SEMICOLON){this.state=va}else{this._err(F.missingSemicolonAfterCharacterReference);this._reconsumeInState(va)}}[YS](e){if(Ca(e)){this.charRefCode=this.charRefCode*10+e-48}else if(e===M.SEMICOLON){this.state=va}else{this._err(F.missingSemicolonAfterCharacterReference);this._reconsumeInState(va)}}[va](){if(this.charRefCode===M.NULL){this._err(F.nullCharacterReference);this.charRefCode=M.REPLACEMENT_CHARACTER}else if(this.charRefCode>1114111){this._err(F.characterReferenceOutsideUnicodeRange);this.charRefCode=M.REPLACEMENT_CHARACTER}else if(ke.isSurrogate(this.charRefCode)){this._err(F.surrogateCharacterReference);this.charRefCode=M.REPLACEMENT_CHARACTER}else if(ke.isUndefinedCodePoint(this.charRefCode)){this._err(F.noncharacterCharacterReference)}else if(ke.isControlCodePoint(this.charRefCode)||this.charRefCode===M.CARRIAGE_RETURN){this._err(F.controlCharacterReference);const e=V_[this.charRefCode];if(e){this.charRefCode=e}}this.tempBuff=[this.charRefCode];this._flushCodePointsConsumedAsCharacterReference();this._reconsumeInState(this.returnState)}};Dt.CHARACTER_TOKEN="CHARACTER_TOKEN";Dt.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN";Dt.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN";Dt.START_TAG_TOKEN="START_TAG_TOKEN";Dt.END_TAG_TOKEN="END_TAG_TOKEN";Dt.COMMENT_TOKEN="COMMENT_TOKEN";Dt.DOCTYPE_TOKEN="DOCTYPE_TOKEN";Dt.EOF_TOKEN="EOF_TOKEN";Dt.HIBERNATION_TOKEN="HIBERNATION_TOKEN";Dt.MODE={DATA:he,RCDATA:Or,RAWTEXT:Sa,SCRIPT_DATA:li,PLAINTEXT:tC};Dt.getTokenAttr=function(n,e){for(let t=n.attrs.length-1;t>=0;t--){if(n.attrs[t].name===e){return n.attrs[t].value}}return null};sC.exports=Dt});var Qi=ce(Dr=>{"use strict";var _f=Dr.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};Dr.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"};Dr.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};var H=Dr.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};Dr.SPECIAL_ELEMENTS={[_f.HTML]:{[H.ADDRESS]:true,[H.APPLET]:true,[H.AREA]:true,[H.ARTICLE]:true,[H.ASIDE]:true,[H.BASE]:true,[H.BASEFONT]:true,[H.BGSOUND]:true,[H.BLOCKQUOTE]:true,[H.BODY]:true,[H.BR]:true,[H.BUTTON]:true,[H.CAPTION]:true,[H.CENTER]:true,[H.COL]:true,[H.COLGROUP]:true,[H.DD]:true,[H.DETAILS]:true,[H.DIR]:true,[H.DIV]:true,[H.DL]:true,[H.DT]:true,[H.EMBED]:true,[H.FIELDSET]:true,[H.FIGCAPTION]:true,[H.FIGURE]:true,[H.FOOTER]:true,[H.FORM]:true,[H.FRAME]:true,[H.FRAMESET]:true,[H.H1]:true,[H.H2]:true,[H.H3]:true,[H.H4]:true,[H.H5]:true,[H.H6]:true,[H.HEAD]:true,[H.HEADER]:true,[H.HGROUP]:true,[H.HR]:true,[H.HTML]:true,[H.IFRAME]:true,[H.IMG]:true,[H.INPUT]:true,[H.LI]:true,[H.LINK]:true,[H.LISTING]:true,[H.MAIN]:true,[H.MARQUEE]:true,[H.MENU]:true,[H.META]:true,[H.NAV]:true,[H.NOEMBED]:true,[H.NOFRAMES]:true,[H.NOSCRIPT]:true,[H.OBJECT]:true,[H.OL]:true,[H.P]:true,[H.PARAM]:true,[H.PLAINTEXT]:true,[H.PRE]:true,[H.SCRIPT]:true,[H.SECTION]:true,[H.SELECT]:true,[H.SOURCE]:true,[H.STYLE]:true,[H.SUMMARY]:true,[H.TABLE]:true,[H.TBODY]:true,[H.TD]:true,[H.TEMPLATE]:true,[H.TEXTAREA]:true,[H.TFOOT]:true,[H.TH]:true,[H.THEAD]:true,[H.TITLE]:true,[H.TR]:true,[H.TRACK]:true,[H.UL]:true,[H.WBR]:true,[H.XMP]:true},[_f.MATHML]:{[H.MI]:true,[H.MO]:true,[H.MN]:true,[H.MS]:true,[H.MTEXT]:true,[H.ANNOTATION_XML]:true},[_f.SVG]:{[H.TITLE]:true,[H.FOREIGN_OBJECT]:true,[H.DESC]:true}}});var uC=ce((JY,aC)=>{"use strict";var oC=Qi();var W=oC.TAG_NAMES;var Pe=oC.NAMESPACES;function rC(n){switch(n.length){case 1:return n===W.P;case 2:return n===W.RB||n===W.RP||n===W.RT||n===W.DD||n===W.DT||n===W.LI;case 3:return n===W.RTC;case 6:return n===W.OPTION;case 8:return n===W.OPTGROUP}return false}function Q_(n){switch(n.length){case 1:return n===W.P;case 2:return n===W.RB||n===W.RP||n===W.RT||n===W.DD||n===W.DT||n===W.LI||n===W.TD||n===W.TH||n===W.TR;case 3:return n===W.RTC;case 5:return n===W.TBODY||n===W.TFOOT||n===W.THEAD;case 6:return n===W.OPTION;case 7:return n===W.CAPTION;case 8:return n===W.OPTGROUP||n===W.COLGROUP}return false}function Xl(n,e){switch(n.length){case 2:if(n===W.TD||n===W.TH){return e===Pe.HTML}else if(n===W.MI||n===W.MO||n===W.MN||n===W.MS){return e===Pe.MATHML}break;case 4:if(n===W.HTML){return e===Pe.HTML}else if(n===W.DESC){return e===Pe.SVG}break;case 5:if(n===W.TABLE){return e===Pe.HTML}else if(n===W.MTEXT){return e===Pe.MATHML}else if(n===W.TITLE){return e===Pe.SVG}break;case 6:return(n===W.APPLET||n===W.OBJECT)&&e===Pe.HTML;case 7:return(n===W.CAPTION||n===W.MARQUEE)&&e===Pe.HTML;case 8:return n===W.TEMPLATE&&e===Pe.HTML;case 13:return n===W.FOREIGN_OBJECT&&e===Pe.SVG;case 14:return n===W.ANNOTATION_XML&&e===Pe.MATHML}return false}var Lf=class{constructor(e,t){this.stackTop=-1;this.items=[];this.current=e;this.currentTagName=null;this.currentTmplContent=null;this.tmplCount=0;this.treeAdapter=t}_indexOf(e){let t=-1;for(let i=this.stackTop;i>=0;i--){if(this.items[i]===e){t=i;break}}return t}_isInTemplate(){return this.currentTagName===W.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===Pe.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop];this.currentTagName=this.current&&this.treeAdapter.getTagName(this.current);this.currentTmplContent=this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):null}push(e){this.items[++this.stackTop]=e;this._updateCurrentElement();if(this._isInTemplate()){this.tmplCount++}}pop(){this.stackTop--;if(this.tmplCount>0&&this._isInTemplate()){this.tmplCount--}this._updateCurrentElement()}replace(e,t){const i=this._indexOf(e);this.items[i]=t;if(i===this.stackTop){this._updateCurrentElement()}}insertAfter(e,t){const i=this._indexOf(e)+1;this.items.splice(i,0,t);if(i===++this.stackTop){this._updateCurrentElement()}}popUntilTagNamePopped(e){while(this.stackTop>-1){const t=this.currentTagName;const i=this.treeAdapter.getNamespaceURI(this.current);this.pop();if(t===e&&i===Pe.HTML){break}}}popUntilElementPopped(e){while(this.stackTop>-1){const t=this.current;this.pop();if(t===e){break}}}popUntilNumberedHeaderPopped(){while(this.stackTop>-1){const e=this.currentTagName;const t=this.treeAdapter.getNamespaceURI(this.current);this.pop();if(e===W.H1||e===W.H2||e===W.H3||e===W.H4||e===W.H5||e===W.H6&&t===Pe.HTML){break}}}popUntilTableCellPopped(){while(this.stackTop>-1){const e=this.currentTagName;const t=this.treeAdapter.getNamespaceURI(this.current);this.pop();if(e===W.TD||e===W.TH&&t===Pe.HTML){break}}}popAllUpToHtmlElement(){this.stackTop=0;this._updateCurrentElement()}clearBackToTableContext(){while(this.currentTagName!==W.TABLE&&this.currentTagName!==W.TEMPLATE&&this.currentTagName!==W.HTML||this.treeAdapter.getNamespaceURI(this.current)!==Pe.HTML){this.pop()}}clearBackToTableBodyContext(){while(this.currentTagName!==W.TBODY&&this.currentTagName!==W.TFOOT&&this.currentTagName!==W.THEAD&&this.currentTagName!==W.TEMPLATE&&this.currentTagName!==W.HTML||this.treeAdapter.getNamespaceURI(this.current)!==Pe.HTML){this.pop()}}clearBackToTableRowContext(){while(this.currentTagName!==W.TR&&this.currentTagName!==W.TEMPLATE&&this.currentTagName!==W.HTML||this.treeAdapter.getNamespaceURI(this.current)!==Pe.HTML){this.pop()}}remove(e){for(let t=this.stackTop;t>=0;t--){if(this.items[t]===e){this.items.splice(t,1);this.stackTop--;this._updateCurrentElement();break}}}tryPeekProperlyNestedBodyElement(){const e=this.items[1];return e&&this.treeAdapter.getTagName(e)===W.BODY?e:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e);return--t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.currentTagName===W.HTML}hasInScope(e){for(let t=this.stackTop;t>=0;t--){const i=this.treeAdapter.getTagName(this.items[t]);const s=this.treeAdapter.getNamespaceURI(this.items[t]);if(i===e&&s===Pe.HTML){return true}if(Xl(i,s)){return false}}return true}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const t=this.treeAdapter.getTagName(this.items[e]);const i=this.treeAdapter.getNamespaceURI(this.items[e]);if((t===W.H1||t===W.H2||t===W.H3||t===W.H4||t===W.H5||t===W.H6)&&i===Pe.HTML){return true}if(Xl(t,i)){return false}}return true}hasInListItemScope(e){for(let t=this.stackTop;t>=0;t--){const i=this.treeAdapter.getTagName(this.items[t]);const s=this.treeAdapter.getNamespaceURI(this.items[t]);if(i===e&&s===Pe.HTML){return true}if((i===W.UL||i===W.OL)&&s===Pe.HTML||Xl(i,s)){return false}}return true}hasInButtonScope(e){for(let t=this.stackTop;t>=0;t--){const i=this.treeAdapter.getTagName(this.items[t]);const s=this.treeAdapter.getNamespaceURI(this.items[t]);if(i===e&&s===Pe.HTML){return true}if(i===W.BUTTON&&s===Pe.HTML||Xl(i,s)){return false}}return true}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--){const i=this.treeAdapter.getTagName(this.items[t]);const s=this.treeAdapter.getNamespaceURI(this.items[t]);if(s!==Pe.HTML){continue}if(i===e){return true}if(i===W.TABLE||i===W.TEMPLATE||i===W.HTML){return false}}return true}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--){const t=this.treeAdapter.getTagName(this.items[e]);const i=this.treeAdapter.getNamespaceURI(this.items[e]);if(i!==Pe.HTML){continue}if(t===W.TBODY||t===W.THEAD||t===W.TFOOT){return true}if(t===W.TABLE||t===W.HTML){return false}}return true}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--){const i=this.treeAdapter.getTagName(this.items[t]);const s=this.treeAdapter.getNamespaceURI(this.items[t]);if(s!==Pe.HTML){continue}if(i===e){return true}if(i!==W.OPTION&&i!==W.OPTGROUP){return false}}return true}generateImpliedEndTags(){while(rC(this.currentTagName)){this.pop()}}generateImpliedEndTagsThoroughly(){while(Q_(this.currentTagName)){this.pop()}}generateImpliedEndTagsWithExclusion(e){while(rC(this.currentTagName)&&this.currentTagName!==e){this.pop()}}};aC.exports=Lf});var dC=ce((ZY,lC)=>{"use strict";var Jl=3;var wa=class n{constructor(e){this.length=0;this.entries=[];this.treeAdapter=e;this.bookmark=null}_getNoahArkConditionCandidates(e){const t=[];if(this.length>=Jl){const i=this.treeAdapter.getAttrList(e).length;const s=this.treeAdapter.getTagName(e);const r=this.treeAdapter.getNamespaceURI(e);for(let o=this.length-1;o>=0;o--){const a=this.entries[o];if(a.type===n.MARKER_ENTRY){break}const u=a.element;const l=this.treeAdapter.getAttrList(u);const d=this.treeAdapter.getTagName(u)===s&&this.treeAdapter.getNamespaceURI(u)===r&&l.length===i;if(d){t.push({idx:o,attrs:l})}}}return t.length<Jl?[]:t}_ensureNoahArkCondition(e){const t=this._getNoahArkConditionCandidates(e);let i=t.length;if(i){const s=this.treeAdapter.getAttrList(e);const r=s.length;const o=Object.create(null);for(let a=0;a<r;a++){const u=s[a];o[u.name]=u.value}for(let a=0;a<r;a++){for(let u=0;u<i;u++){const l=t[u].attrs[a];if(o[l.name]!==l.value){t.splice(u,1);i--}if(t.length<Jl){return}}}for(let a=i-1;a>=Jl-1;a--){this.entries.splice(t[a].idx,1);this.length--}}}insertMarker(){this.entries.push({type:n.MARKER_ENTRY});this.length++}pushElement(e,t){this._ensureNoahArkCondition(e);this.entries.push({type:n.ELEMENT_ENTRY,element:e,token:t});this.length++}insertElementAfterBookmark(e,t){let i=this.length-1;for(;i>=0;i--){if(this.entries[i]===this.bookmark){break}}this.entries.splice(i+1,0,{type:n.ELEMENT_ENTRY,element:e,token:t});this.length++}removeEntry(e){for(let t=this.length-1;t>=0;t--){if(this.entries[t]===e){this.entries.splice(t,1);this.length--;break}}}clearToLastMarker(){while(this.length){const e=this.entries.pop();this.length--;if(e.type===n.MARKER_ENTRY){break}}}getElementEntryInScopeWithTagName(e){for(let t=this.length-1;t>=0;t--){const i=this.entries[t];if(i.type===n.MARKER_ENTRY){return null}if(this.treeAdapter.getTagName(i.element)===e){return i}}return null}getElementEntry(e){for(let t=this.length-1;t>=0;t--){const i=this.entries[t];if(i.type===n.ELEMENT_ENTRY&&i.element===e){return i}}return null}};wa.MARKER_ENTRY="MARKER_ENTRY";wa.ELEMENT_ENTRY="ELEMENT_ENTRY";lC.exports=wa});var Wn=ce((eX,cC)=>{"use strict";var Zl=class{constructor(e){const t={};const i=this._getOverriddenMethods(this,t);for(const s of Object.keys(i)){if(typeof i[s]==="function"){t[s]=e[s];e[s]=i[s]}}}_getOverriddenMethods(){throw new Error("Not implemented")}};Zl.install=function(n,e,t){if(!n.__mixins){n.__mixins=[]}for(let s=0;s<n.__mixins.length;s++){if(n.__mixins[s].constructor===e){return n.__mixins[s]}}const i=new e(n,t);n.__mixins.push(i);return i};cC.exports=Zl});var Df=ce((tX,hC)=>{"use strict";var Y_=Wn();var Of=class extends Y_{constructor(e){super(e);this.preprocessor=e;this.isEol=false;this.lineStartPos=0;this.droppedBufferSize=0;this.offset=0;this.col=0;this.line=1}_getOverriddenMethods(e,t){return{advance(){const i=this.pos+1;const s=this.html[i];if(e.isEol){e.isEol=false;e.line++;e.lineStartPos=i}if(s==="\n"||s==="\r"&&this.html[i+1]!=="\n"){e.isEol=true}e.col=i-e.lineStartPos+1;e.offset=e.droppedBufferSize+i;return t.advance.call(this)},retreat(){t.retreat.call(this);e.isEol=false;e.col=this.pos-e.lineStartPos+1},dropParsedChunk(){const i=this.pos;t.dropParsedChunk.call(this);const s=i-this.pos;e.lineStartPos-=s;e.droppedBufferSize+=s;e.offset=e.droppedBufferSize+this.pos}}}};hC.exports=Of});var $f=ce((nX,mC)=>{"use strict";var pC=Wn();var Nf=xa();var X_=Df();var Ff=class extends pC{constructor(e){super(e);this.tokenizer=e;this.posTracker=pC.install(e.preprocessor,X_);this.currentAttrLocation=null;this.ctLoc=null}_getCurrentLocation(){return{startLine:this.posTracker.line,startCol:this.posTracker.col,startOffset:this.posTracker.offset,endLine:-1,endCol:-1,endOffset:-1}}_attachCurrentAttrLocationInfo(){this.currentAttrLocation.endLine=this.posTracker.line;this.currentAttrLocation.endCol=this.posTracker.col;this.currentAttrLocation.endOffset=this.posTracker.offset;const e=this.tokenizer.currentToken;const t=this.tokenizer.currentAttr;if(!e.location.attrs){e.location.attrs=Object.create(null)}e.location.attrs[t.name]=this.currentAttrLocation}_getOverriddenMethods(e,t){const i={_createStartTagToken(){t._createStartTagToken.call(this);this.currentToken.location=e.ctLoc},_createEndTagToken(){t._createEndTagToken.call(this);this.currentToken.location=e.ctLoc},_createCommentToken(){t._createCommentToken.call(this);this.currentToken.location=e.ctLoc},_createDoctypeToken(s){t._createDoctypeToken.call(this,s);this.currentToken.location=e.ctLoc},_createCharacterToken(s,r){t._createCharacterToken.call(this,s,r);this.currentCharacterToken.location=e.ctLoc},_createEOFToken(){t._createEOFToken.call(this);this.currentToken.location=e._getCurrentLocation()},_createAttr(s){t._createAttr.call(this,s);e.currentAttrLocation=e._getCurrentLocation()},_leaveAttrName(s){t._leaveAttrName.call(this,s);e._attachCurrentAttrLocationInfo()},_leaveAttrValue(s){t._leaveAttrValue.call(this,s);e._attachCurrentAttrLocationInfo()},_emitCurrentToken(){const s=this.currentToken.location;if(this.currentCharacterToken){this.currentCharacterToken.location.endLine=s.startLine;this.currentCharacterToken.location.endCol=s.startCol;this.currentCharacterToken.location.endOffset=s.startOffset}if(this.currentToken.type===Nf.EOF_TOKEN){s.endLine=s.startLine;s.endCol=s.startCol;s.endOffset=s.startOffset}else{s.endLine=e.posTracker.line;s.endCol=e.posTracker.col+1;s.endOffset=e.posTracker.offset+1}t._emitCurrentToken.call(this)},_emitCurrentCharacterToken(){const s=this.currentCharacterToken&&this.currentCharacterToken.location;if(s&&s.endOffset===-1){s.endLine=e.posTracker.line;s.endCol=e.posTracker.col;s.endOffset=e.posTracker.offset}t._emitCurrentCharacterToken.call(this)}};Object.keys(Nf.MODE).forEach(s=>{const r=Nf.MODE[s];i[r]=function(o){e.ctLoc=e._getCurrentLocation();t[r].call(this,o)}});return i}};mC.exports=Ff});var gC=ce((iX,fC)=>{"use strict";var J_=Wn();var Bf=class extends J_{constructor(e,t){super(e);this.onItemPop=t.onItemPop}_getOverriddenMethods(e,t){return{pop(){e.onItemPop(this.current);t.pop.call(this)},popAllUpToHtmlElement(){for(let i=this.stackTop;i>0;i--){e.onItemPop(this.items[i])}t.popAllUpToHtmlElement.call(this)},remove(i){e.onItemPop(this.current);t.remove.call(this,i)}}}};fC.exports=Bf});var bC=ce((sX,TC)=>{"use strict";var qf=Wn();var yC=xa();var Z_=$f();var e8=gC();var t8=Qi();var Hf=t8.TAG_NAMES;var Uf=class extends qf{constructor(e){super(e);this.parser=e;this.treeAdapter=this.parser.treeAdapter;this.posTracker=null;this.lastStartTagToken=null;this.lastFosterParentingLocation=null;this.currentToken=null}_setStartLocation(e){let t=null;if(this.lastStartTagToken){t=Object.assign({},this.lastStartTagToken.location);t.startTag=this.lastStartTagToken.location}this.treeAdapter.setNodeSourceCodeLocation(e,t)}_setEndLocation(e,t){const i=this.treeAdapter.getNodeSourceCodeLocation(e);if(i){if(t.location){const s=t.location;const r=this.treeAdapter.getTagName(e);const o=t.type===yC.END_TAG_TOKEN&&r===t.tagName;if(o){i.endTag=Object.assign({},s);i.endLine=s.endLine;i.endCol=s.endCol;i.endOffset=s.endOffset}else{i.endLine=s.startLine;i.endCol=s.startCol;i.endOffset=s.startOffset}}}}_getOverriddenMethods(e,t){return{_bootstrap(i,s){t._bootstrap.call(this,i,s);e.lastStartTagToken=null;e.lastFosterParentingLocation=null;e.currentToken=null;const r=qf.install(this.tokenizer,Z_);e.posTracker=r.posTracker;qf.install(this.openElements,e8,{onItemPop:function(o){e._setEndLocation(o,e.currentToken)}})},_runParsingLoop(i){t._runParsingLoop.call(this,i);for(let s=this.openElements.stackTop;s>=0;s--){e._setEndLocation(this.openElements.items[s],e.currentToken)}},_processTokenInForeignContent(i){e.currentToken=i;t._processTokenInForeignContent.call(this,i)},_processToken(i){e.currentToken=i;t._processToken.call(this,i);const s=i.type===yC.END_TAG_TOKEN&&(i.tagName===Hf.HTML||i.tagName===Hf.BODY&&this.openElements.hasInScope(Hf.BODY));if(s){for(let r=this.openElements.stackTop;r>=0;r--){const o=this.openElements.items[r];if(this.treeAdapter.getTagName(o)===i.tagName){e._setEndLocation(o,i);break}}}},_setDocumentType(i){t._setDocumentType.call(this,i);const s=this.treeAdapter.getChildNodes(this.document);const r=s.length;for(let o=0;o<r;o++){const a=s[o];if(this.treeAdapter.isDocumentTypeNode(a)){this.treeAdapter.setNodeSourceCodeLocation(a,i.location);break}}},_attachElementToTree(i){e._setStartLocation(i);e.lastStartTagToken=null;t._attachElementToTree.call(this,i)},_appendElement(i,s){e.lastStartTagToken=i;t._appendElement.call(this,i,s)},_insertElement(i,s){e.lastStartTagToken=i;t._insertElement.call(this,i,s)},_insertTemplate(i){e.lastStartTagToken=i;t._insertTemplate.call(this,i);const s=this.treeAdapter.getTemplateContent(this.openElements.current);this.treeAdapter.setNodeSourceCodeLocation(s,null)},_insertFakeRootElement(){t._insertFakeRootElement.call(this);this.treeAdapter.setNodeSourceCodeLocation(this.openElements.current,null)},_appendCommentNode(i,s){t._appendCommentNode.call(this,i,s);const r=this.treeAdapter.getChildNodes(s);const o=r[r.length-1];this.treeAdapter.setNodeSourceCodeLocation(o,i.location)},_findFosterParentingLocation(){e.lastFosterParentingLocation=t._findFosterParentingLocation.call(this);return e.lastFosterParentingLocation},_insertCharacters(i){t._insertCharacters.call(this,i);const s=this._shouldFosterParentOnInsertion();const r=s&&e.lastFosterParentingLocation.parent||this.openElements.currentTmplContent||this.openElements.current;const o=this.treeAdapter.getChildNodes(r);const a=s&&e.lastFosterParentingLocation.beforeElement?o.indexOf(e.lastFosterParentingLocation.beforeElement)-1:o.length-1;const u=o[a];const l=this.treeAdapter.getNodeSourceCodeLocation(u);if(l){l.endLine=i.location.endLine;l.endCol=i.location.endCol;l.endOffset=i.location.endOffset}else{this.treeAdapter.setNodeSourceCodeLocation(u,i.location)}}}}};TC.exports=Uf});var ed=ce((rX,vC)=>{"use strict";var n8=Wn();var Kf=class extends n8{constructor(e,t){super(e);this.posTracker=null;this.onParseError=t.onParseError}_setErrorLocation(e){e.startLine=e.endLine=this.posTracker.line;e.startCol=e.endCol=this.posTracker.col;e.startOffset=e.endOffset=this.posTracker.offset}_reportError(e){const t={code:e,startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1};this._setErrorLocation(t);this.onParseError(t)}_getOverriddenMethods(e){return{_err(t){e._reportError(t)}}}};vC.exports=Kf});var CC=ce((oX,SC)=>{"use strict";var i8=ed();var s8=Df();var r8=Wn();var Wf=class extends i8{constructor(e,t){super(e,t);this.posTracker=r8.install(e,s8);this.lastErrOffset=-1}_reportError(e){if(this.lastErrOffset!==this.posTracker.offset){this.lastErrOffset=this.posTracker.offset;super._reportError(e)}}};SC.exports=Wf});var wC=ce((aX,xC)=>{"use strict";var o8=ed();var a8=CC();var u8=Wn();var jf=class extends o8{constructor(e,t){super(e,t);const i=u8.install(e.preprocessor,a8,t);this.posTracker=i.posTracker}};xC.exports=jf});var EC=ce((uX,MC)=>{"use strict";var l8=ed();var d8=wC();var c8=$f();var IC=Wn();var Vf=class extends l8{constructor(e,t){super(e,t);this.opts=t;this.ctLoc=null;this.locBeforeToken=false}_setErrorLocation(e){if(this.ctLoc){e.startLine=this.ctLoc.startLine;e.startCol=this.ctLoc.startCol;e.startOffset=this.ctLoc.startOffset;e.endLine=this.locBeforeToken?this.ctLoc.startLine:this.ctLoc.endLine;e.endCol=this.locBeforeToken?this.ctLoc.startCol:this.ctLoc.endCol;e.endOffset=this.locBeforeToken?this.ctLoc.startOffset:this.ctLoc.endOffset}}_getOverriddenMethods(e,t){return{_bootstrap(i,s){t._bootstrap.call(this,i,s);IC.install(this.tokenizer,d8,e.opts);IC.install(this.tokenizer,c8)},_processInputToken(i){e.ctLoc=i.location;t._processInputToken.call(this,i)},_err(i,s){e.locBeforeToken=s&&s.beforeToken;e._reportError(i)}}}};MC.exports=Vf});var Gf=ce(Se=>{"use strict";var{DOCUMENT_MODE:h8}=Qi();Se.createDocument=function(){return{nodeName:"#document",mode:h8.NO_QUIRKS,childNodes:[]}};Se.createDocumentFragment=function(){return{nodeName:"#document-fragment",childNodes:[]}};Se.createElement=function(n,e,t){return{nodeName:n,tagName:n,attrs:t,namespaceURI:e,childNodes:[],parentNode:null}};Se.createCommentNode=function(n){return{nodeName:"#comment",data:n,parentNode:null}};var AC=function(n){return{nodeName:"#text",value:n,parentNode:null}};var RC=Se.appendChild=function(n,e){n.childNodes.push(e);e.parentNode=n};var p8=Se.insertBefore=function(n,e,t){const i=n.childNodes.indexOf(t);n.childNodes.splice(i,0,e);e.parentNode=n};Se.setTemplateContent=function(n,e){n.content=e};Se.getTemplateContent=function(n){return n.content};Se.setDocumentType=function(n,e,t,i){let s=null;for(let r=0;r<n.childNodes.length;r++){if(n.childNodes[r].nodeName==="#documentType"){s=n.childNodes[r];break}}if(s){s.name=e;s.publicId=t;s.systemId=i}else{RC(n,{nodeName:"#documentType",name:e,publicId:t,systemId:i})}};Se.setDocumentMode=function(n,e){n.mode=e};Se.getDocumentMode=function(n){return n.mode};Se.detachNode=function(n){if(n.parentNode){const e=n.parentNode.childNodes.indexOf(n);n.parentNode.childNodes.splice(e,1);n.parentNode=null}};Se.insertText=function(n,e){if(n.childNodes.length){const t=n.childNodes[n.childNodes.length-1];if(t.nodeName==="#text"){t.value+=e;return}}RC(n,AC(e))};Se.insertTextBefore=function(n,e,t){const i=n.childNodes[n.childNodes.indexOf(t)-1];if(i&&i.nodeName==="#text"){i.value+=e}else{p8(n,AC(e),t)}};Se.adoptAttributes=function(n,e){const t=[];for(let i=0;i<n.attrs.length;i++){t.push(n.attrs[i].name)}for(let i=0;i<e.length;i++){if(t.indexOf(e[i].name)===-1){n.attrs.push(e[i])}}};Se.getFirstChild=function(n){return n.childNodes[0]};Se.getChildNodes=function(n){return n.childNodes};Se.getParentNode=function(n){return n.parentNode};Se.getAttrList=function(n){return n.attrs};Se.getTagName=function(n){return n.tagName};Se.getNamespaceURI=function(n){return n.namespaceURI};Se.getTextNodeContent=function(n){return n.value};Se.getCommentNodeContent=function(n){return n.data};Se.getDocumentTypeNodeName=function(n){return n.name};Se.getDocumentTypeNodePublicId=function(n){return n.publicId};Se.getDocumentTypeNodeSystemId=function(n){return n.systemId};Se.isTextNode=function(n){return n.nodeName==="#text"};Se.isCommentNode=function(n){return n.nodeName==="#comment"};Se.isDocumentTypeNode=function(n){return n.nodeName==="#documentType"};Se.isElementNode=function(n){return!!n.tagName};Se.setNodeSourceCodeLocation=function(n,e){n.sourceCodeLocation=e};Se.getNodeSourceCodeLocation=function(n){return n.sourceCodeLocation}});var zf=ce((dX,kC)=>{"use strict";kC.exports=function n(e,t){t=t||Object.create(null);return[e,t].reduce((i,s)=>{Object.keys(s).forEach(r=>{i[r]=s[r]});return i},Object.create(null))}});var Qf=ce(td=>{"use strict";var{DOCUMENT_MODE:Nr}=Qi();var LC="html";var m8="about:legacy-compat";var f8="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd";var OC=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"];var g8=OC.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);var y8=["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"];var DC=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"];var T8=DC.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);function PC(n){const e=n.indexOf('"')!==-1?"'":'"';return e+n+e}function _C(n,e){for(let t=0;t<e.length;t++){if(n.indexOf(e[t])===0){return true}}return false}td.isConforming=function(n){return n.name===LC&&n.publicId===null&&(n.systemId===null||n.systemId===m8)};td.getDocumentMode=function(n){if(n.name!==LC){return Nr.QUIRKS}const e=n.systemId;if(e&&e.toLowerCase()===f8){return Nr.QUIRKS}let t=n.publicId;if(t!==null){t=t.toLowerCase();if(y8.indexOf(t)>-1){return Nr.QUIRKS}let i=e===null?g8:OC;if(_C(t,i)){return Nr.QUIRKS}i=e===null?DC:T8;if(_C(t,i)){return Nr.LIMITED_QUIRKS}}return Nr.NO_QUIRKS};td.serializeContent=function(n,e,t){let i="!DOCTYPE ";if(n){i+=n}if(e){i+=" PUBLIC "+PC(e)}else if(t){i+=" SYSTEM"}if(t!==null){i+=" "+PC(t)}return i}});var FC=ce(Yi=>{"use strict";var Yf=xa();var Xf=Qi();var ne=Xf.TAG_NAMES;var ht=Xf.NAMESPACES;var nd=Xf.ATTRS;var NC={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"};var b8="definitionurl";var v8="definitionURL";var S8={attributename:"attributeName",attributetype:"attributeType",basefrequency:"baseFrequency",baseprofile:"baseProfile",calcmode:"calcMode",clippathunits:"clipPathUnits",diffuseconstant:"diffuseConstant",edgemode:"edgeMode",filterunits:"filterUnits",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",limitingconeangle:"limitingConeAngle",markerheight:"markerHeight",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textlength:"textLength",viewbox:"viewBox",viewtarget:"viewTarget",xchannelselector:"xChannelSelector",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan"};var C8={"xlink:actuate":{prefix:"xlink",name:"actuate",namespace:ht.XLINK},"xlink:arcrole":{prefix:"xlink",name:"arcrole",namespace:ht.XLINK},"xlink:href":{prefix:"xlink",name:"href",namespace:ht.XLINK},"xlink:role":{prefix:"xlink",name:"role",namespace:ht.XLINK},"xlink:show":{prefix:"xlink",name:"show",namespace:ht.XLINK},"xlink:title":{prefix:"xlink",name:"title",namespace:ht.XLINK},"xlink:type":{prefix:"xlink",name:"type",namespace:ht.XLINK},"xml:base":{prefix:"xml",name:"base",namespace:ht.XML},"xml:lang":{prefix:"xml",name:"lang",namespace:ht.XML},"xml:space":{prefix:"xml",name:"space",namespace:ht.XML},xmlns:{prefix:"",name:"xmlns",namespace:ht.XMLNS},"xmlns:xlink":{prefix:"xmlns",name:"xlink",namespace:ht.XMLNS}};var x8=Yi.SVG_TAG_NAMES_ADJUSTMENT_MAP={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath"};var w8={[ne.B]:true,[ne.BIG]:true,[ne.BLOCKQUOTE]:true,[ne.BODY]:true,[ne.BR]:true,[ne.CENTER]:true,[ne.CODE]:true,[ne.DD]:true,[ne.DIV]:true,[ne.DL]:true,[ne.DT]:true,[ne.EM]:true,[ne.EMBED]:true,[ne.H1]:true,[ne.H2]:true,[ne.H3]:true,[ne.H4]:true,[ne.H5]:true,[ne.H6]:true,[ne.HEAD]:true,[ne.HR]:true,[ne.I]:true,[ne.IMG]:true,[ne.LI]:true,[ne.LISTING]:true,[ne.MENU]:true,[ne.META]:true,[ne.NOBR]:true,[ne.OL]:true,[ne.P]:true,[ne.PRE]:true,[ne.RUBY]:true,[ne.S]:true,[ne.SMALL]:true,[ne.SPAN]:true,[ne.STRONG]:true,[ne.STRIKE]:true,[ne.SUB]:true,[ne.SUP]:true,[ne.TABLE]:true,[ne.TT]:true,[ne.U]:true,[ne.UL]:true,[ne.VAR]:true};Yi.causesExit=function(n){const e=n.tagName;const t=e===ne.FONT&&(Yf.getTokenAttr(n,nd.COLOR)!==null||Yf.getTokenAttr(n,nd.SIZE)!==null||Yf.getTokenAttr(n,nd.FACE)!==null);return t?true:w8[e]};Yi.adjustTokenMathMLAttrs=function(n){for(let e=0;e<n.attrs.length;e++){if(n.attrs[e].name===b8){n.attrs[e].name=v8;break}}};Yi.adjustTokenSVGAttrs=function(n){for(let e=0;e<n.attrs.length;e++){const t=S8[n.attrs[e].name];if(t){n.attrs[e].name=t}}};Yi.adjustTokenXMLAttrs=function(n){for(let e=0;e<n.attrs.length;e++){const t=C8[n.attrs[e].name];if(t){n.attrs[e].prefix=t.prefix;n.attrs[e].name=t.name;n.attrs[e].namespace=t.namespace}}};Yi.adjustTokenSVGTagName=function(n){const e=x8[n.tagName];if(e){n.tagName=e}};function I8(n,e){return e===ht.MATHML&&(n===ne.MI||n===ne.MO||n===ne.MN||n===ne.MS||n===ne.MTEXT)}function M8(n,e,t){if(e===ht.MATHML&&n===ne.ANNOTATION_XML){for(let i=0;i<t.length;i++){if(t[i].name===nd.ENCODING){const s=t[i].value.toLowerCase();return s===NC.TEXT_HTML||s===NC.APPLICATION_XML}}}return e===ht.SVG&&(n===ne.FOREIGN_OBJECT||n===ne.DESC||n===ne.TITLE)}Yi.isIntegrationPoint=function(n,e,t,i){if((!i||i===ht.HTML)&&M8(n,e,t)){return true}if((!i||i===ht.MATHML)&&I8(n,e)){return true}return false}});var ux=ce((pX,ax)=>{"use strict";var A=xa();var E8=uC();var $C=dC();var A8=bC();var R8=EC();var BC=Wn();var k8=Gf();var P8=zf();var qC=Qf();var jn=FC();var pt=$l();var _8=Fl();var Fs=Qi();var g=Fs.TAG_NAMES;var X=Fs.NAMESPACES;var YC=Fs.ATTRS;var L8={scriptingEnabled:true,sourceCodeLocationInfo:false,onParseError:null,treeAdapter:k8};var XC="hidden";var O8=8;var D8=3;var JC="INITIAL_MODE";var Zf="BEFORE_HTML_MODE";var dd="BEFORE_HEAD_MODE";var Br="IN_HEAD_MODE";var ZC="IN_HEAD_NO_SCRIPT_MODE";var cd="AFTER_HEAD_MODE";var Vn="IN_BODY_MODE";var od="TEXT_MODE";var Ct="IN_TABLE_MODE";var ex="IN_TABLE_TEXT_MODE";var hd="IN_CAPTION_MODE";var La="IN_COLUMN_GROUP_MODE";var mn="IN_TABLE_BODY_MODE";var pi="IN_ROW_MODE";var pd="IN_CELL_MODE";var e1="IN_SELECT_MODE";var t1="IN_SELECT_IN_TABLE_MODE";var ad="IN_TEMPLATE_MODE";var n1="AFTER_BODY_MODE";var md="IN_FRAMESET_MODE";var tx="AFTER_FRAMESET_MODE";var nx="AFTER_AFTER_BODY_MODE";var ix="AFTER_AFTER_FRAMESET_MODE";var N8={[g.TR]:pi,[g.TBODY]:mn,[g.THEAD]:mn,[g.TFOOT]:mn,[g.CAPTION]:hd,[g.COLGROUP]:La,[g.TABLE]:Ct,[g.BODY]:Vn,[g.FRAMESET]:md};var F8={[g.CAPTION]:Ct,[g.COLGROUP]:Ct,[g.TBODY]:Ct,[g.TFOOT]:Ct,[g.THEAD]:Ct,[g.COL]:La,[g.TR]:mn,[g.TD]:pi,[g.TH]:pi};var HC={[JC]:{[A.CHARACTER_TOKEN]:Ma,[A.NULL_CHARACTER_TOKEN]:Ma,[A.WHITESPACE_CHARACTER_TOKEN]:fe,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:j8,[A.START_TAG_TOKEN]:Ma,[A.END_TAG_TOKEN]:Ma,[A.EOF_TOKEN]:Ma},[Zf]:{[A.CHARACTER_TOKEN]:Aa,[A.NULL_CHARACTER_TOKEN]:Aa,[A.WHITESPACE_CHARACTER_TOKEN]:fe,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:V8,[A.END_TAG_TOKEN]:G8,[A.EOF_TOKEN]:Aa},[dd]:{[A.CHARACTER_TOKEN]:Ra,[A.NULL_CHARACTER_TOKEN]:Ra,[A.WHITESPACE_CHARACTER_TOKEN]:fe,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:id,[A.START_TAG_TOKEN]:z8,[A.END_TAG_TOKEN]:Q8,[A.EOF_TOKEN]:Ra},[Br]:{[A.CHARACTER_TOKEN]:ka,[A.NULL_CHARACTER_TOKEN]:ka,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:id,[A.START_TAG_TOKEN]:rt,[A.END_TAG_TOKEN]:$s,[A.EOF_TOKEN]:ka},[ZC]:{[A.CHARACTER_TOKEN]:Pa,[A.NULL_CHARACTER_TOKEN]:Pa,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:id,[A.START_TAG_TOKEN]:Y8,[A.END_TAG_TOKEN]:X8,[A.EOF_TOKEN]:Pa},[cd]:{[A.CHARACTER_TOKEN]:_a,[A.NULL_CHARACTER_TOKEN]:_a,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:id,[A.START_TAG_TOKEN]:J8,[A.END_TAG_TOKEN]:Z8,[A.EOF_TOKEN]:_a},[Vn]:{[A.CHARACTER_TOKEN]:sd,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:Ft,[A.END_TAG_TOKEN]:i1,[A.EOF_TOKEN]:ci},[od]:{[A.CHARACTER_TOKEN]:Nt,[A.NULL_CHARACTER_TOKEN]:Nt,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:fe,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:fe,[A.END_TAG_TOKEN]:kL,[A.EOF_TOKEN]:PL},[Ct]:{[A.CHARACTER_TOKEN]:hi,[A.NULL_CHARACTER_TOKEN]:hi,[A.WHITESPACE_CHARACTER_TOKEN]:hi,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:s1,[A.END_TAG_TOKEN]:r1,[A.EOF_TOKEN]:ci},[ex]:{[A.CHARACTER_TOKEN]:HL,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:qL,[A.COMMENT_TOKEN]:Ea,[A.DOCTYPE_TOKEN]:Ea,[A.START_TAG_TOKEN]:Ea,[A.END_TAG_TOKEN]:Ea,[A.EOF_TOKEN]:Ea},[hd]:{[A.CHARACTER_TOKEN]:sd,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:UL,[A.END_TAG_TOKEN]:KL,[A.EOF_TOKEN]:ci},[La]:{[A.CHARACTER_TOKEN]:ud,[A.NULL_CHARACTER_TOKEN]:ud,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:WL,[A.END_TAG_TOKEN]:jL,[A.EOF_TOKEN]:ci},[mn]:{[A.CHARACTER_TOKEN]:hi,[A.NULL_CHARACTER_TOKEN]:hi,[A.WHITESPACE_CHARACTER_TOKEN]:hi,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:VL,[A.END_TAG_TOKEN]:GL,[A.EOF_TOKEN]:ci},[pi]:{[A.CHARACTER_TOKEN]:hi,[A.NULL_CHARACTER_TOKEN]:hi,[A.WHITESPACE_CHARACTER_TOKEN]:hi,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:zL,[A.END_TAG_TOKEN]:QL,[A.EOF_TOKEN]:ci},[pd]:{[A.CHARACTER_TOKEN]:sd,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:YL,[A.END_TAG_TOKEN]:XL,[A.EOF_TOKEN]:ci},[e1]:{[A.CHARACTER_TOKEN]:Nt,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:sx,[A.END_TAG_TOKEN]:rx,[A.EOF_TOKEN]:ci},[t1]:{[A.CHARACTER_TOKEN]:Nt,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:JL,[A.END_TAG_TOKEN]:ZL,[A.EOF_TOKEN]:ci},[ad]:{[A.CHARACTER_TOKEN]:sd,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:eO,[A.END_TAG_TOKEN]:tO,[A.EOF_TOKEN]:ox},[n1]:{[A.CHARACTER_TOKEN]:ld,[A.NULL_CHARACTER_TOKEN]:ld,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:W8,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:nO,[A.END_TAG_TOKEN]:iO,[A.EOF_TOKEN]:Ia},[md]:{[A.CHARACTER_TOKEN]:fe,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:sO,[A.END_TAG_TOKEN]:rO,[A.EOF_TOKEN]:Ia},[tx]:{[A.CHARACTER_TOKEN]:fe,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Nt,[A.COMMENT_TOKEN]:Ze,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:oO,[A.END_TAG_TOKEN]:aO,[A.EOF_TOKEN]:Ia},[nx]:{[A.CHARACTER_TOKEN]:rd,[A.NULL_CHARACTER_TOKEN]:rd,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:UC,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:uO,[A.END_TAG_TOKEN]:rd,[A.EOF_TOKEN]:Ia},[ix]:{[A.CHARACTER_TOKEN]:fe,[A.NULL_CHARACTER_TOKEN]:fe,[A.WHITESPACE_CHARACTER_TOKEN]:Ns,[A.COMMENT_TOKEN]:UC,[A.DOCTYPE_TOKEN]:fe,[A.START_TAG_TOKEN]:lO,[A.END_TAG_TOKEN]:fe,[A.EOF_TOKEN]:Ia}};var Jf=class{constructor(e){this.options=P8(L8,e);this.treeAdapter=this.options.treeAdapter;this.pendingScript=null;if(this.options.sourceCodeLocationInfo){BC.install(this,A8)}if(this.options.onParseError){BC.install(this,R8,{onParseError:this.options.onParseError})}}parse(e){const t=this.treeAdapter.createDocument();this._bootstrap(t,null);this.tokenizer.write(e,true);this._runParsingLoop(null);return t}parseFragment(e,t){if(!t){t=this.treeAdapter.createElement(g.TEMPLATE,X.HTML,[])}const i=this.treeAdapter.createElement("documentmock",X.HTML,[]);this._bootstrap(i,t);if(this.treeAdapter.getTagName(t)===g.TEMPLATE){this._pushTmplInsertionMode(ad)}this._initTokenizerForFragmentParsing();this._insertFakeRootElement();this._resetInsertionMode();this._findFormInFragmentContext();this.tokenizer.write(e,true);this._runParsingLoop(null);const s=this.treeAdapter.getFirstChild(i);const r=this.treeAdapter.createDocumentFragment();this._adoptNodes(s,r);return r}_bootstrap(e,t){this.tokenizer=new A(this.options);this.stopped=false;this.insertionMode=JC;this.originalInsertionMode="";this.document=e;this.fragmentContext=t;this.headElement=null;this.formElement=null;this.openElements=new E8(this.document,this.treeAdapter);this.activeFormattingElements=new $C(this.treeAdapter);this.tmplInsertionModeStack=[];this.tmplInsertionModeStackTop=-1;this.currentTmplInsertionMode=null;this.pendingCharacterTokens=[];this.hasNonWhitespacePendingCharacterToken=false;this.framesetOk=true;this.skipNextNewLine=false;this.fosterParentingEnabled=false}_err(){}_runParsingLoop(e){while(!this.stopped){this._setupTokenizerCDATAMode();const t=this.tokenizer.getNextToken();if(t.type===A.HIBERNATION_TOKEN){break}if(this.skipNextNewLine){this.skipNextNewLine=false;if(t.type===A.WHITESPACE_CHARACTER_TOKEN&&t.chars[0]==="\n"){if(t.chars.length===1){continue}t.chars=t.chars.substr(1)}}this._processInputToken(t);if(e&&this.pendingScript){break}}}runParsingLoopForCurrentChunk(e,t){this._runParsingLoop(t);if(t&&this.pendingScript){const i=this.pendingScript;this.pendingScript=null;t(i);return}if(e){e()}}_setupTokenizerCDATAMode(){const e=this._getAdjustedCurrentElement();this.tokenizer.allowCDATA=e&&e!==this.document&&this.treeAdapter.getNamespaceURI(e)!==X.HTML&&!this._isIntegrationPoint(e)}_switchToTextParsing(e,t){this._insertElement(e,X.HTML);this.tokenizer.state=t;this.originalInsertionMode=this.insertionMode;this.insertionMode=od}switchToPlaintextParsing(){this.insertionMode=od;this.originalInsertionMode=Vn;this.tokenizer.state=A.MODE.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;do{if(this.treeAdapter.getTagName(e)===g.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}while(e)}_initTokenizerForFragmentParsing(){if(this.treeAdapter.getNamespaceURI(this.fragmentContext)===X.HTML){const e=this.treeAdapter.getTagName(this.fragmentContext);if(e===g.TITLE||e===g.TEXTAREA){this.tokenizer.state=A.MODE.RCDATA}else if(e===g.STYLE||e===g.XMP||e===g.IFRAME||e===g.NOEMBED||e===g.NOFRAMES||e===g.NOSCRIPT){this.tokenizer.state=A.MODE.RAWTEXT}else if(e===g.SCRIPT){this.tokenizer.state=A.MODE.SCRIPT_DATA}else if(e===g.PLAINTEXT){this.tokenizer.state=A.MODE.PLAINTEXT}}}_setDocumentType(e){const t=e.name||"";const i=e.publicId||"";const s=e.systemId||"";this.treeAdapter.setDocumentType(this.document,t,i,s)}_attachElementToTree(e){if(this._shouldFosterParentOnInsertion()){this._fosterParentElement(e)}else{const t=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.appendChild(t,e)}}_appendElement(e,t){const i=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(i)}_insertElement(e,t){const i=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(i);this.openElements.push(i)}_insertFakeElement(e){const t=this.treeAdapter.createElement(e,X.HTML,[]);this._attachElementToTree(t);this.openElements.push(t)}_insertTemplate(e){const t=this.treeAdapter.createElement(e.tagName,X.HTML,e.attrs);const i=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,i);this._attachElementToTree(t);this.openElements.push(t)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(g.HTML,X.HTML,[]);this.treeAdapter.appendChild(this.openElements.current,e);this.openElements.push(e)}_appendCommentNode(e,t){const i=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,i)}_insertCharacters(e){if(this._shouldFosterParentOnInsertion()){this._fosterParentText(e.chars)}else{const t=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.insertText(t,e.chars)}}_adoptNodes(e,t){for(let i=this.treeAdapter.getFirstChild(e);i;i=this.treeAdapter.getFirstChild(e)){this.treeAdapter.detachNode(i);this.treeAdapter.appendChild(t,i)}}_shouldProcessTokenInForeignContent(e){const t=this._getAdjustedCurrentElement();if(!t||t===this.document){return false}const i=this.treeAdapter.getNamespaceURI(t);if(i===X.HTML){return false}if(this.treeAdapter.getTagName(t)===g.ANNOTATION_XML&&i===X.MATHML&&e.type===A.START_TAG_TOKEN&&e.tagName===g.SVG){return false}const s=e.type===A.CHARACTER_TOKEN||e.type===A.NULL_CHARACTER_TOKEN||e.type===A.WHITESPACE_CHARACTER_TOKEN;const r=e.type===A.START_TAG_TOKEN&&e.tagName!==g.MGLYPH&&e.tagName!==g.MALIGNMARK;if((r||s)&&this._isIntegrationPoint(t,X.MATHML)){return false}if((e.type===A.START_TAG_TOKEN||s)&&this._isIntegrationPoint(t,X.HTML)){return false}return e.type!==A.EOF_TOKEN}_processToken(e){HC[this.insertionMode][e.type](this,e)}_processTokenInBodyMode(e){HC[Vn][e.type](this,e)}_processTokenInForeignContent(e){if(e.type===A.CHARACTER_TOKEN){cO(this,e)}else if(e.type===A.NULL_CHARACTER_TOKEN){dO(this,e)}else if(e.type===A.WHITESPACE_CHARACTER_TOKEN){Nt(this,e)}else if(e.type===A.COMMENT_TOKEN){Ze(this,e)}else if(e.type===A.START_TAG_TOKEN){hO(this,e)}else if(e.type===A.END_TAG_TOKEN){pO(this,e)}}_processInputToken(e){if(this._shouldProcessTokenInForeignContent(e)){this._processTokenInForeignContent(e)}else{this._processToken(e)}if(e.type===A.START_TAG_TOKEN&&e.selfClosing&&!e.ackSelfClosing){this._err(pt.nonVoidHtmlElementStartTagWithTrailingSolidus)}}_isIntegrationPoint(e,t){const i=this.treeAdapter.getTagName(e);const s=this.treeAdapter.getNamespaceURI(e);const r=this.treeAdapter.getAttrList(e);return jn.isIntegrationPoint(i,s,r,t)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.length;if(e){let t=e;let i=null;do{t--;i=this.activeFormattingElements.entries[t];if(i.type===$C.MARKER_ENTRY||this.openElements.contains(i.element)){t++;break}}while(t>0);for(let s=t;s<e;s++){i=this.activeFormattingElements.entries[s];this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element));i.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags();this.openElements.popUntilTableCellPopped();this.activeFormattingElements.clearToLastMarker();this.insertionMode=pi}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(g.P);this.openElements.popUntilTagNamePopped(g.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop,t=false;e>=0;e--){let i=this.openElements.items[e];if(e===0){t=true;if(this.fragmentContext){i=this.fragmentContext}}const s=this.treeAdapter.getTagName(i);const r=N8[s];if(r){this.insertionMode=r;break}else if(!t&&(s===g.TD||s===g.TH)){this.insertionMode=pd;break}else if(!t&&s===g.HEAD){this.insertionMode=Br;break}else if(s===g.SELECT){this._resetInsertionModeForSelect(e);break}else if(s===g.TEMPLATE){this.insertionMode=this.currentTmplInsertionMode;break}else if(s===g.HTML){this.insertionMode=this.headElement?cd:dd;break}else if(t){this.insertionMode=Vn;break}}}_resetInsertionModeForSelect(e){if(e>0){for(let t=e-1;t>0;t--){const i=this.openElements.items[t];const s=this.treeAdapter.getTagName(i);if(s===g.TEMPLATE){break}else if(s===g.TABLE){this.insertionMode=t1;return}}}this.insertionMode=e1}_pushTmplInsertionMode(e){this.tmplInsertionModeStack.push(e);this.tmplInsertionModeStackTop++;this.currentTmplInsertionMode=e}_popTmplInsertionMode(){this.tmplInsertionModeStack.pop();this.tmplInsertionModeStackTop--;this.currentTmplInsertionMode=this.tmplInsertionModeStack[this.tmplInsertionModeStackTop]}_isElementCausesFosterParenting(e){const t=this.treeAdapter.getTagName(e);return t===g.TABLE||t===g.TBODY||t===g.TFOOT||t===g.THEAD||t===g.TR}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.current)}_findFosterParentingLocation(){const e={parent:null,beforeElement:null};for(let t=this.openElements.stackTop;t>=0;t--){const i=this.openElements.items[t];const s=this.treeAdapter.getTagName(i);const r=this.treeAdapter.getNamespaceURI(i);if(s===g.TEMPLATE&&r===X.HTML){e.parent=this.treeAdapter.getTemplateContent(i);break}else if(s===g.TABLE){e.parent=this.treeAdapter.getParentNode(i);if(e.parent){e.beforeElement=i}else{e.parent=this.openElements.items[t-1]}break}}if(!e.parent){e.parent=this.openElements.items[0]}return e}_fosterParentElement(e){const t=this._findFosterParentingLocation();if(t.beforeElement){this.treeAdapter.insertBefore(t.parent,e,t.beforeElement)}else{this.treeAdapter.appendChild(t.parent,e)}}_fosterParentText(e){const t=this._findFosterParentingLocation();if(t.beforeElement){this.treeAdapter.insertTextBefore(t.parent,e,t.beforeElement)}else{this.treeAdapter.insertText(t.parent,e)}}_isSpecialElement(e){const t=this.treeAdapter.getTagName(e);const i=this.treeAdapter.getNamespaceURI(e);return Fs.SPECIAL_ELEMENTS[i][t]}};ax.exports=Jf;function $8(n,e){let t=n.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);if(t){if(!n.openElements.contains(t.element)){n.activeFormattingElements.removeEntry(t);t=null}else if(!n.openElements.hasInScope(e.tagName)){t=null}}else{En(n,e)}return t}function B8(n,e){let t=null;for(let i=n.openElements.stackTop;i>=0;i--){const s=n.openElements.items[i];if(s===e.element){break}if(n._isSpecialElement(s)){t=s}}if(!t){n.openElements.popUntilElementPopped(e.element);n.activeFormattingElements.removeEntry(e)}return t}function q8(n,e,t){let i=e;let s=n.openElements.getCommonAncestor(e);for(let r=0,o=s;o!==t;r++,o=s){s=n.openElements.getCommonAncestor(o);const a=n.activeFormattingElements.getElementEntry(o);const u=a&&r>=D8;const l=!a||u;if(l){if(u){n.activeFormattingElements.removeEntry(a)}n.openElements.remove(o)}else{o=H8(n,a);if(i===e){n.activeFormattingElements.bookmark=a}n.treeAdapter.detachNode(i);n.treeAdapter.appendChild(o,i);i=o}}return i}function H8(n,e){const t=n.treeAdapter.getNamespaceURI(e.element);const i=n.treeAdapter.createElement(e.token.tagName,t,e.token.attrs);n.openElements.replace(e.element,i);e.element=i;return i}function U8(n,e,t){if(n._isElementCausesFosterParenting(e)){n._fosterParentElement(t)}else{const i=n.treeAdapter.getTagName(e);const s=n.treeAdapter.getNamespaceURI(e);if(i===g.TEMPLATE&&s===X.HTML){e=n.treeAdapter.getTemplateContent(e)}n.treeAdapter.appendChild(e,t)}}function K8(n,e,t){const i=n.treeAdapter.getNamespaceURI(t.element);const s=t.token;const r=n.treeAdapter.createElement(s.tagName,i,s.attrs);n._adoptNodes(e,r);n.treeAdapter.appendChild(e,r);n.activeFormattingElements.insertElementAfterBookmark(r,t.token);n.activeFormattingElements.removeEntry(t);n.openElements.remove(t.element);n.openElements.insertAfter(e,r)}function Ji(n,e){let t;for(let i=0;i<O8;i++){t=$8(n,e,t);if(!t){break}const s=B8(n,t);if(!s){break}n.activeFormattingElements.bookmark=t;const r=q8(n,s,t.element);const o=n.openElements.getCommonAncestor(t.element);n.treeAdapter.detachNode(r);U8(n,o,r);K8(n,s,t)}}function fe(){}function id(n){n._err(pt.misplacedDoctype)}function Ze(n,e){n._appendCommentNode(e,n.openElements.currentTmplContent||n.openElements.current)}function W8(n,e){n._appendCommentNode(e,n.openElements.items[0])}function UC(n,e){n._appendCommentNode(e,n.document)}function Nt(n,e){n._insertCharacters(e)}function Ia(n){n.stopped=true}function j8(n,e){n._setDocumentType(e);const t=e.forceQuirks?Fs.DOCUMENT_MODE.QUIRKS:qC.getDocumentMode(e);if(!qC.isConforming(e)){n._err(pt.nonConformingDoctype)}n.treeAdapter.setDocumentMode(n.document,t);n.insertionMode=Zf}function Ma(n,e){n._err(pt.missingDoctype,{beforeToken:true});n.treeAdapter.setDocumentMode(n.document,Fs.DOCUMENT_MODE.QUIRKS);n.insertionMode=Zf;n._processToken(e)}function V8(n,e){if(e.tagName===g.HTML){n._insertElement(e,X.HTML);n.insertionMode=dd}else{Aa(n,e)}}function G8(n,e){const t=e.tagName;if(t===g.HTML||t===g.HEAD||t===g.BODY||t===g.BR){Aa(n,e)}}function Aa(n,e){n._insertFakeRootElement();n.insertionMode=dd;n._processToken(e)}function z8(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.HEAD){n._insertElement(e,X.HTML);n.headElement=n.openElements.current;n.insertionMode=Br}else{Ra(n,e)}}function Q8(n,e){const t=e.tagName;if(t===g.HEAD||t===g.BODY||t===g.HTML||t===g.BR){Ra(n,e)}else{n._err(pt.endTagWithoutMatchingOpenElement)}}function Ra(n,e){n._insertFakeElement(g.HEAD);n.headElement=n.openElements.current;n.insertionMode=Br;n._processToken(e)}function rt(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.BASE||t===g.BASEFONT||t===g.BGSOUND||t===g.LINK||t===g.META){n._appendElement(e,X.HTML);e.ackSelfClosing=true}else if(t===g.TITLE){n._switchToTextParsing(e,A.MODE.RCDATA)}else if(t===g.NOSCRIPT){if(n.options.scriptingEnabled){n._switchToTextParsing(e,A.MODE.RAWTEXT)}else{n._insertElement(e,X.HTML);n.insertionMode=ZC}}else if(t===g.NOFRAMES||t===g.STYLE){n._switchToTextParsing(e,A.MODE.RAWTEXT)}else if(t===g.SCRIPT){n._switchToTextParsing(e,A.MODE.SCRIPT_DATA)}else if(t===g.TEMPLATE){n._insertTemplate(e,X.HTML);n.activeFormattingElements.insertMarker();n.framesetOk=false;n.insertionMode=ad;n._pushTmplInsertionMode(ad)}else if(t===g.HEAD){n._err(pt.misplacedStartTagForHeadElement)}else{ka(n,e)}}function $s(n,e){const t=e.tagName;if(t===g.HEAD){n.openElements.pop();n.insertionMode=cd}else if(t===g.BODY||t===g.BR||t===g.HTML){ka(n,e)}else if(t===g.TEMPLATE){if(n.openElements.tmplCount>0){n.openElements.generateImpliedEndTagsThoroughly();if(n.openElements.currentTagName!==g.TEMPLATE){n._err(pt.closingOfElementWithOpenChildElements)}n.openElements.popUntilTagNamePopped(g.TEMPLATE);n.activeFormattingElements.clearToLastMarker();n._popTmplInsertionMode();n._resetInsertionMode()}else{n._err(pt.endTagWithoutMatchingOpenElement)}}else{n._err(pt.endTagWithoutMatchingOpenElement)}}function ka(n,e){n.openElements.pop();n.insertionMode=cd;n._processToken(e)}function Y8(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.BASEFONT||t===g.BGSOUND||t===g.HEAD||t===g.LINK||t===g.META||t===g.NOFRAMES||t===g.STYLE){rt(n,e)}else if(t===g.NOSCRIPT){n._err(pt.nestedNoscriptInHead)}else{Pa(n,e)}}function X8(n,e){const t=e.tagName;if(t===g.NOSCRIPT){n.openElements.pop();n.insertionMode=Br}else if(t===g.BR){Pa(n,e)}else{n._err(pt.endTagWithoutMatchingOpenElement)}}function Pa(n,e){const t=e.type===A.EOF_TOKEN?pt.openElementsLeftAfterEof:pt.disallowedContentInNoscriptInHead;n._err(t);n.openElements.pop();n.insertionMode=Br;n._processToken(e)}function J8(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.BODY){n._insertElement(e,X.HTML);n.framesetOk=false;n.insertionMode=Vn}else if(t===g.FRAMESET){n._insertElement(e,X.HTML);n.insertionMode=md}else if(t===g.BASE||t===g.BASEFONT||t===g.BGSOUND||t===g.LINK||t===g.META||t===g.NOFRAMES||t===g.SCRIPT||t===g.STYLE||t===g.TEMPLATE||t===g.TITLE){n._err(pt.abandonedHeadElementChild);n.openElements.push(n.headElement);rt(n,e);n.openElements.remove(n.headElement)}else if(t===g.HEAD){n._err(pt.misplacedStartTagForHeadElement)}else{_a(n,e)}}function Z8(n,e){const t=e.tagName;if(t===g.BODY||t===g.HTML||t===g.BR){_a(n,e)}else if(t===g.TEMPLATE){$s(n,e)}else{n._err(pt.endTagWithoutMatchingOpenElement)}}function _a(n,e){n._insertFakeElement(g.BODY);n.insertionMode=Vn;n._processToken(e)}function Ns(n,e){n._reconstructActiveFormattingElements();n._insertCharacters(e)}function sd(n,e){n._reconstructActiveFormattingElements();n._insertCharacters(e);n.framesetOk=false}function eL(n,e){if(n.openElements.tmplCount===0){n.treeAdapter.adoptAttributes(n.openElements.items[0],e.attrs)}}function tL(n,e){const t=n.openElements.tryPeekProperlyNestedBodyElement();if(t&&n.openElements.tmplCount===0){n.framesetOk=false;n.treeAdapter.adoptAttributes(t,e.attrs)}}function nL(n,e){const t=n.openElements.tryPeekProperlyNestedBodyElement();if(n.framesetOk&&t){n.treeAdapter.detachNode(t);n.openElements.popAllUpToHtmlElement();n._insertElement(e,X.HTML);n.insertionMode=md}}function di(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML)}function iL(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}const t=n.openElements.currentTagName;if(t===g.H1||t===g.H2||t===g.H3||t===g.H4||t===g.H5||t===g.H6){n.openElements.pop()}n._insertElement(e,X.HTML)}function KC(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML);n.skipNextNewLine=true;n.framesetOk=false}function sL(n,e){const t=n.openElements.tmplCount>0;if(!n.formElement||t){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML);if(!t){n.formElement=n.openElements.current}}}function rL(n,e){n.framesetOk=false;const t=e.tagName;for(let i=n.openElements.stackTop;i>=0;i--){const s=n.openElements.items[i];const r=n.treeAdapter.getTagName(s);let o=null;if(t===g.LI&&r===g.LI){o=g.LI}else if((t===g.DD||t===g.DT)&&(r===g.DD||r===g.DT)){o=r}if(o){n.openElements.generateImpliedEndTagsWithExclusion(o);n.openElements.popUntilTagNamePopped(o);break}if(r!==g.ADDRESS&&r!==g.DIV&&r!==g.P&&n._isSpecialElement(s)){break}}if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML)}function oL(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML);n.tokenizer.state=A.MODE.PLAINTEXT}function aL(n,e){if(n.openElements.hasInScope(g.BUTTON)){n.openElements.generateImpliedEndTags();n.openElements.popUntilTagNamePopped(g.BUTTON)}n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML);n.framesetOk=false}function uL(n,e){const t=n.activeFormattingElements.getElementEntryInScopeWithTagName(g.A);if(t){Ji(n,e);n.openElements.remove(t.element);n.activeFormattingElements.removeEntry(t)}n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML);n.activeFormattingElements.pushElement(n.openElements.current,e)}function Fr(n,e){n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML);n.activeFormattingElements.pushElement(n.openElements.current,e)}function lL(n,e){n._reconstructActiveFormattingElements();if(n.openElements.hasInScope(g.NOBR)){Ji(n,e);n._reconstructActiveFormattingElements()}n._insertElement(e,X.HTML);n.activeFormattingElements.pushElement(n.openElements.current,e)}function WC(n,e){n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML);n.activeFormattingElements.insertMarker();n.framesetOk=false}function dL(n,e){if(n.treeAdapter.getDocumentMode(n.document)!==Fs.DOCUMENT_MODE.QUIRKS&&n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML);n.framesetOk=false;n.insertionMode=Ct}function $r(n,e){n._reconstructActiveFormattingElements();n._appendElement(e,X.HTML);n.framesetOk=false;e.ackSelfClosing=true}function cL(n,e){n._reconstructActiveFormattingElements();n._appendElement(e,X.HTML);const t=A.getTokenAttr(e,YC.TYPE);if(!t||t.toLowerCase()!==XC){n.framesetOk=false}e.ackSelfClosing=true}function jC(n,e){n._appendElement(e,X.HTML);e.ackSelfClosing=true}function hL(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._appendElement(e,X.HTML);n.framesetOk=false;n.ackSelfClosing=true}function pL(n,e){e.tagName=g.IMG;$r(n,e)}function mL(n,e){n._insertElement(e,X.HTML);n.skipNextNewLine=true;n.tokenizer.state=A.MODE.RCDATA;n.originalInsertionMode=n.insertionMode;n.framesetOk=false;n.insertionMode=od}function fL(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._reconstructActiveFormattingElements();n.framesetOk=false;n._switchToTextParsing(e,A.MODE.RAWTEXT)}function gL(n,e){n.framesetOk=false;n._switchToTextParsing(e,A.MODE.RAWTEXT)}function VC(n,e){n._switchToTextParsing(e,A.MODE.RAWTEXT)}function yL(n,e){n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML);n.framesetOk=false;if(n.insertionMode===Ct||n.insertionMode===hd||n.insertionMode===mn||n.insertionMode===pi||n.insertionMode===pd){n.insertionMode=t1}else{n.insertionMode=e1}}function GC(n,e){if(n.openElements.currentTagName===g.OPTION){n.openElements.pop()}n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML)}function zC(n,e){if(n.openElements.hasInScope(g.RUBY)){n.openElements.generateImpliedEndTags()}n._insertElement(e,X.HTML)}function TL(n,e){if(n.openElements.hasInScope(g.RUBY)){n.openElements.generateImpliedEndTagsWithExclusion(g.RTC)}n._insertElement(e,X.HTML)}function bL(n,e){if(n.openElements.hasInButtonScope(g.P)){n._closePElement()}n._insertElement(e,X.HTML)}function vL(n,e){n._reconstructActiveFormattingElements();jn.adjustTokenMathMLAttrs(e);jn.adjustTokenXMLAttrs(e);if(e.selfClosing){n._appendElement(e,X.MATHML)}else{n._insertElement(e,X.MATHML)}e.ackSelfClosing=true}function SL(n,e){n._reconstructActiveFormattingElements();jn.adjustTokenSVGAttrs(e);jn.adjustTokenXMLAttrs(e);if(e.selfClosing){n._appendElement(e,X.SVG)}else{n._insertElement(e,X.SVG)}e.ackSelfClosing=true}function hn(n,e){n._reconstructActiveFormattingElements();n._insertElement(e,X.HTML)}function Ft(n,e){const t=e.tagName;switch(t.length){case 1:if(t===g.I||t===g.S||t===g.B||t===g.U){Fr(n,e)}else if(t===g.P){di(n,e)}else if(t===g.A){uL(n,e)}else{hn(n,e)}break;case 2:if(t===g.DL||t===g.OL||t===g.UL){di(n,e)}else if(t===g.H1||t===g.H2||t===g.H3||t===g.H4||t===g.H5||t===g.H6){iL(n,e)}else if(t===g.LI||t===g.DD||t===g.DT){rL(n,e)}else if(t===g.EM||t===g.TT){Fr(n,e)}else if(t===g.BR){$r(n,e)}else if(t===g.HR){hL(n,e)}else if(t===g.RB){zC(n,e)}else if(t===g.RT||t===g.RP){TL(n,e)}else if(t!==g.TH&&t!==g.TD&&t!==g.TR){hn(n,e)}break;case 3:if(t===g.DIV||t===g.DIR||t===g.NAV){di(n,e)}else if(t===g.PRE){KC(n,e)}else if(t===g.BIG){Fr(n,e)}else if(t===g.IMG||t===g.WBR){$r(n,e)}else if(t===g.XMP){fL(n,e)}else if(t===g.SVG){SL(n,e)}else if(t===g.RTC){zC(n,e)}else if(t!==g.COL){hn(n,e)}break;case 4:if(t===g.HTML){eL(n,e)}else if(t===g.BASE||t===g.LINK||t===g.META){rt(n,e)}else if(t===g.BODY){tL(n,e)}else if(t===g.MAIN||t===g.MENU){di(n,e)}else if(t===g.FORM){sL(n,e)}else if(t===g.CODE||t===g.FONT){Fr(n,e)}else if(t===g.NOBR){lL(n,e)}else if(t===g.AREA){$r(n,e)}else if(t===g.MATH){vL(n,e)}else if(t===g.MENU){bL(n,e)}else if(t!==g.HEAD){hn(n,e)}break;case 5:if(t===g.STYLE||t===g.TITLE){rt(n,e)}else if(t===g.ASIDE){di(n,e)}else if(t===g.SMALL){Fr(n,e)}else if(t===g.TABLE){dL(n,e)}else if(t===g.EMBED){$r(n,e)}else if(t===g.INPUT){cL(n,e)}else if(t===g.PARAM||t===g.TRACK){jC(n,e)}else if(t===g.IMAGE){pL(n,e)}else if(t!==g.FRAME&&t!==g.TBODY&&t!==g.TFOOT&&t!==g.THEAD){hn(n,e)}break;case 6:if(t===g.SCRIPT){rt(n,e)}else if(t===g.CENTER||t===g.FIGURE||t===g.FOOTER||t===g.HEADER||t===g.HGROUP||t===g.DIALOG){di(n,e)}else if(t===g.BUTTON){aL(n,e)}else if(t===g.STRIKE||t===g.STRONG){Fr(n,e)}else if(t===g.APPLET||t===g.OBJECT){WC(n,e)}else if(t===g.KEYGEN){$r(n,e)}else if(t===g.SOURCE){jC(n,e)}else if(t===g.IFRAME){gL(n,e)}else if(t===g.SELECT){yL(n,e)}else if(t===g.OPTION){GC(n,e)}else{hn(n,e)}break;case 7:if(t===g.BGSOUND){rt(n,e)}else if(t===g.DETAILS||t===g.ADDRESS||t===g.ARTICLE||t===g.SECTION||t===g.SUMMARY){di(n,e)}else if(t===g.LISTING){KC(n,e)}else if(t===g.MARQUEE){WC(n,e)}else if(t===g.NOEMBED){VC(n,e)}else if(t!==g.CAPTION){hn(n,e)}break;case 8:if(t===g.BASEFONT){rt(n,e)}else if(t===g.FRAMESET){nL(n,e)}else if(t===g.FIELDSET){di(n,e)}else if(t===g.TEXTAREA){mL(n,e)}else if(t===g.TEMPLATE){rt(n,e)}else if(t===g.NOSCRIPT){if(n.options.scriptingEnabled){VC(n,e)}else{hn(n,e)}}else if(t===g.OPTGROUP){GC(n,e)}else if(t!==g.COLGROUP){hn(n,e)}break;case 9:if(t===g.PLAINTEXT){oL(n,e)}else{hn(n,e)}break;case 10:if(t===g.BLOCKQUOTE||t===g.FIGCAPTION){di(n,e)}else{hn(n,e)}break;default:hn(n,e)}}function CL(n){if(n.openElements.hasInScope(g.BODY)){n.insertionMode=n1}}function xL(n,e){if(n.openElements.hasInScope(g.BODY)){n.insertionMode=n1;n._processToken(e)}}function Xi(n,e){const t=e.tagName;if(n.openElements.hasInScope(t)){n.openElements.generateImpliedEndTags();n.openElements.popUntilTagNamePopped(t)}}function wL(n){const e=n.openElements.tmplCount>0;const t=n.formElement;if(!e){n.formElement=null}if((t||e)&&n.openElements.hasInScope(g.FORM)){n.openElements.generateImpliedEndTags();if(e){n.openElements.popUntilTagNamePopped(g.FORM)}else{n.openElements.remove(t)}}}function IL(n){if(!n.openElements.hasInButtonScope(g.P)){n._insertFakeElement(g.P)}n._closePElement()}function ML(n){if(n.openElements.hasInListItemScope(g.LI)){n.openElements.generateImpliedEndTagsWithExclusion(g.LI);n.openElements.popUntilTagNamePopped(g.LI)}}function EL(n,e){const t=e.tagName;if(n.openElements.hasInScope(t)){n.openElements.generateImpliedEndTagsWithExclusion(t);n.openElements.popUntilTagNamePopped(t)}}function AL(n){if(n.openElements.hasNumberedHeaderInScope()){n.openElements.generateImpliedEndTags();n.openElements.popUntilNumberedHeaderPopped()}}function QC(n,e){const t=e.tagName;if(n.openElements.hasInScope(t)){n.openElements.generateImpliedEndTags();n.openElements.popUntilTagNamePopped(t);n.activeFormattingElements.clearToLastMarker()}}function RL(n){n._reconstructActiveFormattingElements();n._insertFakeElement(g.BR);n.openElements.pop();n.framesetOk=false}function En(n,e){const t=e.tagName;for(let i=n.openElements.stackTop;i>0;i--){const s=n.openElements.items[i];if(n.treeAdapter.getTagName(s)===t){n.openElements.generateImpliedEndTagsWithExclusion(t);n.openElements.popUntilElementPopped(s);break}if(n._isSpecialElement(s)){break}}}function i1(n,e){const t=e.tagName;switch(t.length){case 1:if(t===g.A||t===g.B||t===g.I||t===g.S||t===g.U){Ji(n,e)}else if(t===g.P){IL(n,e)}else{En(n,e)}break;case 2:if(t===g.DL||t===g.UL||t===g.OL){Xi(n,e)}else if(t===g.LI){ML(n,e)}else if(t===g.DD||t===g.DT){EL(n,e)}else if(t===g.H1||t===g.H2||t===g.H3||t===g.H4||t===g.H5||t===g.H6){AL(n,e)}else if(t===g.BR){RL(n,e)}else if(t===g.EM||t===g.TT){Ji(n,e)}else{En(n,e)}break;case 3:if(t===g.BIG){Ji(n,e)}else if(t===g.DIR||t===g.DIV||t===g.NAV||t===g.PRE){Xi(n,e)}else{En(n,e)}break;case 4:if(t===g.BODY){CL(n,e)}else if(t===g.HTML){xL(n,e)}else if(t===g.FORM){wL(n,e)}else if(t===g.CODE||t===g.FONT||t===g.NOBR){Ji(n,e)}else if(t===g.MAIN||t===g.MENU){Xi(n,e)}else{En(n,e)}break;case 5:if(t===g.ASIDE){Xi(n,e)}else if(t===g.SMALL){Ji(n,e)}else{En(n,e)}break;case 6:if(t===g.CENTER||t===g.FIGURE||t===g.FOOTER||t===g.HEADER||t===g.HGROUP||t===g.DIALOG){Xi(n,e)}else if(t===g.APPLET||t===g.OBJECT){QC(n,e)}else if(t===g.STRIKE||t===g.STRONG){Ji(n,e)}else{En(n,e)}break;case 7:if(t===g.ADDRESS||t===g.ARTICLE||t===g.DETAILS||t===g.SECTION||t===g.SUMMARY||t===g.LISTING){Xi(n,e)}else if(t===g.MARQUEE){QC(n,e)}else{En(n,e)}break;case 8:if(t===g.FIELDSET){Xi(n,e)}else if(t===g.TEMPLATE){$s(n,e)}else{En(n,e)}break;case 10:if(t===g.BLOCKQUOTE||t===g.FIGCAPTION){Xi(n,e)}else{En(n,e)}break;default:En(n,e)}}function ci(n,e){if(n.tmplInsertionModeStackTop>-1){ox(n,e)}else{n.stopped=true}}function kL(n,e){if(e.tagName===g.SCRIPT){n.pendingScript=n.openElements.current}n.openElements.pop();n.insertionMode=n.originalInsertionMode}function PL(n,e){n._err(pt.eofInElementThatCanContainOnlyText);n.openElements.pop();n.insertionMode=n.originalInsertionMode;n._processToken(e)}function hi(n,e){const t=n.openElements.currentTagName;if(t===g.TABLE||t===g.TBODY||t===g.TFOOT||t===g.THEAD||t===g.TR){n.pendingCharacterTokens=[];n.hasNonWhitespacePendingCharacterToken=false;n.originalInsertionMode=n.insertionMode;n.insertionMode=ex;n._processToken(e)}else{pn(n,e)}}function _L(n,e){n.openElements.clearBackToTableContext();n.activeFormattingElements.insertMarker();n._insertElement(e,X.HTML);n.insertionMode=hd}function LL(n,e){n.openElements.clearBackToTableContext();n._insertElement(e,X.HTML);n.insertionMode=La}function OL(n,e){n.openElements.clearBackToTableContext();n._insertFakeElement(g.COLGROUP);n.insertionMode=La;n._processToken(e)}function DL(n,e){n.openElements.clearBackToTableContext();n._insertElement(e,X.HTML);n.insertionMode=mn}function NL(n,e){n.openElements.clearBackToTableContext();n._insertFakeElement(g.TBODY);n.insertionMode=mn;n._processToken(e)}function FL(n,e){if(n.openElements.hasInTableScope(g.TABLE)){n.openElements.popUntilTagNamePopped(g.TABLE);n._resetInsertionMode();n._processToken(e)}}function $L(n,e){const t=A.getTokenAttr(e,YC.TYPE);if(t&&t.toLowerCase()===XC){n._appendElement(e,X.HTML)}else{pn(n,e)}e.ackSelfClosing=true}function BL(n,e){if(!n.formElement&&n.openElements.tmplCount===0){n._insertElement(e,X.HTML);n.formElement=n.openElements.current;n.openElements.pop()}}function s1(n,e){const t=e.tagName;switch(t.length){case 2:if(t===g.TD||t===g.TH||t===g.TR){NL(n,e)}else{pn(n,e)}break;case 3:if(t===g.COL){OL(n,e)}else{pn(n,e)}break;case 4:if(t===g.FORM){BL(n,e)}else{pn(n,e)}break;case 5:if(t===g.TABLE){FL(n,e)}else if(t===g.STYLE){rt(n,e)}else if(t===g.TBODY||t===g.TFOOT||t===g.THEAD){DL(n,e)}else if(t===g.INPUT){$L(n,e)}else{pn(n,e)}break;case 6:if(t===g.SCRIPT){rt(n,e)}else{pn(n,e)}break;case 7:if(t===g.CAPTION){_L(n,e)}else{pn(n,e)}break;case 8:if(t===g.COLGROUP){LL(n,e)}else if(t===g.TEMPLATE){rt(n,e)}else{pn(n,e)}break;default:pn(n,e)}}function r1(n,e){const t=e.tagName;if(t===g.TABLE){if(n.openElements.hasInTableScope(g.TABLE)){n.openElements.popUntilTagNamePopped(g.TABLE);n._resetInsertionMode()}}else if(t===g.TEMPLATE){$s(n,e)}else if(t!==g.BODY&&t!==g.CAPTION&&t!==g.COL&&t!==g.COLGROUP&&t!==g.HTML&&t!==g.TBODY&&t!==g.TD&&t!==g.TFOOT&&t!==g.TH&&t!==g.THEAD&&t!==g.TR){pn(n,e)}}function pn(n,e){const t=n.fosterParentingEnabled;n.fosterParentingEnabled=true;n._processTokenInBodyMode(e);n.fosterParentingEnabled=t}function qL(n,e){n.pendingCharacterTokens.push(e)}function HL(n,e){n.pendingCharacterTokens.push(e);n.hasNonWhitespacePendingCharacterToken=true}function Ea(n,e){let t=0;if(n.hasNonWhitespacePendingCharacterToken){for(;t<n.pendingCharacterTokens.length;t++){pn(n,n.pendingCharacterTokens[t])}}else{for(;t<n.pendingCharacterTokens.length;t++){n._insertCharacters(n.pendingCharacterTokens[t])}}n.insertionMode=n.originalInsertionMode;n._processToken(e)}function UL(n,e){const t=e.tagName;if(t===g.CAPTION||t===g.COL||t===g.COLGROUP||t===g.TBODY||t===g.TD||t===g.TFOOT||t===g.TH||t===g.THEAD||t===g.TR){if(n.openElements.hasInTableScope(g.CAPTION)){n.openElements.generateImpliedEndTags();n.openElements.popUntilTagNamePopped(g.CAPTION);n.activeFormattingElements.clearToLastMarker();n.insertionMode=Ct;n._processToken(e)}}else{Ft(n,e)}}function KL(n,e){const t=e.tagName;if(t===g.CAPTION||t===g.TABLE){if(n.openElements.hasInTableScope(g.CAPTION)){n.openElements.generateImpliedEndTags();n.openElements.popUntilTagNamePopped(g.CAPTION);n.activeFormattingElements.clearToLastMarker();n.insertionMode=Ct;if(t===g.TABLE){n._processToken(e)}}}else if(t!==g.BODY&&t!==g.COL&&t!==g.COLGROUP&&t!==g.HTML&&t!==g.TBODY&&t!==g.TD&&t!==g.TFOOT&&t!==g.TH&&t!==g.THEAD&&t!==g.TR){i1(n,e)}}function WL(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.COL){n._appendElement(e,X.HTML);e.ackSelfClosing=true}else if(t===g.TEMPLATE){rt(n,e)}else{ud(n,e)}}function jL(n,e){const t=e.tagName;if(t===g.COLGROUP){if(n.openElements.currentTagName===g.COLGROUP){n.openElements.pop();n.insertionMode=Ct}}else if(t===g.TEMPLATE){$s(n,e)}else if(t!==g.COL){ud(n,e)}}function ud(n,e){if(n.openElements.currentTagName===g.COLGROUP){n.openElements.pop();n.insertionMode=Ct;n._processToken(e)}}function VL(n,e){const t=e.tagName;if(t===g.TR){n.openElements.clearBackToTableBodyContext();n._insertElement(e,X.HTML);n.insertionMode=pi}else if(t===g.TH||t===g.TD){n.openElements.clearBackToTableBodyContext();n._insertFakeElement(g.TR);n.insertionMode=pi;n._processToken(e)}else if(t===g.CAPTION||t===g.COL||t===g.COLGROUP||t===g.TBODY||t===g.TFOOT||t===g.THEAD){if(n.openElements.hasTableBodyContextInTableScope()){n.openElements.clearBackToTableBodyContext();n.openElements.pop();n.insertionMode=Ct;n._processToken(e)}}else{s1(n,e)}}function GL(n,e){const t=e.tagName;if(t===g.TBODY||t===g.TFOOT||t===g.THEAD){if(n.openElements.hasInTableScope(t)){n.openElements.clearBackToTableBodyContext();n.openElements.pop();n.insertionMode=Ct}}else if(t===g.TABLE){if(n.openElements.hasTableBodyContextInTableScope()){n.openElements.clearBackToTableBodyContext();n.openElements.pop();n.insertionMode=Ct;n._processToken(e)}}else if(t!==g.BODY&&t!==g.CAPTION&&t!==g.COL&&t!==g.COLGROUP||t!==g.HTML&&t!==g.TD&&t!==g.TH&&t!==g.TR){r1(n,e)}}function zL(n,e){const t=e.tagName;if(t===g.TH||t===g.TD){n.openElements.clearBackToTableRowContext();n._insertElement(e,X.HTML);n.insertionMode=pd;n.activeFormattingElements.insertMarker()}else if(t===g.CAPTION||t===g.COL||t===g.COLGROUP||t===g.TBODY||t===g.TFOOT||t===g.THEAD||t===g.TR){if(n.openElements.hasInTableScope(g.TR)){n.openElements.clearBackToTableRowContext();n.openElements.pop();n.insertionMode=mn;n._processToken(e)}}else{s1(n,e)}}function QL(n,e){const t=e.tagName;if(t===g.TR){if(n.openElements.hasInTableScope(g.TR)){n.openElements.clearBackToTableRowContext();n.openElements.pop();n.insertionMode=mn}}else if(t===g.TABLE){if(n.openElements.hasInTableScope(g.TR)){n.openElements.clearBackToTableRowContext();n.openElements.pop();n.insertionMode=mn;n._processToken(e)}}else if(t===g.TBODY||t===g.TFOOT||t===g.THEAD){if(n.openElements.hasInTableScope(t)||n.openElements.hasInTableScope(g.TR)){n.openElements.clearBackToTableRowContext();n.openElements.pop();n.insertionMode=mn;n._processToken(e)}}else if(t!==g.BODY&&t!==g.CAPTION&&t!==g.COL&&t!==g.COLGROUP||t!==g.HTML&&t!==g.TD&&t!==g.TH){r1(n,e)}}function YL(n,e){const t=e.tagName;if(t===g.CAPTION||t===g.COL||t===g.COLGROUP||t===g.TBODY||t===g.TD||t===g.TFOOT||t===g.TH||t===g.THEAD||t===g.TR){if(n.openElements.hasInTableScope(g.TD)||n.openElements.hasInTableScope(g.TH)){n._closeTableCell();n._processToken(e)}}else{Ft(n,e)}}function XL(n,e){const t=e.tagName;if(t===g.TD||t===g.TH){if(n.openElements.hasInTableScope(t)){n.openElements.generateImpliedEndTags();n.openElements.popUntilTagNamePopped(t);n.activeFormattingElements.clearToLastMarker();n.insertionMode=pi}}else if(t===g.TABLE||t===g.TBODY||t===g.TFOOT||t===g.THEAD||t===g.TR){if(n.openElements.hasInTableScope(t)){n._closeTableCell();n._processToken(e)}}else if(t!==g.BODY&&t!==g.CAPTION&&t!==g.COL&&t!==g.COLGROUP&&t!==g.HTML){i1(n,e)}}function sx(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.OPTION){if(n.openElements.currentTagName===g.OPTION){n.openElements.pop()}n._insertElement(e,X.HTML)}else if(t===g.OPTGROUP){if(n.openElements.currentTagName===g.OPTION){n.openElements.pop()}if(n.openElements.currentTagName===g.OPTGROUP){n.openElements.pop()}n._insertElement(e,X.HTML)}else if(t===g.INPUT||t===g.KEYGEN||t===g.TEXTAREA||t===g.SELECT){if(n.openElements.hasInSelectScope(g.SELECT)){n.openElements.popUntilTagNamePopped(g.SELECT);n._resetInsertionMode();if(t!==g.SELECT){n._processToken(e)}}}else if(t===g.SCRIPT||t===g.TEMPLATE){rt(n,e)}}function rx(n,e){const t=e.tagName;if(t===g.OPTGROUP){const i=n.openElements.items[n.openElements.stackTop-1];const s=i&&n.treeAdapter.getTagName(i);if(n.openElements.currentTagName===g.OPTION&&s===g.OPTGROUP){n.openElements.pop()}if(n.openElements.currentTagName===g.OPTGROUP){n.openElements.pop()}}else if(t===g.OPTION){if(n.openElements.currentTagName===g.OPTION){n.openElements.pop()}}else if(t===g.SELECT&&n.openElements.hasInSelectScope(g.SELECT)){n.openElements.popUntilTagNamePopped(g.SELECT);n._resetInsertionMode()}else if(t===g.TEMPLATE){$s(n,e)}}function JL(n,e){const t=e.tagName;if(t===g.CAPTION||t===g.TABLE||t===g.TBODY||t===g.TFOOT||t===g.THEAD||t===g.TR||t===g.TD||t===g.TH){n.openElements.popUntilTagNamePopped(g.SELECT);n._resetInsertionMode();n._processToken(e)}else{sx(n,e)}}function ZL(n,e){const t=e.tagName;if(t===g.CAPTION||t===g.TABLE||t===g.TBODY||t===g.TFOOT||t===g.THEAD||t===g.TR||t===g.TD||t===g.TH){if(n.openElements.hasInTableScope(t)){n.openElements.popUntilTagNamePopped(g.SELECT);n._resetInsertionMode();n._processToken(e)}}else{rx(n,e)}}function eO(n,e){const t=e.tagName;if(t===g.BASE||t===g.BASEFONT||t===g.BGSOUND||t===g.LINK||t===g.META||t===g.NOFRAMES||t===g.SCRIPT||t===g.STYLE||t===g.TEMPLATE||t===g.TITLE){rt(n,e)}else{const i=F8[t]||Vn;n._popTmplInsertionMode();n._pushTmplInsertionMode(i);n.insertionMode=i;n._processToken(e)}}function tO(n,e){if(e.tagName===g.TEMPLATE){$s(n,e)}}function ox(n,e){if(n.openElements.tmplCount>0){n.openElements.popUntilTagNamePopped(g.TEMPLATE);n.activeFormattingElements.clearToLastMarker();n._popTmplInsertionMode();n._resetInsertionMode();n._processToken(e)}else{n.stopped=true}}function nO(n,e){if(e.tagName===g.HTML){Ft(n,e)}else{ld(n,e)}}function iO(n,e){if(e.tagName===g.HTML){if(!n.fragmentContext){n.insertionMode=nx}}else{ld(n,e)}}function ld(n,e){n.insertionMode=Vn;n._processToken(e)}function sO(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.FRAMESET){n._insertElement(e,X.HTML)}else if(t===g.FRAME){n._appendElement(e,X.HTML);e.ackSelfClosing=true}else if(t===g.NOFRAMES){rt(n,e)}}function rO(n,e){if(e.tagName===g.FRAMESET&&!n.openElements.isRootHtmlElementCurrent()){n.openElements.pop();if(!n.fragmentContext&&n.openElements.currentTagName!==g.FRAMESET){n.insertionMode=tx}}}function oO(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.NOFRAMES){rt(n,e)}}function aO(n,e){if(e.tagName===g.HTML){n.insertionMode=ix}}function uO(n,e){if(e.tagName===g.HTML){Ft(n,e)}else{rd(n,e)}}function rd(n,e){n.insertionMode=Vn;n._processToken(e)}function lO(n,e){const t=e.tagName;if(t===g.HTML){Ft(n,e)}else if(t===g.NOFRAMES){rt(n,e)}}function dO(n,e){e.chars=_8.REPLACEMENT_CHARACTER;n._insertCharacters(e)}function cO(n,e){n._insertCharacters(e);n.framesetOk=false}function hO(n,e){if(jn.causesExit(e)&&!n.fragmentContext){while(n.treeAdapter.getNamespaceURI(n.openElements.current)!==X.HTML&&!n._isIntegrationPoint(n.openElements.current)){n.openElements.pop()}n._processToken(e)}else{const t=n._getAdjustedCurrentElement();const i=n.treeAdapter.getNamespaceURI(t);if(i===X.MATHML){jn.adjustTokenMathMLAttrs(e)}else if(i===X.SVG){jn.adjustTokenSVGTagName(e);jn.adjustTokenSVGAttrs(e)}jn.adjustTokenXMLAttrs(e);if(e.selfClosing){n._appendElement(e,i)}else{n._insertElement(e,i)}e.ackSelfClosing=true}}function pO(n,e){for(let t=n.openElements.stackTop;t>0;t--){const i=n.openElements.items[t];if(n.treeAdapter.getNamespaceURI(i)===X.HTML){n._processToken(e);break}if(n.treeAdapter.getTagName(i).toLowerCase()===e.tagName){n.openElements.popUntilElementPopped(i);break}}}});var cx=ce((mX,dx)=>{"use strict";var mO=Gf();var fO=zf();var gO=Qf();var lx=Qi();var Oe=lx.TAG_NAMES;var fd=lx.NAMESPACES;var yO={treeAdapter:mO};var TO=/&/g;var bO=/\u00a0/g;var vO=/"/g;var SO=/</g;var CO=/>/g;var gd=class n{constructor(e,t){this.options=fO(yO,t);this.treeAdapter=this.options.treeAdapter;this.html="";this.startNode=e}serialize(){this._serializeChildNodes(this.startNode);return this.html}_serializeChildNodes(e){const t=this.treeAdapter.getChildNodes(e);if(t){for(let i=0,s=t.length;i<s;i++){const r=t[i];if(this.treeAdapter.isElementNode(r)){this._serializeElement(r)}else if(this.treeAdapter.isTextNode(r)){this._serializeTextNode(r)}else if(this.treeAdapter.isCommentNode(r)){this._serializeCommentNode(r)}else if(this.treeAdapter.isDocumentTypeNode(r)){this._serializeDocumentTypeNode(r)}}}}_serializeElement(e){const t=this.treeAdapter.getTagName(e);const i=this.treeAdapter.getNamespaceURI(e);this.html+="<"+t;this._serializeAttributes(e);this.html+=">";if(t!==Oe.AREA&&t!==Oe.BASE&&t!==Oe.BASEFONT&&t!==Oe.BGSOUND&&t!==Oe.BR&&t!==Oe.COL&&t!==Oe.EMBED&&t!==Oe.FRAME&&t!==Oe.HR&&t!==Oe.IMG&&t!==Oe.INPUT&&t!==Oe.KEYGEN&&t!==Oe.LINK&&t!==Oe.META&&t!==Oe.PARAM&&t!==Oe.SOURCE&&t!==Oe.TRACK&&t!==Oe.WBR){const s=t===Oe.TEMPLATE&&i===fd.HTML?this.treeAdapter.getTemplateContent(e):e;this._serializeChildNodes(s);this.html+="</"+t+">"}}_serializeAttributes(e){const t=this.treeAdapter.getAttrList(e);for(let i=0,s=t.length;i<s;i++){const r=t[i];const o=n.escapeString(r.value,true);this.html+=" ";if(!r.namespace){this.html+=r.name}else if(r.namespace===fd.XML){this.html+="xml:"+r.name}else if(r.namespace===fd.XMLNS){if(r.name!=="xmlns"){this.html+="xmlns:"}this.html+=r.name}else if(r.namespace===fd.XLINK){this.html+="xlink:"+r.name}else{this.html+=r.prefix+":"+r.name}this.html+='="'+o+'"'}}_serializeTextNode(e){const t=this.treeAdapter.getTextNodeContent(e);const i=this.treeAdapter.getParentNode(e);let s=void 0;if(i&&this.treeAdapter.isElementNode(i)){s=this.treeAdapter.getTagName(i)}if(s===Oe.STYLE||s===Oe.SCRIPT||s===Oe.XMP||s===Oe.IFRAME||s===Oe.NOEMBED||s===Oe.NOFRAMES||s===Oe.PLAINTEXT||s===Oe.NOSCRIPT){this.html+=t}else{this.html+=n.escapeString(t,false)}}_serializeCommentNode(e){this.html+="<!--"+this.treeAdapter.getCommentNodeContent(e)+"-->"}_serializeDocumentTypeNode(e){const t=this.treeAdapter.getDocumentTypeNodeName(e);this.html+="<"+gO.serializeContent(t,null,null)+">"}};gd.escapeString=function(n,e){n=n.replace(TO,"&").replace(bO," ");if(e){n=n.replace(vO,""")}else{n=n.replace(SO,"<").replace(CO,">")}return n};dx.exports=gd});var px=ce(yd=>{"use strict";var hx=ux();var xO=cx();yd.parse=function n(e,t){const i=new hx(t);return i.parse(e)};yd.parseFragment=function n(e,t,i){if(typeof e==="string"){i=t;t=e;e=null}const s=new hx(i);return s.parseFragment(t,e)};yd.serialize=function(n,e){const t=new xO(n,e);return t.serialize()}});var a1=ce(qr=>{"use strict";var o1=qr.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};qr.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"};qr.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};var U=qr.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};qr.SPECIAL_ELEMENTS={[o1.HTML]:{[U.ADDRESS]:true,[U.APPLET]:true,[U.AREA]:true,[U.ARTICLE]:true,[U.ASIDE]:true,[U.BASE]:true,[U.BASEFONT]:true,[U.BGSOUND]:true,[U.BLOCKQUOTE]:true,[U.BODY]:true,[U.BR]:true,[U.BUTTON]:true,[U.CAPTION]:true,[U.CENTER]:true,[U.COL]:true,[U.COLGROUP]:true,[U.DD]:true,[U.DETAILS]:true,[U.DIR]:true,[U.DIV]:true,[U.DL]:true,[U.DT]:true,[U.EMBED]:true,[U.FIELDSET]:true,[U.FIGCAPTION]:true,[U.FIGURE]:true,[U.FOOTER]:true,[U.FORM]:true,[U.FRAME]:true,[U.FRAMESET]:true,[U.H1]:true,[U.H2]:true,[U.H3]:true,[U.H4]:true,[U.H5]:true,[U.H6]:true,[U.HEAD]:true,[U.HEADER]:true,[U.HGROUP]:true,[U.HR]:true,[U.HTML]:true,[U.IFRAME]:true,[U.IMG]:true,[U.INPUT]:true,[U.LI]:true,[U.LINK]:true,[U.LISTING]:true,[U.MAIN]:true,[U.MARQUEE]:true,[U.MENU]:true,[U.META]:true,[U.NAV]:true,[U.NOEMBED]:true,[U.NOFRAMES]:true,[U.NOSCRIPT]:true,[U.OBJECT]:true,[U.OL]:true,[U.P]:true,[U.PARAM]:true,[U.PLAINTEXT]:true,[U.PRE]:true,[U.SCRIPT]:true,[U.SECTION]:true,[U.SELECT]:true,[U.SOURCE]:true,[U.STYLE]:true,[U.SUMMARY]:true,[U.TABLE]:true,[U.TBODY]:true,[U.TD]:true,[U.TEMPLATE]:true,[U.TEXTAREA]:true,[U.TFOOT]:true,[U.TH]:true,[U.THEAD]:true,[U.TITLE]:true,[U.TR]:true,[U.TRACK]:true,[U.UL]:true,[U.WBR]:true,[U.XMP]:true},[o1.MATHML]:{[U.MI]:true,[U.MO]:true,[U.MN]:true,[U.MS]:true,[U.MTEXT]:true,[U.ANNOTATION_XML]:true},[o1.SVG]:{[U.TITLE]:true,[U.FOREIGN_OBJECT]:true,[U.DESC]:true}}});var bx=ce(Td=>{"use strict";var{DOCUMENT_MODE:Hr}=a1();var gx="html";var wO="about:legacy-compat";var IO="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd";var yx=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"];var MO=yx.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);var EO=["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"];var Tx=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"];var AO=Tx.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);function mx(n){const e=n.indexOf('"')!==-1?"'":'"';return e+n+e}function fx(n,e){for(let t=0;t<e.length;t++){if(n.indexOf(e[t])===0){return true}}return false}Td.isConforming=function(n){return n.name===gx&&n.publicId===null&&(n.systemId===null||n.systemId===wO)};Td.getDocumentMode=function(n){if(n.name!==gx){return Hr.QUIRKS}const e=n.systemId;if(e&&e.toLowerCase()===IO){return Hr.QUIRKS}let t=n.publicId;if(t!==null){t=t.toLowerCase();if(EO.indexOf(t)>-1){return Hr.QUIRKS}let i=e===null?MO:yx;if(fx(t,i)){return Hr.QUIRKS}i=e===null?Tx:AO;if(fx(t,i)){return Hr.LIMITED_QUIRKS}}return Hr.NO_QUIRKS};Td.serializeContent=function(n,e,t){let i="!DOCTYPE ";if(n){i+=n}if(e){i+=" PUBLIC "+mx(e)}else if(t){i+=" SYSTEM"}if(t!==null){i+=" "+mx(t)}return i}});var xx=ce(be=>{"use strict";var RO=bx();var{DOCUMENT_MODE:kO}=a1();var vx={element:1,text:3,cdata:4,comment:8};var Sx={tagName:"name",childNodes:"children",parentNode:"parent",previousSibling:"prev",nextSibling:"next",nodeValue:"data"};var mi=class{constructor(e){for(const t of Object.keys(e)){this[t]=e[t]}}get firstChild(){const e=this.children;return e&&e[0]||null}get lastChild(){const e=this.children;return e&&e[e.length-1]||null}get nodeType(){return vx[this.type]||vx.element}};Object.keys(Sx).forEach(n=>{const e=Sx[n];Object.defineProperty(mi.prototype,n,{get:function(){return this[e]||null},set:function(t){this[e]=t;return t}})});be.createDocument=function(){return new mi({type:"root",name:"root",parent:null,prev:null,next:null,children:[],"x-mode":kO.NO_QUIRKS})};be.createDocumentFragment=function(){return new mi({type:"root",name:"root",parent:null,prev:null,next:null,children:[]})};be.createElement=function(n,e,t){const i=Object.create(null);const s=Object.create(null);const r=Object.create(null);for(let o=0;o<t.length;o++){const a=t[o].name;i[a]=t[o].value;s[a]=t[o].namespace;r[a]=t[o].prefix}return new mi({type:n==="script"||n==="style"?n:"tag",name:n,namespace:e,attribs:i,"x-attribsNamespace":s,"x-attribsPrefix":r,children:[],parent:null,prev:null,next:null})};be.createCommentNode=function(n){return new mi({type:"comment",data:n,parent:null,prev:null,next:null})};var Cx=function(n){return new mi({type:"text",data:n,parent:null,prev:null,next:null})};var u1=be.appendChild=function(n,e){const t=n.children[n.children.length-1];if(t){t.next=e;e.prev=t}n.children.push(e);e.parent=n};var PO=be.insertBefore=function(n,e,t){const i=n.children.indexOf(t);const s=t.prev;if(s){s.next=e;e.prev=s}t.prev=e;e.next=t;n.children.splice(i,0,e);e.parent=n};be.setTemplateContent=function(n,e){u1(n,e)};be.getTemplateContent=function(n){return n.children[0]};be.setDocumentType=function(n,e,t,i){const s=RO.serializeContent(e,t,i);let r=null;for(let o=0;o<n.children.length;o++){if(n.children[o].type==="directive"&&n.children[o].name==="!doctype"){r=n.children[o];break}}if(r){r.data=s;r["x-name"]=e;r["x-publicId"]=t;r["x-systemId"]=i}else{u1(n,new mi({type:"directive",name:"!doctype",data:s,"x-name":e,"x-publicId":t,"x-systemId":i}))}};be.setDocumentMode=function(n,e){n["x-mode"]=e};be.getDocumentMode=function(n){return n["x-mode"]};be.detachNode=function(n){if(n.parent){const e=n.parent.children.indexOf(n);const t=n.prev;const i=n.next;n.prev=null;n.next=null;if(t){t.next=i}if(i){i.prev=t}n.parent.children.splice(e,1);n.parent=null}};be.insertText=function(n,e){const t=n.children[n.children.length-1];if(t&&t.type==="text"){t.data+=e}else{u1(n,Cx(e))}};be.insertTextBefore=function(n,e,t){const i=n.children[n.children.indexOf(t)-1];if(i&&i.type==="text"){i.data+=e}else{PO(n,Cx(e),t)}};be.adoptAttributes=function(n,e){for(let t=0;t<e.length;t++){const i=e[t].name;if(typeof n.attribs[i]==="undefined"){n.attribs[i]=e[t].value;n["x-attribsNamespace"][i]=e[t].namespace;n["x-attribsPrefix"][i]=e[t].prefix}}};be.getFirstChild=function(n){return n.children[0]};be.getChildNodes=function(n){return n.children};be.getParentNode=function(n){return n.parent};be.getAttrList=function(n){const e=[];for(const t in n.attribs){e.push({name:t,value:n.attribs[t],namespace:n["x-attribsNamespace"][t],prefix:n["x-attribsPrefix"][t]})}return e};be.getTagName=function(n){return n.name};be.getNamespaceURI=function(n){return n.namespace};be.getTextNodeContent=function(n){return n.data};be.getCommentNodeContent=function(n){return n.data};be.getDocumentTypeNodeName=function(n){return n["x-name"]};be.getDocumentTypeNodePublicId=function(n){return n["x-publicId"]};be.getDocumentTypeNodeSystemId=function(n){return n["x-systemId"]};be.isTextNode=function(n){return n.type==="text"};be.isCommentNode=function(n){return n.type==="comment"};be.isDocumentTypeNode=function(n){return n.type==="directive"&&n.name==="!doctype"};be.isElementNode=function(n){return!!n.attribs};be.setNodeSourceCodeLocation=function(n,e){n.sourceCodeLocation=e};be.getNodeSourceCodeLocation=function(n){return n.sourceCodeLocation};be.updateNodeSourceCodeLocation=function(n,e){n.sourceCodeLocation=Object.assign(n.sourceCodeLocation,e)}});var Ix=ce((bX,wx)=>{"use strict";wx.exports={"aliceblue":[240,248,255],"antiquewhite":[250,235,215],"aqua":[0,255,255],"aquamarine":[127,255,212],"azure":[240,255,255],"beige":[245,245,220],"bisque":[255,228,196],"black":[0,0,0],"blanchedalmond":[255,235,205],"blue":[0,0,255],"blueviolet":[138,43,226],"brown":[165,42,42],"burlywood":[222,184,135],"cadetblue":[95,158,160],"chartreuse":[127,255,0],"chocolate":[210,105,30],"coral":[255,127,80],"cornflowerblue":[100,149,237],"cornsilk":[255,248,220],"crimson":[220,20,60],"cyan":[0,255,255],"darkblue":[0,0,139],"darkcyan":[0,139,139],"darkgoldenrod":[184,134,11],"darkgray":[169,169,169],"darkgreen":[0,100,0],"darkgrey":[169,169,169],"darkkhaki":[189,183,107],"darkmagenta":[139,0,139],"darkolivegreen":[85,107,47],"darkorange":[255,140,0],"darkorchid":[153,50,204],"darkred":[139,0,0],"darksalmon":[233,150,122],"darkseagreen":[143,188,143],"darkslateblue":[72,61,139],"darkslategray":[47,79,79],"darkslategrey":[47,79,79],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[105,105,105],"dimgrey":[105,105,105],"dodgerblue":[30,144,255],"firebrick":[178,34,34],"floralwhite":[255,250,240],"forestgreen":[34,139,34],"fuchsia":[255,0,255],"gainsboro":[220,220,220],"ghostwhite":[248,248,255],"gold":[255,215,0],"goldenrod":[218,165,32],"gray":[128,128,128],"green":[0,128,0],"greenyellow":[173,255,47],"grey":[128,128,128],"honeydew":[240,255,240],"hotpink":[255,105,180],"indianred":[205,92,92],"indigo":[75,0,130],"ivory":[255,255,240],"khaki":[240,230,140],"lavender":[230,230,250],"lavenderblush":[255,240,245],"lawngreen":[124,252,0],"lemonchiffon":[255,250,205],"lightblue":[173,216,230],"lightcoral":[240,128,128],"lightcyan":[224,255,255],"lightgoldenrodyellow":[250,250,210],"lightgray":[211,211,211],"lightgreen":[144,238,144],"lightgrey":[211,211,211],"lightpink":[255,182,193],"lightsalmon":[255,160,122],"lightseagreen":[32,178,170],"lightskyblue":[135,206,250],"lightslategray":[119,136,153],"lightslategrey":[119,136,153],"lightsteelblue":[176,196,222],"lightyellow":[255,255,224],"lime":[0,255,0],"limegreen":[50,205,50],"linen":[250,240,230],"magenta":[255,0,255],"maroon":[128,0,0],"mediumaquamarine":[102,205,170],"mediumblue":[0,0,205],"mediumorchid":[186,85,211],"mediumpurple":[147,112,219],"mediumseagreen":[60,179,113],"mediumslateblue":[123,104,238],"mediumspringgreen":[0,250,154],"mediumturquoise":[72,209,204],"mediumvioletred":[199,21,133],"midnightblue":[25,25,112],"mintcream":[245,255,250],"mistyrose":[255,228,225],"moccasin":[255,228,181],"navajowhite":[255,222,173],"navy":[0,0,128],"oldlace":[253,245,230],"olive":[128,128,0],"olivedrab":[107,142,35],"orange":[255,165,0],"orangered":[255,69,0],"orchid":[218,112,214],"palegoldenrod":[238,232,170],"palegreen":[152,251,152],"paleturquoise":[175,238,238],"palevioletred":[219,112,147],"papayawhip":[255,239,213],"peachpuff":[255,218,185],"peru":[205,133,63],"pink":[255,192,203],"plum":[221,160,221],"powderblue":[176,224,230],"purple":[128,0,128],"rebeccapurple":[102,51,153],"red":[255,0,0],"rosybrown":[188,143,143],"royalblue":[65,105,225],"saddlebrown":[139,69,19],"salmon":[250,128,114],"sandybrown":[244,164,96],"seagreen":[46,139,87],"seashell":[255,245,238],"sienna":[160,82,45],"silver":[192,192,192],"skyblue":[135,206,235],"slateblue":[106,90,205],"slategray":[112,128,144],"slategrey":[112,128,144],"snow":[255,250,250],"springgreen":[0,255,127],"steelblue":[70,130,180],"tan":[210,180,140],"teal":[0,128,128],"thistle":[216,191,216],"tomato":[255,99,71],"turquoise":[64,224,208],"violet":[238,130,238],"wheat":[245,222,179],"white":[255,255,255],"whitesmoke":[245,245,245],"yellow":[255,255,0],"yellowgreen":[154,205,50]}});var l1=ce((vX,Ex)=>{var Oa=Ix();var Mx={};for(const n of Object.keys(Oa)){Mx[Oa[n]]=n}var Z={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Ex.exports=Z;for(const n of Object.keys(Z)){if(!("channels"in Z[n])){throw new Error("missing channels property: "+n)}if(!("labels"in Z[n])){throw new Error("missing channel labels property: "+n)}if(Z[n].labels.length!==Z[n].channels){throw new Error("channel and label counts mismatch: "+n)}const{channels:e,labels:t}=Z[n];delete Z[n].channels;delete Z[n].labels;Object.defineProperty(Z[n],"channels",{value:e});Object.defineProperty(Z[n],"labels",{value:t})}Z.rgb.hsl=function(n){const e=n[0]/255;const t=n[1]/255;const i=n[2]/255;const s=Math.min(e,t,i);const r=Math.max(e,t,i);const o=r-s;let a;let u;if(r===s){a=0}else if(e===r){a=(t-i)/o}else if(t===r){a=2+(i-e)/o}else if(i===r){a=4+(e-t)/o}a=Math.min(a*60,360);if(a<0){a+=360}const l=(s+r)/2;if(r===s){u=0}else if(l<=.5){u=o/(r+s)}else{u=o/(2-r-s)}return[a,u*100,l*100]};Z.rgb.hsv=function(n){let e;let t;let i;let s;let r;const o=n[0]/255;const a=n[1]/255;const u=n[2]/255;const l=Math.max(o,a,u);const d=l-Math.min(o,a,u);const h=function(m){return(l-m)/6/d+1/2};if(d===0){s=0;r=0}else{r=d/l;e=h(o);t=h(a);i=h(u);if(o===l){s=i-t}else if(a===l){s=1/3+e-i}else if(u===l){s=2/3+t-e}if(s<0){s+=1}else if(s>1){s-=1}}return[s*360,r*100,l*100]};Z.rgb.hwb=function(n){const e=n[0];const t=n[1];let i=n[2];const s=Z.rgb.hsl(n)[0];const r=1/255*Math.min(e,Math.min(t,i));i=1-1/255*Math.max(e,Math.max(t,i));return[s,r*100,i*100]};Z.rgb.cmyk=function(n){const e=n[0]/255;const t=n[1]/255;const i=n[2]/255;const s=Math.min(1-e,1-t,1-i);const r=(1-e-s)/(1-s)||0;const o=(1-t-s)/(1-s)||0;const a=(1-i-s)/(1-s)||0;return[r*100,o*100,a*100,s*100]};function _O(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}Z.rgb.keyword=function(n){const e=Mx[n];if(e){return e}let t=Infinity;let i;for(const s of Object.keys(Oa)){const r=Oa[s];const o=_O(n,r);if(o<t){t=o;i=s}}return i};Z.keyword.rgb=function(n){return Oa[n]};Z.rgb.xyz=function(n){let e=n[0]/255;let t=n[1]/255;let i=n[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92;i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;const s=e*.4124+t*.3576+i*.1805;const r=e*.2126+t*.7152+i*.0722;const o=e*.0193+t*.1192+i*.9505;return[s*100,r*100,o*100]};Z.rgb.lab=function(n){const e=Z.rgb.xyz(n);let t=e[0];let i=e[1];let s=e[2];t/=95.047;i/=100;s/=108.883;t=t>.008856?t**(1/3):7.787*t+16/116;i=i>.008856?i**(1/3):7.787*i+16/116;s=s>.008856?s**(1/3):7.787*s+16/116;const r=116*i-16;const o=500*(t-i);const a=200*(i-s);return[r,o,a]};Z.hsl.rgb=function(n){const e=n[0]/360;const t=n[1]/100;const i=n[2]/100;let s;let r;let o;if(t===0){o=i*255;return[o,o,o]}if(i<.5){s=i*(1+t)}else{s=i+t-i*t}const a=2*i-s;const u=[0,0,0];for(let l=0;l<3;l++){r=e+1/3*-(l-1);if(r<0){r++}if(r>1){r--}if(6*r<1){o=a+(s-a)*6*r}else if(2*r<1){o=s}else if(3*r<2){o=a+(s-a)*(2/3-r)*6}else{o=a}u[l]=o*255}return u};Z.hsl.hsv=function(n){const e=n[0];let t=n[1]/100;let i=n[2]/100;let s=t;const r=Math.max(i,.01);i*=2;t*=i<=1?i:2-i;s*=r<=1?r:2-r;const o=(i+t)/2;const a=i===0?2*s/(r+s):2*t/(i+t);return[e,a*100,o*100]};Z.hsv.rgb=function(n){const e=n[0]/60;const t=n[1]/100;let i=n[2]/100;const s=Math.floor(e)%6;const r=e-Math.floor(e);const o=255*i*(1-t);const a=255*i*(1-t*r);const u=255*i*(1-t*(1-r));i*=255;switch(s){case 0:return[i,u,o];case 1:return[a,i,o];case 2:return[o,i,u];case 3:return[o,a,i];case 4:return[u,o,i];case 5:return[i,o,a]}};Z.hsv.hsl=function(n){const e=n[0];const t=n[1]/100;const i=n[2]/100;const s=Math.max(i,.01);let r;let o;o=(2-t)*i;const a=(2-t)*s;r=t*s;r/=a<=1?a:2-a;r=r||0;o/=2;return[e,r*100,o*100]};Z.hwb.rgb=function(n){const e=n[0]/360;let t=n[1]/100;let i=n[2]/100;const s=t+i;let r;if(s>1){t/=s;i/=s}const o=Math.floor(6*e);const a=1-i;r=6*e-o;if((o&1)!==0){r=1-r}const u=t+r*(a-t);let l;let d;let h;switch(o){default:case 6:case 0:l=a;d=u;h=t;break;case 1:l=u;d=a;h=t;break;case 2:l=t;d=a;h=u;break;case 3:l=t;d=u;h=a;break;case 4:l=u;d=t;h=a;break;case 5:l=a;d=t;h=u;break}return[l*255,d*255,h*255]};Z.cmyk.rgb=function(n){const e=n[0]/100;const t=n[1]/100;const i=n[2]/100;const s=n[3]/100;const r=1-Math.min(1,e*(1-s)+s);const o=1-Math.min(1,t*(1-s)+s);const a=1-Math.min(1,i*(1-s)+s);return[r*255,o*255,a*255]};Z.xyz.rgb=function(n){const e=n[0]/100;const t=n[1]/100;const i=n[2]/100;let s;let r;let o;s=e*3.2406+t*-1.5372+i*-.4986;r=e*-.9689+t*1.8758+i*.0415;o=e*.0557+t*-.204+i*1.057;s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92;r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92;o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92;s=Math.min(Math.max(0,s),1);r=Math.min(Math.max(0,r),1);o=Math.min(Math.max(0,o),1);return[s*255,r*255,o*255]};Z.xyz.lab=function(n){let e=n[0];let t=n[1];let i=n[2];e/=95.047;t/=100;i/=108.883;e=e>.008856?e**(1/3):7.787*e+16/116;t=t>.008856?t**(1/3):7.787*t+16/116;i=i>.008856?i**(1/3):7.787*i+16/116;const s=116*t-16;const r=500*(e-t);const o=200*(t-i);return[s,r,o]};Z.lab.xyz=function(n){const e=n[0];const t=n[1];const i=n[2];let s;let r;let o;r=(e+16)/116;s=t/500+r;o=r-i/200;const a=r**3;const u=s**3;const l=o**3;r=a>.008856?a:(r-16/116)/7.787;s=u>.008856?u:(s-16/116)/7.787;o=l>.008856?l:(o-16/116)/7.787;s*=95.047;r*=100;o*=108.883;return[s,r,o]};Z.lab.lch=function(n){const e=n[0];const t=n[1];const i=n[2];let s;const r=Math.atan2(i,t);s=r*360/2/Math.PI;if(s<0){s+=360}const o=Math.sqrt(t*t+i*i);return[e,o,s]};Z.lch.lab=function(n){const e=n[0];const t=n[1];const i=n[2];const s=i/360*2*Math.PI;const r=t*Math.cos(s);const o=t*Math.sin(s);return[e,r,o]};Z.rgb.ansi16=function(n,e=null){const[t,i,s]=n;let r=e===null?Z.rgb.hsv(n)[2]:e;r=Math.round(r/50);if(r===0){return 30}let o=30+(Math.round(s/255)<<2|Math.round(i/255)<<1|Math.round(t/255));if(r===2){o+=60}return o};Z.hsv.ansi16=function(n){return Z.rgb.ansi16(Z.hsv.rgb(n),n[2])};Z.rgb.ansi256=function(n){const e=n[0];const t=n[1];const i=n[2];if(e===t&&t===i){if(e<8){return 16}if(e>248){return 231}return Math.round((e-8)/247*24)+232}const s=16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(i/255*5);return s};Z.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7){if(n>50){e+=3.5}e=e/10.5*255;return[e,e,e]}const t=(~~(n>50)+1)*.5;const i=(e&1)*t*255;const s=(e>>1&1)*t*255;const r=(e>>2&1)*t*255;return[i,s,r]};Z.ansi256.rgb=function(n){if(n>=232){const r=(n-232)*10+8;return[r,r,r]}n-=16;let e;const t=Math.floor(n/36)/5*255;const i=Math.floor((e=n%36)/6)/5*255;const s=e%6/5*255;return[t,i,s]};Z.rgb.hex=function(n){const e=((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255);const t=e.toString(16).toUpperCase();return"000000".substring(t.length)+t};Z.hex.rgb=function(n){const e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e){return[0,0,0]}let t=e[0];if(e[0].length===3){t=t.split("").map(a=>{return a+a}).join("")}const i=parseInt(t,16);const s=i>>16&255;const r=i>>8&255;const o=i&255;return[s,r,o]};Z.rgb.hcg=function(n){const e=n[0]/255;const t=n[1]/255;const i=n[2]/255;const s=Math.max(Math.max(e,t),i);const r=Math.min(Math.min(e,t),i);const o=s-r;let a;let u;if(o<1){a=r/(1-o)}else{a=0}if(o<=0){u=0}else if(s===e){u=(t-i)/o%6}else if(s===t){u=2+(i-e)/o}else{u=4+(e-t)/o}u/=6;u%=1;return[u*360,o*100,a*100]};Z.hsl.hcg=function(n){const e=n[1]/100;const t=n[2]/100;const i=t<.5?2*e*t:2*e*(1-t);let s=0;if(i<1){s=(t-.5*i)/(1-i)}return[n[0],i*100,s*100]};Z.hsv.hcg=function(n){const e=n[1]/100;const t=n[2]/100;const i=e*t;let s=0;if(i<1){s=(t-i)/(1-i)}return[n[0],i*100,s*100]};Z.hcg.rgb=function(n){const e=n[0]/360;const t=n[1]/100;const i=n[2]/100;if(t===0){return[i*255,i*255,i*255]}const s=[0,0,0];const r=e%1*6;const o=r%1;const a=1-o;let u=0;switch(Math.floor(r)){case 0:s[0]=1;s[1]=o;s[2]=0;break;case 1:s[0]=a;s[1]=1;s[2]=0;break;case 2:s[0]=0;s[1]=1;s[2]=o;break;case 3:s[0]=0;s[1]=a;s[2]=1;break;case 4:s[0]=o;s[1]=0;s[2]=1;break;default:s[0]=1;s[1]=0;s[2]=a}u=(1-t)*i;return[(t*s[0]+u)*255,(t*s[1]+u)*255,(t*s[2]+u)*255]};Z.hcg.hsv=function(n){const e=n[1]/100;const t=n[2]/100;const i=e+t*(1-e);let s=0;if(i>0){s=e/i}return[n[0],s*100,i*100]};Z.hcg.hsl=function(n){const e=n[1]/100;const t=n[2]/100;const i=t*(1-e)+.5*e;let s=0;if(i>0&&i<.5){s=e/(2*i)}else if(i>=.5&&i<1){s=e/(2*(1-i))}return[n[0],s*100,i*100]};Z.hcg.hwb=function(n){const e=n[1]/100;const t=n[2]/100;const i=e+t*(1-e);return[n[0],(i-e)*100,(1-i)*100]};Z.hwb.hcg=function(n){const e=n[1]/100;const t=n[2]/100;const i=1-t;const s=i-e;let r=0;if(s<1){r=(i-s)/(1-s)}return[n[0],s*100,r*100]};Z.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};Z.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};Z.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};Z.gray.hsl=function(n){return[0,0,n[0]]};Z.gray.hsv=Z.gray.hsl;Z.gray.hwb=function(n){return[0,100,n[0]]};Z.gray.cmyk=function(n){return[0,0,0,n[0]]};Z.gray.lab=function(n){return[n[0],0,0]};Z.gray.hex=function(n){const e=Math.round(n[0]/100*255)&255;const t=(e<<16)+(e<<8)+e;const i=t.toString(16).toUpperCase();return"000000".substring(i.length)+i};Z.rgb.gray=function(n){const e=(n[0]+n[1]+n[2])/3;return[e/255*100]}});var Rx=ce((SX,Ax)=>{var bd=l1();function LO(){const n={};const e=Object.keys(bd);for(let t=e.length,i=0;i<t;i++){n[e[i]]={distance:-1,parent:null}}return n}function OO(n){const e=LO();const t=[n];e[n].distance=0;while(t.length){const i=t.pop();const s=Object.keys(bd[i]);for(let r=s.length,o=0;o<r;o++){const a=s[o];const u=e[a];if(u.distance===-1){u.distance=e[i].distance+1;u.parent=i;t.unshift(a)}}}return e}function DO(n,e){return function(t){return e(n(t))}}function NO(n,e){const t=[e[n].parent,n];let i=bd[e[n].parent][n];let s=e[n].parent;while(e[s].parent){t.unshift(e[s].parent);i=DO(bd[e[s].parent][s],i);s=e[s].parent}i.conversion=t;return i}Ax.exports=function(n){const e=OO(n);const t={};const i=Object.keys(e);for(let s=i.length,r=0;r<s;r++){const o=i[r];const a=e[o];if(a.parent===null){continue}t[o]=NO(o,e)}return t}});var Px=ce((CX,kx)=>{var d1=l1();var FO=Rx();var Ur={};var $O=Object.keys(d1);function BO(n){const e=function(...t){const i=t[0];if(i===void 0||i===null){return i}if(i.length>1){t=i}return n(t)};if("conversion"in n){e.conversion=n.conversion}return e}function qO(n){const e=function(...t){const i=t[0];if(i===void 0||i===null){return i}if(i.length>1){t=i}const s=n(t);if(typeof s==="object"){for(let r=s.length,o=0;o<r;o++){s[o]=Math.round(s[o])}}return s};if("conversion"in n){e.conversion=n.conversion}return e}$O.forEach(n=>{Ur[n]={};Object.defineProperty(Ur[n],"channels",{value:d1[n].channels});Object.defineProperty(Ur[n],"labels",{value:d1[n].labels});const e=FO(n);const t=Object.keys(e);t.forEach(i=>{const s=e[i];Ur[n][i]=qO(s);Ur[n][i].raw=BO(s)})});kx.exports=Ur});var Fx=ce((xX,Nx)=>{"use strict";var _x=(n,e)=>(...t)=>{const i=n(...t);return`\x1B[${i+e}m`};var Lx=(n,e)=>(...t)=>{const i=n(...t);return`\x1B[${38+e};5;${i}m`};var Ox=(n,e)=>(...t)=>{const i=n(...t);return`\x1B[${38+e};2;${i[0]};${i[1]};${i[2]}m`};var vd=n=>n;var Dx=(n,e,t)=>[n,e,t];var Kr=(n,e,t)=>{Object.defineProperty(n,e,{get:()=>{const i=t();Object.defineProperty(n,e,{value:i,enumerable:true,configurable:true});return i},enumerable:true,configurable:true})};var c1;var Wr=(n,e,t,i)=>{if(c1===void 0){c1=Px()}const s=i?10:0;const r={};for(const[o,a]of Object.entries(c1)){const u=o==="ansi16"?"ansi":o;if(o===e){r[u]=n(t,s)}else if(typeof a==="object"){r[u]=n(a[e],s)}}return r};function HO(){const n=new Map;const e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright;e.bgColor.bgGray=e.bgColor.bgBlackBright;e.color.grey=e.color.blackBright;e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(const[t,i]of Object.entries(e)){for(const[s,r]of Object.entries(i)){e[s]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`};i[s]=e[s];n.set(r[0],r[1])}Object.defineProperty(e,t,{value:i,enumerable:false})}Object.defineProperty(e,"codes",{value:n,enumerable:false});e.color.close="\x1B[39m";e.bgColor.close="\x1B[49m";Kr(e.color,"ansi",()=>Wr(_x,"ansi16",vd,false));Kr(e.color,"ansi256",()=>Wr(Lx,"ansi256",vd,false));Kr(e.color,"ansi16m",()=>Wr(Ox,"rgb",Dx,false));Kr(e.bgColor,"ansi",()=>Wr(_x,"ansi16",vd,true));Kr(e.bgColor,"ansi256",()=>Wr(Lx,"ansi256",vd,true));Kr(e.bgColor,"ansi16m",()=>Wr(Ox,"rgb",Dx,true));return e}Object.defineProperty(Nx,"exports",{enumerable:true,get:HO})});var Bx=ce((wX,$x)=>{"use strict";var UO=(n,e,t)=>{let i=n.indexOf(e);if(i===-1){return n}const s=e.length;let r=0;let o="";do{o+=n.substr(r,i-r)+e+t;r=i+s;i=n.indexOf(e,r)}while(i!==-1);o+=n.substr(r);return o};var KO=(n,e,t,i)=>{let s=0;let r="";do{const o=n[i-1]==="\r";r+=n.substr(s,(o?i-1:i)-s)+e+(o?"\r\n":"\n")+t;s=i+1;i=n.indexOf("\n",s)}while(i!==-1);r+=n.substr(s);return r};$x.exports={stringReplaceAll:UO,stringEncaseCRLFWithFirstIndex:KO}});var Wx=ce((IX,Kx)=>{"use strict";var WO=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi;var qx=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g;var jO=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/;var VO=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi;var GO=new Map([["n","\n"],["r","\r"],["t"," "],["b","\b"],["f","\f"],["v","\v"],["0","\0"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function Ux(n){const e=n[0]==="u";const t=n[1]==="{";if(e&&!t&&n.length===5||n[0]==="x"&&n.length===3){return String.fromCharCode(parseInt(n.slice(1),16))}if(e&&t){return String.fromCodePoint(parseInt(n.slice(2,-1),16))}return GO.get(n)||n}function zO(n,e){const t=[];const i=e.trim().split(/\s*,\s*/g);let s;for(const r of i){const o=Number(r);if(!Number.isNaN(o)){t.push(o)}else if(s=r.match(jO)){t.push(s[2].replace(VO,(a,u,l)=>u?Ux(u):l))}else{throw new Error(`Invalid Chalk template style argument: ${r} (in style '${n}')`)}}return t}function QO(n){qx.lastIndex=0;const e=[];let t;while((t=qx.exec(n))!==null){const i=t[1];if(t[2]){const s=zO(i,t[2]);e.push([i].concat(s))}else{e.push([i])}}return e}function Hx(n,e){const t={};for(const s of e){for(const r of s.styles){t[r[0]]=s.inverse?null:r.slice(1)}}let i=n;for(const[s,r]of Object.entries(t)){if(!Array.isArray(r)){continue}if(!(s in i)){throw new Error(`Unknown Chalk style: ${s}`)}i=r.length>0?i[s](...r):i[s]}return i}Kx.exports=(n,e)=>{const t=[];const i=[];let s=[];e.replace(WO,(r,o,a,u,l,d)=>{if(o){s.push(Ux(o))}else if(u){const h=s.join("");s=[];i.push(t.length===0?h:Hx(n,t)(h));t.push({inverse:a,styles:QO(u)})}else if(l){if(t.length===0){throw new Error("Found extraneous } in Chalk template literal")}i.push(Hx(n,t)(s.join("")));s=[];t.pop()}else{s.push(d)}});i.push(s.join(""));if(t.length>0){const r=`Chalk template literal is missing ${t.length} closing bracket${t.length===1?"":"s"} (\`}\`)`;throw new Error(r)}return i.join("")}});var Xx=ce((MX,Yx)=>{"use strict";var Da=Fx();var{stdout:p1,stderr:m1}=w9();var{stringReplaceAll:YO,stringEncaseCRLFWithFirstIndex:XO}=Bx();var{isArray:Sd}=Array;var Vx=["ansi","ansi","ansi256","ansi16m"];var jr=Object.create(null);var JO=(n,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3)){throw new Error("The `level` option should be an integer from 0 to 3")}const t=p1?p1.level:0;n.level=e.level===void 0?t:e.level};var f1=class{constructor(e){return Gx(e)}};var Gx=n=>{const e={};JO(e,n);e.template=(...t)=>Qx(e.template,...t);Object.setPrototypeOf(e,Cd.prototype);Object.setPrototypeOf(e.template,e);e.template.constructor=()=>{throw new Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")};e.template.Instance=f1;return e.template};function Cd(n){return Gx(n)}for(const[n,e]of Object.entries(Da)){jr[n]={get(){const t=xd(this,g1(e.open,e.close,this._styler),this._isEmpty);Object.defineProperty(this,n,{value:t});return t}}}jr.visible={get(){const n=xd(this,this._styler,true);Object.defineProperty(this,"visible",{value:n});return n}};var zx=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(const n of zx){jr[n]={get(){const{level:e}=this;return function(...t){const i=g1(Da.color[Vx[e]][n](...t),Da.color.close,this._styler);return xd(this,i,this._isEmpty)}}}}for(const n of zx){const e="bg"+n[0].toUpperCase()+n.slice(1);jr[e]={get(){const{level:t}=this;return function(...i){const s=g1(Da.bgColor[Vx[t]][n](...i),Da.bgColor.close,this._styler);return xd(this,s,this._isEmpty)}}}}var ZO=Object.defineProperties(()=>{},{...jr,level:{enumerable:true,get(){return this._generator.level},set(n){this._generator.level=n}}});var g1=(n,e,t)=>{let i;let s;if(t===void 0){i=n;s=e}else{i=t.openAll+n;s=e+t.closeAll}return{open:n,close:e,openAll:i,closeAll:s,parent:t}};var xd=(n,e,t)=>{const i=(...s)=>{if(Sd(s[0])&&Sd(s[0].raw)){return jx(i,Qx(i,...s))}return jx(i,s.length===1?""+s[0]:s.join(" "))};Object.setPrototypeOf(i,ZO);i._generator=n;i._styler=e;i._isEmpty=t;return i};var jx=(n,e)=>{if(n.level<=0||!e){return n._isEmpty?"":e}let t=n._styler;if(t===void 0){return e}const{openAll:i,closeAll:s}=t;if(e.indexOf("\x1B")!==-1){while(t!==void 0){e=YO(e,t.close,t.open);t=t.parent}}const r=e.indexOf("\n");if(r!==-1){e=XO(e,s,i,r)}return i+e+s};var h1;var Qx=(n,...e)=>{const[t]=e;if(!Sd(t)||!Sd(t.raw)){return e.join(" ")}const i=e.slice(1);const s=[t.raw[0]];for(let r=1;r<t.length;r++){s.push(String(i[r-1]).replace(/[{}\\]/g,"\\$&"),String(t.raw[r]))}if(h1===void 0){h1=Wx()}return h1(n,s.join(""))};Object.defineProperties(Cd.prototype,jr);var wd=Cd();wd.supportsColor=p1;wd.stderr=Cd({level:m1?m1.level:0});wd.stderr.supportsColor=m1;Yx.exports=wd});var y1=ce(ue=>{"use strict";var e6=ue&&ue.__importDefault||function(n){return n&&n.__esModule?n:{"default":n}};Object.defineProperty(ue,"__esModule",{value:true});ue.parse=ue.stringify=ue.toJson=ue.fromJson=ue.DEFAULT_THEME=ue.plain=void 0;var ze=e6(Xx());var t6=function(n){return n};ue.plain=t6;ue.DEFAULT_THEME={keyword:ze.default.blue,built_in:ze.default.cyan,type:ze.default.cyan.dim,literal:ze.default.blue,number:ze.default.green,regexp:ze.default.red,string:ze.default.red,subst:ue.plain,symbol:ue.plain,class:ze.default.blue,function:ze.default.yellow,title:ue.plain,params:ue.plain,comment:ze.default.green,doctag:ze.default.green,meta:ze.default.grey,"meta-keyword":ue.plain,"meta-string":ue.plain,section:ue.plain,tag:ze.default.grey,name:ze.default.blue,"builtin-name":ue.plain,attr:ze.default.cyan,attribute:ue.plain,variable:ue.plain,bullet:ue.plain,code:ue.plain,emphasis:ze.default.italic,strong:ze.default.bold,formula:ue.plain,link:ze.default.underline,quote:ue.plain,"selector-tag":ue.plain,"selector-id":ue.plain,"selector-class":ue.plain,"selector-attr":ue.plain,"selector-pseudo":ue.plain,"template-tag":ue.plain,"template-variable":ue.plain,addition:ze.default.green,deletion:ze.default.red,default:ue.plain};function Jx(n){var e={};for(var t=0,i=Object.keys(n);t<i.length;t++){var s=i[t];var r=n[s];if(Array.isArray(r)){;e[s]=r.reduce(function(o,a){return a==="plain"?ue.plain:o[a]},ze.default)}else{;e[s]=ze.default[r]}}return e}ue.fromJson=Jx;function Zx(n){var e={};for(var t=0,i=Object.keys(e);t<i.length;t++){var s=i[t];var r=e[s];e[s]=r._styles}return e}ue.toJson=Zx;function n6(n){return JSON.stringify(Zx(n))}ue.stringify=n6;function i6(n){return Jx(JSON.parse(n))}ue.parse=i6});var iw=ce(Xe=>{"use strict";var ew=Xe&&Xe.__createBinding||(Object.create?(function(n,e,t,i){if(i===void 0)i=t;Object.defineProperty(n,i,{enumerable:true,get:function(){return e[t]}})}):(function(n,e,t,i){if(i===void 0)i=t;n[i]=e[t]}));var s6=Xe&&Xe.__setModuleDefault||(Object.create?(function(n,e){Object.defineProperty(n,"default",{enumerable:true,value:e})}):function(n,e){n["default"]=e});var tw=Xe&&Xe.__importStar||function(n){if(n&&n.__esModule)return n;var e={};if(n!=null){for(var t in n)if(t!=="default"&&Object.prototype.hasOwnProperty.call(n,t))ew(e,n,t)}s6(e,n);return e};var r6=Xe&&Xe.__exportStar||function(n,e){for(var t in n)if(t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t))ew(e,n,t)};var o6=Xe&&Xe.__importDefault||function(n){return n&&n.__esModule?n:{"default":n}};Object.defineProperty(Xe,"__esModule",{value:true});Xe.supportsLanguage=Xe.listLanguages=Xe.highlight=void 0;var Md=tw(I9());var a6=tw(px());var u6=o6(xx());var Id=y1();function T1(n,e,t){if(e===void 0){e={}}switch(n.type){case"text":{var i=n.data;if(t===void 0){return(e.default||Id.DEFAULT_THEME.default||Id.plain)(i)}return i}case"tag":{var s=/hljs-(\w+)/.exec(n.attribs.class);if(s){var r=s[1];var o=n.childNodes.map(function(a){return T1(a,e,r)}).join("");return(e[r]||Id.DEFAULT_THEME[r]||Id.plain)(o)}return n.childNodes.map(function(a){return T1(a,e)}).join("")}}throw new Error("Invalid node type "+n.type)}function l6(n,e){if(e===void 0){e={}}var t=a6.parseFragment(n,{treeAdapter:u6.default});return t.childNodes.map(function(i){return T1(i,e)}).join("")}function nw(n,e){if(e===void 0){e={}}var t;if(e.language){t=Md.highlight(n,{language:e.language,ignoreIllegals:e.ignoreIllegals}).value}else{t=Md.highlightAuto(n,e.languageSubset).value}return l6(t,e.theme)}Xe.highlight=nw;function d6(){return Md.listLanguages()}Xe.listLanguages=d6;function c6(n){return!!Md.getLanguage(n)}Xe.supportsLanguage=c6;Xe.default=nw;r6(y1(),Xe)});import{spawn as dj}from"node:child_process";import{existsSync as cj,statSync as hj}from"node:fs";import{homedir as pj}from"node:os";import mj from"node:path";import{performance as On}from"node:perf_hooks";function Tm(){return{async:false,breaks:false,extensions:null,gfm:true,hooks:null,pedantic:false,renderer:null,silent:false,tokenizer:null,walkTokens:null}}var bs=Tm();function Rb(n){bs=n}var ys={exec:()=>null};function rr(n){let e=[];return t=>{let i=Math.max(0,Math.min(3,t-1)),s=e[i];return s||(s=n(i),e[i]=s),s}}function le(n,e=""){let t=typeof n=="string"?n:n.source,i={replace:(s,r)=>{let o=typeof r=="string"?r:r.source;return o=o.replace(vt.caret,"$1"),t=t.replace(s,o),i},getRegex:()=>new RegExp(t,e)};return i}var E9=((n="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+n)}catch{return false}})();var vt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:rr(n=>new RegExp(`^ {0,${n}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:rr(n=>new RegExp(`^ {0,${n}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:rr(n=>new RegExp(`^ {0,${n}}(?:\`\`\`|~~~)`)),headingBeginRegex:rr(n=>new RegExp(`^ {0,${n}}#`)),htmlBeginRegex:rr(n=>new RegExp(`^ {0,${n}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:rr(n=>new RegExp(`^ {0,${n}}>`))};var A9=/^(?:[ \t]*(?:\n|$))+/;var R9=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;var k9=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;var jo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;var P9=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;var bm=/ {0,3}(?:[*+-]|\d{1,9}[.)])/;var kb=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;var Pb=le(kb).replace(/bull/g,bm).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex();var _9=le(kb).replace(/bull/g,bm).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();var vm=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;var L9=/^[^\n]+/;var Sm=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;var O9=le(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Sm).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();var D9=le(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,bm).getRegex();var ju="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";var Cm=/<!--(?:-?>|[\s\S]*?(?:-->|$))/;var N9=le("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Cm).replace("tag",ju).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();var _b=n=>le(vm).replace("hr",jo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",n).replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ju).getRegex();var F9=_b(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);var $9=_b(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);var B9=le(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",$9).getRegex();var xm={blockquote:B9,code:R9,def:O9,fences:k9,heading:P9,hr:jo,html:N9,lheading:Pb,list:D9,newline:A9,paragraph:F9,table:ys,text:L9};var Cb=le("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",jo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ju).getRegex();var q9={...xm,lheading:_9,table:Cb,paragraph:le(vm).replace("hr",jo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Cb).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ju).getRegex()};var H9={...xm,html:le(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Cm).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:ys,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:le(vm).replace("hr",jo).replace("heading",` *#{1,6} *[^
|
|
3
3
|
]`).replace("lheading",Pb).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()};var U9=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;var K9=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;var Lb=/^( {2,}|\\)\n(?!\s*$)/;var W9=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;var Zn=/[\p{P}\p{S}]/u;var ar=/[\s\p{P}\p{S}]/u;var Vo=/[^\s\p{P}\p{S}]/u;var j9=le(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,ar).getRegex();var V9=/[\p{Pi}\p{Ps}"']/u;var Ob=/(?!~)[\p{P}\p{S}]/u;var G9=/(?!~)[\s\p{P}\p{S}]/u;var z9=/(?:[^\s\p{P}\p{S}]|~)/u;var Q9=le(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",E9?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex();var Db=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;var Y9=le(Db,"u").replace(/punct/g,Zn).getRegex();var X9=le(Db,"u").replace(/punct/g,Ob).getRegex();var J9=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/;var Z9=le(J9,"u").replace(/openQuote/g,V9).replace(/punct/g,Zn).getRegex();var Nb="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";var e5=le(Nb,"gu").replace(/notPunctSpace/g,Vo).replace(/punctSpace/g,ar).replace(/punct/g,Zn).getRegex();var t5=le(Nb,"gu").replace(/notPunctSpace/g,z9).replace(/punctSpace/g,G9).replace(/punct/g,Ob).getRegex();var n5="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)";var i5=le(n5,"gu").replace(/notPunctSpace/g,Vo).replace(/punctSpace/g,ar).replace(/punct/g,Zn).getRegex();var s5=le("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Vo).replace(/punctSpace/g,ar).replace(/punct/g,Zn).getRegex();var r5="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)";var o5=le(r5,"gu").replace(/notPunctSpace/g,Vo).replace(/punctSpace/g,ar).replace(/punct/g,Zn).getRegex();var a5=le(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Zn).getRegex();var u5="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";var l5=le(u5,"gu").replace(/notPunctSpace/g,Vo).replace(/punctSpace/g,ar).replace(/punct/g,Zn).getRegex();var d5=le(/\\(punct)/,"gu").replace(/punct/g,Zn).getRegex();var c5=le(/^<(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();var h5=le(Cm).replace("(?:-->|$)","-->").getRegex();var p5=le("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",h5).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();var m5=/\[(?:\\[\s\S]|[^\[\]\\])*\]/;var Ku=le(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",m5).getRegex();var f5=le(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Ku).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();var Fb=le(/^!?\[(label)\]\[(ref)\]/).replace("label",Ku).replace("ref",Sm).getRegex();var $b=le(/^!?\[(ref)\](?:\[\])?/).replace("ref",Sm).getRegex();var g5=le("reflink|nolink(?!\\()","g").replace("reflink",Fb).replace("nolink",$b).getRegex();var xb=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;var wm={_backpedal:ys,anyPunctuation:d5,autolink:c5,blockSkip:Q9,br:Lb,code:K9,del:ys,delLDelim:ys,delRDelim:ys,emStrongLDelim:Y9,emStrongRDelimAst:e5,emStrongRDelimUnd:s5,escape:U9,link:f5,nolink:$b,punctuation:j9,reflink:Fb,reflinkSearch:g5,tag:p5,text:W9,url:ys};var y5={...wm,emStrongLDelim:Z9,emStrongRDelimAst:i5,emStrongRDelimUnd:o5,link:le(/^!?\[(label)\]\((.*?)\)/).replace("label",Ku).getRegex(),reflink:le(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Ku).getRegex()};var fm={...wm,emStrongRDelimAst:t5,emStrongLDelim:X9,delLDelim:a5,delRDelim:l5,url:le(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",xb).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:le(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",xb).getRegex()};var T5={...fm,br:le(Lb).replace("{2,}","*").getRegex(),text:le(fm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()};var Uu={normal:xm,gfm:q9,pedantic:H9};var Ko={normal:wm,gfm:fm,breaks:T5,pedantic:y5};var b5={"&":"&","<":"<",">":">",'"':""","'":"'"};var wb=n=>b5[n];function Ht(n,e){if(e){if(vt.escapeTest.test(n))return n.replace(vt.escapeReplace,wb)}else if(vt.escapeTestNoEncode.test(n))return n.replace(vt.escapeReplaceNoEncode,wb);return n}function Ib(n){try{n=encodeURI(n).replace(vt.percentDecode,"%")}catch{return null}return n}function Mb(n,e){let t=n.replace(vt.findPipe,(r,o,a)=>{let u=false,l=o;for(;--l>=0&&a[l]==="\\";)u=!u;return u?"|":" |"}),i=t.split(vt.splitPipe),s=0;if(i[0].trim()||i.shift(),i.length>0&&!i.at(-1)?.trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;s<i.length;s++)i[s]=i[s].trim().replace(vt.slashPipe,"|");return i}function qi(n,e,t){let i=n.length;if(i===0)return"";let s=0;for(;s<i;){let r=n.charAt(i-s-1);if(r===e&&!t)s++;else if(r!==e&&t)s++;else break}return n.slice(0,i-s)}function Eb(n){let e=n.split(`
|
|
4
4
|
`),t=e.length-1;for(;t>=0&&vt.blankLine.test(e[t]);)t--;return e.length-t<=2?n:e.slice(0,t+1).join(`
|
|
5
5
|
`)}function v5(n,e){if(n.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<n.length;i++)if(n[i]==="\\")i++;else if(n[i]===e[0])t++;else if(n[i]===e[1]&&(t--,t<0))return i;return t>0?-2:-1}function S5(n,e=0){let t=e,i="";for(let s of n)if(s===" "){let r=4-t%4;i+=" ".repeat(r),t+=r}else i+=s,t++;return i}function Ab(n,e,t,i,s){let r=e.href,o=e.title||null,a=n[1].replace(s.other.outputLinkReplace,"$1"),u=n[0].charAt(0)==="!";i.state.inLink=true;let l=i.state.linkEmitted,d=i.state.inRawBlock;i.state.linkEmitted=false;let h=i.inlineTokens(a),m=i.state.linkEmitted;if(i.state.linkEmitted=l,i.state.inLink=false,!u){if(m){i.state.inRawBlock=d;return}i.state.linkEmitted=true}return{type:u?"image":"link",raw:t,href:r,title:o,text:a,tokens:h}}function C5(n,e,t){let i=n.match(t.other.indentCodeCompensation);if(i===null)return e;let s=i[1];return e.split(`
|
|
@@ -67,7 +67,7 @@ Please report this to https://github.com/markedjs/marked.`,n){let i="<p>An error
|
|
|
67
67
|
`;if(this.queuedBytes+s.length>this.maxQueueBytes){this.droppedSinceFlush+=1;this.scheduleFlush();return}this.queue.push(s);this.queuedBytes+=s.length;this.scheduleFlush()}takeQueue(){const e=this.queue;this.queue=[];this.queuedBytes=0;if(this.droppedSinceFlush>0){const t=this.droppedSinceFlush;this.droppedSinceFlush=0;Xv.warn("trace.drop",{dropped:t});e.unshift(`${JSON.stringify({ts:this.now(),monoNs:this.monoNs(),seq:++this.seq,frameNo:0,bytes:t,kind:"drop"})}
|
|
68
68
|
`)}return e}scheduleFlush(){if(this.flushTimer)return;this.flushTimer=setTimeout(()=>{this.flushTimer=void 0;this.enqueueBatch(this.takeQueue())},this.flushIntervalMs);this.flushTimer.unref?.()}enqueueBatch(e){if(e.length===0)return;this.writeChain=this.writeChain.then(()=>this.ensureHandle()).then(async t=>{await t.write(e.join(""))}).catch(t=>{this.handle=void 0;this.opening=void 0;if(!this.writeFailureReported){this.writeFailureReported=true;Xv.warn("trace.writeFailed",{err:t})}})}ensureHandle(){if(this.handle)return Promise.resolve(this.handle);this.opening??=(async()=>{await N2($2(this.tracePath),{recursive:true});const e=await F2(this.tracePath,"a",384);this.handle=e;this.writeFailureReported=false;return e})();return this.opening}};function Jv(n=process.env){const e=n.MCODE_TUI_TRACE?.trim();if(!e)return void 0;return new of({path:e})}var H2=1e3;var Zv="\x1B]9;4;3\x07";var e0="\x1B]9;4;0\x07";var U2="\x1B[13;2u";var K2=7;var W2=150;var j2=`\x1B[>${K2}u\x1B[?u`;var V2="\x1B[c";function t0(n){const e=n.match(/^\x1b\[\?(\d+)u$/);if(e){return{type:"kitty-flags",flags:Number.parseInt(e[1],10)}}if(/^\x1b\[\?[\d;]*c$/.test(n)){return{type:"device-attributes"}}return void 0}function n0(n){return n==="\x1B["||/^\x1b\[\?[\d;]*$/.test(n)}function G2(){return process.platform==="darwin"&&process.env.TERM_PROGRAM==="Apple_Terminal"}function z2(){if(process.platform==="win32"||process.pid<=0)return;try{process.kill(process.pid,"SIGWINCH")}catch{}}function Q2(n,e,t){if(e&&n==="\r"&&t)return U2;return n}var Y2=10;var X2=100;function J2(n=process.env){const e=Number(n.PI_TUI_ESC_TIMEOUT);if(Number.isFinite(e)&&e>0){return e}if(n.SSH_CONNECTION||n.SSH_TTY){return X2}return Y2}var As=class{terminalFocused;frameTracer;constructor(){this.frameTracer=Jv()}get focused(){return this.terminalFocused}outputQueue=[];outputOffset=0;outputError;outputWaiters=[];get outputPending(){return this.outputQueue.length>0}drainOutput(){if(this.outputError)return Promise.reject(this.outputError);if(!this.outputPending)return Promise.resolve();return new Promise((e,t)=>this.outputWaiters.push({resolve:e,reject:t}))}writeOutput(e){if(this.outputError)return;this.frameTracer?.onWrite(Buffer.byteLength(e,"utf8"));if(process.platform==="win32"||!process.stdout.isTTY){process.stdout.write(e);return}if(!e)return;this.outputQueue.push(Buffer.from(e,"utf8"));if(this.outputQueue.length===1)this.writeNextOutput()}failOutput(e){this.outputError=e;this.outputQueue=[];this.outputOffset=0;for(const t of this.outputWaiters.splice(0))t.reject(e);process.stdout.emit("error",e)}writeNextOutput(){const e=this.outputQueue[0];if(!e){for(const i of this.outputWaiters.splice(0))i.resolve();return}const t=Math.min(64*1024,e.length-this.outputOffset);try{wr.write(process.stdout.fd,e,this.outputOffset,t,null,(i,s)=>{if(i){if(i.code==="EINTR"||i.code==="EAGAIN"){setTimeout(()=>this.writeNextOutput(),10);return}this.failOutput(i);return}if(s<=0){this.failOutput(Object.assign(new Error("Terminal output made no progress"),{code:"EIO"}));return}this.outputOffset+=s;if(this.outputOffset===e.length){this.outputQueue.shift();this.outputOffset=0}this.writeNextOutput()})}catch(i){this.failOutput(i instanceof Error?i:new Error(String(i)))}}wasRaw=false;inputHandler;resizeHandler;_kittyProtocolActive=false;_modifyOtherKeysActive=false;keyboardProtocolPushed=false;pendingKeyboardProtocolDeviceAttributes=0;keyboardProtocolNegotiationBuffer="";keyboardProtocolBufferFlushTimer;stdinBuffer;stdinDataHandler;progressInterval;programStatus;programStatusSupported=false;programStatusQueryPending=false;writeLogPath=(()=>{const e=process.env.PI_TUI_WRITE_LOG||"";if(!e)return"";try{if(wr.statSync(e).isDirectory()){const t=new Date;const i=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}_${String(t.getHours()).padStart(2,"0")}-${String(t.getMinutes()).padStart(2,"0")}-${String(t.getSeconds()).padStart(2,"0")}`;return i0.join(e,`tui-${i}-${process.pid}.log`)}}catch{}return e})();get kittyProtocolActive(){return this._kittyProtocolActive}get modifyOtherKeysActive(){return this._modifyOtherKeysActive}start(e,t){this.inputHandler=e;this.resizeHandler=t;this.wasRaw=process.stdin.isRaw||false;if(process.stdin.setRawMode){process.stdin.setRawMode(true)}process.stdin.setEncoding("utf8");process.stdin.resume();this.writeOutput("\x1B[?2004h");this.writeOutput("\x1B[?1004h");process.stdout.on("resize",this.resizeHandler);z2();this.enableWindowsVTInput();this.queryAndEnableKittyProtocol()}setupStdinBuffer(){this.stdinBuffer=new da({escapeTimeout:J2()});this.stdinBuffer.on("data",e=>{if(Yv(e)){if(this.programStatusQueryPending){this.programStatusQueryPending=false;this.programStatusSupported=true;this.writeProgramStatus()}return}const t=this.readKeyboardProtocolNegotiationSequence(e);if(t==="pending"){this.scheduleKeyboardProtocolNegotiationBufferFlush();return}if(t&&this.handleKeyboardProtocolNegotiationSequence(t.parsed)){return}this.forwardInputSequence(t?.sequence??e)});this.stdinBuffer.on("paste",e=>{if(this.inputHandler){this.inputHandler(`\x1B[200~${e}\x1B[201~`)}});this.stdinDataHandler=e=>{this.stdinBuffer.process(e)}}queryAndEnableKittyProtocol(){this.setupStdinBuffer();process.stdin.on("data",this.stdinDataHandler);this.keyboardProtocolPushed=true;this.pendingKeyboardProtocolDeviceAttributes+=1;this.clearKeyboardProtocolNegotiationBuffer();const e=process.env.PI_PROGRAM_STATUS;this.programStatusSupported=e==="1";this.programStatusQueryPending=e!=="1"&&e!=="0";const t=this.programStatusQueryPending?Qv:"";this.writeOutput(`${j2}${t}${V2}`);this.writeProgramStatus()}handleKeyboardProtocolNegotiationSequence(e){this.clearKeyboardProtocolNegotiationBuffer();if(e.type==="device-attributes"){if(this.pendingKeyboardProtocolDeviceAttributes===0)return false;this.pendingKeyboardProtocolDeviceAttributes-=1;if(this.pendingKeyboardProtocolDeviceAttributes===0)this.programStatusQueryPending=false}if(e.type==="kitty-flags"){if(e.flags!==0){this.disableModifyOtherKeys();if(!this._kittyProtocolActive){this._kittyProtocolActive=true;Jo(true)}}else{this.enableModifyOtherKeys()}return true}if(!this._kittyProtocolActive){this.enableModifyOtherKeys()}return true}readKeyboardProtocolNegotiationSequence(e){if(this.keyboardProtocolNegotiationBuffer){const i=this.keyboardProtocolNegotiationBuffer+e;const s=t0(i);if(s){this.clearKeyboardProtocolNegotiationBuffer();return{parsed:s,sequence:i}}if(n0(i)){this.setKeyboardProtocolNegotiationBuffer(i);return"pending"}this.flushKeyboardProtocolNegotiationBufferAsInput()}const t=t0(e);if(t)return{parsed:t,sequence:e};if(n0(e)){this.setKeyboardProtocolNegotiationBuffer(e);return"pending"}return void 0}setKeyboardProtocolNegotiationBuffer(e){this.clearKeyboardProtocolNegotiationBufferFlushTimer();this.keyboardProtocolNegotiationBuffer=e}clearKeyboardProtocolNegotiationBuffer(){this.clearKeyboardProtocolNegotiationBufferFlushTimer();this.keyboardProtocolNegotiationBuffer=""}flushKeyboardProtocolNegotiationBufferAsInput(){if(!this.keyboardProtocolNegotiationBuffer)return;const e=this.keyboardProtocolNegotiationBuffer;this.clearKeyboardProtocolNegotiationBuffer();this.forwardInputSequence(e)}scheduleKeyboardProtocolNegotiationBufferFlush(){if(!this.keyboardProtocolNegotiationBuffer||this.keyboardProtocolBufferFlushTimer)return;this.keyboardProtocolBufferFlushTimer=setTimeout(()=>{this.keyboardProtocolBufferFlushTimer=void 0;this.flushKeyboardProtocolNegotiationBufferAsInput()},W2)}clearKeyboardProtocolNegotiationBufferFlushTimer(){if(!this.keyboardProtocolBufferFlushTimer)return;clearTimeout(this.keyboardProtocolBufferFlushTimer);this.keyboardProtocolBufferFlushTimer=void 0}forwardInputSequence(e){if(e==="\x1B[I"||e==="\x1B[O"){this.terminalFocused=e==="\x1B[I";this.inputHandler?.(e);return}if(!this.inputHandler)return;const t=e==="\r"&&(G2()||process.platform==="win32");const i=Q2(e,t,t&&zv("shift"));this.inputHandler(i)}enableModifyOtherKeys(){if(this._kittyProtocolActive||this._modifyOtherKeysActive)return;this.writeOutput("\x1B[>4;2m");this._modifyOtherKeysActive=true}disableModifyOtherKeys(){if(!this._modifyOtherKeysActive)return;this.writeOutput("\x1B[>4;0m");this._modifyOtherKeysActive=false}enableWindowsVTInput(){if(process.platform!=="win32")return;try{Tl()?.enableVirtualTerminalInput?.()}catch{}}async drainInput(e=1e3,t=50){const i=this.keyboardProtocolPushed||this._kittyProtocolActive;this.clearKeyboardProtocolNegotiationBuffer();if(i){this.writeOutput("\x1B[<u");this.keyboardProtocolPushed=false;this._kittyProtocolActive=false;Jo(false)}this.disableModifyOtherKeys();const s=this.inputHandler;this.inputHandler=void 0;let r=Date.now();const o=()=>{r=Date.now()};process.stdin.on("data",o);try{await this.drainOutput();r=Date.now();const a=Date.now()+e;while(true){const u=Date.now();const l=a-u;if(l<=0)break;if(u-r>=t)break;await new Promise(d=>setTimeout(d,Math.min(t,l)))}}finally{process.stdin.removeListener("data",o);this.inputHandler=s}}stop(){this.writeOutput("\x1B[?1004l");this.terminalFocused=void 0;if(this.clearProgressInterval()){this.writeOutput(e0)}if(this.programStatusSupported&&this.programStatus){this.writeOutput(bl({state:"clear"}))}this.programStatusSupported=false;this.programStatusQueryPending=false;this.writeOutput("\x1B[?2004l");const e=this.keyboardProtocolPushed||this._kittyProtocolActive;this.clearKeyboardProtocolNegotiationBuffer();if(e){this.writeOutput("\x1B[<u");this.keyboardProtocolPushed=false;this._kittyProtocolActive=false;Jo(false)}this.disableModifyOtherKeys();if(this.stdinBuffer){this.stdinBuffer.destroy();this.stdinBuffer=void 0}if(this.stdinDataHandler){process.stdin.removeListener("data",this.stdinDataHandler);this.stdinDataHandler=void 0}this.inputHandler=void 0;if(this.resizeHandler){process.stdout.removeListener("resize",this.resizeHandler);this.resizeHandler=void 0}process.stdin.pause();if(process.stdin.setRawMode){process.stdin.setRawMode(this.wasRaw)}void this.frameTracer?.close().catch(()=>void 0)}write(e){this.writeOutput(e);if(this.writeLogPath){try{wr.appendFileSync(this.writeLogPath,e,{encoding:"utf8"})}catch{}}}traceFrameBegin(){this.frameTracer?.beginFrame()}traceFrameEnd(){this.frameTracer?.endFrame()}get columns(){return process.stdout.columns||Number(process.env.COLUMNS)||80}get rows(){return process.stdout.rows||Number(process.env.LINES)||24}moveBy(e){if(e>0){this.writeOutput(`\x1B[${e}B`)}else if(e<0){this.writeOutput(`\x1B[${-e}A`)}}hideCursor(){this.writeOutput("\x1B[?25l")}showCursor(){this.writeOutput("\x1B[?25h")}clearLine(){this.writeOutput("\x1B[K")}clearFromCursor(){this.writeOutput("\x1B[J")}clearScreen(){this.writeOutput("\x1B[2J\x1B[H")}setTitle(e){this.writeOutput(`\x1B]0;${e}\x07`)}setProgramStatus(e){this.programStatus=e.state==="clear"?void 0:e;if(this.programStatusSupported)this.writeOutput(bl(e))}writeProgramStatus(){if(this.programStatusSupported&&this.programStatus){this.writeOutput(bl(this.programStatus))}}setProgress(e){if(e){this.writeOutput(Zv);if(!this.progressInterval){this.progressInterval=setInterval(()=>{this.writeOutput(Zv)},H2)}}else{this.clearProgressInterval();this.writeOutput(e0)}}clearProgressInterval(){if(!this.progressInterval)return false;clearInterval(this.progressInterval);this.progressInterval=void 0;return true}};var Z2=ni();var e4=/^[\x20-\x7e]*$/;function t4(n){const e=[];const t=[];let i=0;let s=false;const r=()=>{if(!s)return;e.push(" ");i+=1;s=false};for(let o=0;o<n.length;o++){const a=oe(n[o]??"");let u=0;if(e4.test(a)){let l=0;while(l<a.length){if(a.charCodeAt(l)===32){if(i>0)s=true;u+=1;l+=1;continue}let d=l+1;while(d<a.length&&a.charCodeAt(d)!==32)d+=1;r();const h=a.slice(l,d);e.push(h);t.push({textStart:i,textEnd:i+h.length,row:o,startCol:u,endCol:u+h.length,linearColumns:true});i+=h.length;u+=h.length;l=d}}else{for(const l of Z2.segment(a)){const d=l.segment;const h=w(d);if(/^\s+$/u.test(d)){if(i>0)s=true;u+=h;continue}r();e.push(d);t.push({textStart:i,textEnd:i+d.length,row:o,startCol:u,endCol:u+h,linearColumns:false});i+=d.length;u+=h}}if(i>0)s=true}return{text:e.join(""),spans:t}}function n4(n){return n.replace(/\s+/gu," ").trim()}function i4(n){return n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function s4(n,e){if(!e)return[];const t=new RegExp(i4(e),"giu");const i=[];let s=0;for(const r of n.text.matchAll(t)){const o=r.index;const a=o+r[0].length;while(s<n.spans.length&&n.spans[s].textEnd<=o)s+=1;const u=[];for(let l=s;l<n.spans.length;l++){const d=n.spans[l];if(d.textStart>=a)break;if(d.textEnd<=o)continue;const h=d.linearColumns?d.startCol+Math.max(o,d.textStart)-d.textStart:d.startCol;const m=d.linearColumns?d.startCol+Math.min(a,d.textEnd)-d.textStart:d.endCol;const f=u[u.length-1];if(f&&f.row===d.row&&h<=f.endCol){f.endCol=Math.max(f.endCol,m)}else{u.push({row:d.row,startCol:h,endCol:m})}}while(s<n.spans.length&&n.spans[s].textEnd<=a)s+=1;if(u.length>0)i.push({segments:u})}return i}var vl=class{sourceLines;corpus;normalizedQuery;matches=[];search(e,t){let i=this.sourceLines?.length!==e.length;if(!i&&this.sourceLines){for(let o=0;o<e.length;o++){if(this.sourceLines[o]===e[o])continue;i=true;break}}if(i||!this.corpus){this.sourceLines=Array.from(e);this.corpus=t4(e)}const s=n4(t);const r=i||s!==this.normalizedQuery;if(r){this.normalizedQuery=s;this.matches=s4(this.corpus,s)}return{matches:this.matches,changed:r}}};function af(n){const e=n.segments[0];const t=n.segments[n.segments.length-1];return e&&t?`${e.row}:${e.startCol}:${t.row}:${t.endCol}`:""}var Sl=class{input=new Ke({prompt:" ",placeholder:"Find in transcript",placeholderStyle:e=>`\x1B[2m${e}\x1B[22m`});onQueryChange;navigationButtonStyle;resultCount=0;resultIndex=-1;previousButtonStart=-1;previousButtonEnd=-1;nextButtonStart=-1;nextButtonEnd=-1;hoveredNavigationDirection;_focused=false;constructor(e,t=i=>i){this.onQueryChange=e;this.navigationButtonStyle=t}get focused(){return this._focused}set focused(e){this._focused=e;this.input.focused=e}setResult(e,t){this.resultIndex=e;this.resultCount=t}getNavigationDirectionAt(e,t){if(e!==2)return void 0;if(t>=this.previousButtonStart&&t<this.previousButtonEnd)return-1;if(t>=this.nextButtonStart&&t<this.nextButtonEnd)return 1;return void 0}setHoveredNavigationDirection(e){if(e===this.hoveredNavigationDirection)return false;this.hoveredNavigationDirection=e;return true}handleInput(e){const t=this.input.getValue();this.input.handleInput(e);const i=this.input.getValue();if(i!==t)this.onQueryChange(i)}invalidate(){this.input.invalidate()}render(e){const t=Math.max(1,e);const i=Math.max(0,t-2);const s=ve=>ve?ve.split("+").map(Me=>{if(process.platform==="darwin"&&Me.toLowerCase()==="alt")return"Option";return Me.charAt(0).toUpperCase()+Me.slice(1)}).join("+"):"Unbound";const r=te();const o=s(r.getKeys("tui.altScreen.searchPrevious")[0]);const a=s(r.getKeys("tui.altScreen.searchNext")[0]);const u=this.input.getValue();const l=!u?"":this.resultCount===0?"No matches":`${this.resultIndex+1}/${this.resultCount}`;const d=Math.max(0,i-3);const h=E(l,d,"");const m=h?`\x1B[2m ${h} \x1B[22m`:"";const f=Math.max(0,i-w(m));const y=E(this.input.render(Math.max(1,f))[0]??"",f,"");const T=" ".repeat(Math.max(0,f-w(y)));const b=`${y}${T}${m}`;let v=`\u2191 ${o}`;let C=`\u2193 ${a}`;let I=" \xB7 ";const R=1;const L=Math.max(0,i-R*2-1);let _=w(v)+w(I)+w(C);if(_>L){v="\u2191";C="\u2193";I=" ";_=w(v)+w(I)+w(C)}const D=_<=L;const k=D?this.navigationButtonStyle(v,this.hoveredNavigationDirection===-1)+I+this.navigationButtonStyle(C,this.hoveredNavigationDirection===1):"";const K=D?R*2:0;const j=k&&i>_+K?1:0;const B=Math.max(0,i-(D?_:0)-K-j);const V=1+B+R;this.previousButtonStart=D?V:-1;this.previousButtonEnd=D?V+w(v):-1;this.nextButtonStart=D?this.previousButtonEnd+w(I):-1;this.nextButtonEnd=D?this.nextButtonStart+w(C):-1;if(t===1)return["\u250C","\u2502","\u2514"];return[`\u250C${"\u2500".repeat(i)}\u2510`,`\u2502${b}\u2502`,`\u2514${"\u2500".repeat(B)}${k?" ":""}${k}${k?" ":""}${"\u2500".repeat(j)}\u2518`]}};var r4=1e3;var Cl=class{entries=[];nextId=0;requestRender;constructor(e){this.requestRender=e}flash(e,t=r4){const i=this.nextId++;const s=setTimeout(()=>{const r=this.entries.findIndex(o=>o.id===i);if(r===-1)return;this.entries.splice(r,1);this.requestRender()},Math.max(0,t));s.unref();this.entries.push({id:i,message:e,timer:s});this.requestRender()}dispose(){for(const e of this.entries)clearTimeout(e.timer);this.entries.length=0}invalidate(){}render(e){return this.entries.map(t=>{const i=E(` ${t.message} `,e,"");return`\x1B[7m${i}\x1B[27m`})}};var o4=/^(?:\x1b\]133;[ABC](?:\x07|\x1b\\))+/;function ca(n,e){const t=Math.max(n.x,e.x);const i=Math.max(n.y,e.y);const s=Math.min(n.x+n.width,e.x+e.width);const r=Math.min(n.y+n.height,e.y+e.height);return{x:t,y:i,width:Math.max(0,s-t),height:Math.max(0,r-i)}}function wl(n,e,t){const i=Math.max(1,Math.floor(t));let s=n.renderCache.get(e);if(!s){s=new Map;n.renderCache.set(e,s)}let r=s.get(i);if(!r){r=e.render(i);s.set(i,r)}return r}function s0(n,e,t){return wl(n,e,t).length}function a4(n,e,t){return wl(n,e,t).reduce((i,s)=>Math.max(i,w(s)),0)}function r0(n,e){n.parent=e;return n}function o0(n,e){n.rect.y+=e;for(const t of n.children)o0(t,e)}function a0(n,e){n.clip=ca(e,n.rect);for(const t of n.children)a0(t,n.clip)}function xl(n,e,t,i,s,r,o){const a=Math.max(1,Math.floor(s));const u=Un(e);if(!u){const C=wl(n,e,a);const I=r===void 0?C.length:Math.max(0,Math.floor(r));let R=0;if(C.length>I&&I>0){const L=C.findIndex(_=>_.includes(Kt));if(L>=I)R=L-I+1}return{component:e,rect:{x:t,y:i,width:a,height:I},clip:ca(o,{x:t,y:i,width:a,height:I}),children:[],lines:C,lineOffset:R,layer:0}}if(u.type==="scroll"){const C=u.state.scrollTop;const I=u.state.getContentWidth(a);const R=xl(n,u.component,t,i-C,I,void 0,o);const L=R.rect.height;const _=r===void 0?L:Math.max(0,Math.floor(r));u.state.updateLayout(L,_,n.requestRender);o0(R,C-u.state.scrollTop);const D=u.state;if(u.state.primary||!n.primaryScrollView)n.primaryScrollView=D;const k={x:t,y:i,width:a,height:_};const K=ca(o,k);const j={component:e,rect:k,clip:K,children:[R],scrollView:D,scrollContentLines:wl(n,u.component,I),layer:0};R.parent=j;a0(R,K);return j}const l=oa(u.entries,n.viewport);const d=Math.max(0,l.length-1)*u.gap;if(u.type==="vstack"){const C=l.map(K=>typeof K.basis==="number"?K.basis:s0(n,K.component,a));const I=vr(l,C,r,u.gap);const R=I.reduce((K,j)=>K+j,0)+d;const L=r===void 0?R:Math.max(0,Math.floor(r));const _={x:t,y:i,width:a,height:L};const D={component:e,rect:_,clip:ca(o,_),children:[],layer:0};let k=i;for(let K=0;K<l.length;K++){D.children.push(r0(xl(n,l[K].component,t,k,a,I[K],D.clip),D));k+=I[K]+u.gap}return D}const h=l.map(C=>typeof C.basis==="number"?C.basis:a4(n,C.component,a));const m=vr(l,h,a,u.gap);const f=l.map((C,I)=>s0(n,C.component,Math.max(1,m[I])));const y=r===void 0?f.reduce((C,I)=>Math.max(C,I),0):Math.max(0,r);const T={x:t,y:i,width:a,height:y};const b={component:e,rect:T,clip:ca(o,T),children:[],layer:0};let v=t;for(let C=0;C<l.length;C++){const I=f[C];const R=u.align==="stretch"?y:Math.min(y,I);let L=i;if(u.align==="center")L+=Math.floor((y-R)/2);else if(u.align==="end")L+=y-R;const _=m[C];if(_===0){b.children.push({component:l[C].component,rect:{x:v,y:L,width:0,height:R},clip:{x:v,y:L,width:0,height:0},children:[],parent:b,layer:0})}else{b.children.push(r0(xl(n,l[C].component,v,L,_,R,b.clip),b))}v+=_+u.gap}return b}function u4(n,e,t,i,s){if(Le(n))return n;const r=zo(n,e);const o=r?.start??e;const a=r?.end??e+1;const u=xe(n,0,o,true);const l=xe(n,o,a-o,true);const d=xe(n,a,Math.max(0,t-a),true);let h="";let m=0;while(m<l.length){const v=Re(l,m);if(!v)break;h+=v.code;m+=v.length}const f=" ".repeat(Math.max(0,o-w(u)));const y=" ".repeat(Math.max(0,e-o));const T=" ".repeat(Math.max(0,a-e-1));const b=`\x1B[0m\x1B]8;;\x07${s?Jb(h):""}`;return`${u}${f}${b}${y}${i}${T}${d}`}function Ir(n,e=false){if(!n.scrollView||n.rect.width<=0||n.rect.height<=0)return void 0;const t=n.children[0]?.rect.height??n.scrollContentLines?.length??0;const i=n.rect.height;const s=e&&n.scrollView.scrollbar==="auto"&&t>i;if(!n.scrollView.isScrollbarVisible&&!s)return void 0;const r=Math.min(2,i);const o=Math.max(r,Math.min(i,Math.round(i*i/t)));const a=Math.max(0,t-i);const u=i-o;const l=a===0?0:Math.round(n.scrollView.scrollTop/a*u);const d=n.rect.x+n.rect.width-1;if(d<n.clip.x||d>=n.clip.x+n.clip.width)return void 0;return{column:d,trackTop:n.rect.y,trackHeight:i,thumbTop:n.rect.y+l,thumbHeight:o,maxScrollTop:a}}function l4(n,e,t){const i=Ir(n);if(!i||!n.scrollView)return;for(let s=0;s<i.trackHeight;s++){const r=i.trackTop+s;if(r<n.clip.y||r>=n.clip.y+n.clip.height||r<0||r>=e.length)continue;const o=r>=i.thumbTop&&r<i.thumbTop+i.thumbHeight;const a=o?n.scrollView.scrollbarThumbStyle(n.scrollView.isScrollbarActive?"\u2588":"\u2503"):n.scrollView.scrollbarTrackStyle("\u2502");e[r]=u4(e[r]??"",i.column,t,a,n.scrollView.scrollbar!=="always")}}function u0(n,e,t){if(n.lines){const i=n.lineOffset??0;const s=Math.max(n.rect.y,n.clip.y,0);const r=Math.min(n.rect.y+n.rect.height,n.clip.y+n.clip.height,e.length);for(let o=s;o<r;o++){const a=n.lines[i+o-n.rect.y];if(a===void 0)continue;let u=a.replace(o4,"");const l=ul(u);if(l){const d=Math.min(e.length,n.clip.y+n.clip.height);const h=Math.min(l.rows,d-o);if(h<l.rows)u=Hm(u,0,h)}if(n.rect.x===0&&n.rect.width>=t&&(Le(u)||!e[o])){e[o]=u}else{e[o]=Wi(e[o]??"",u,n.rect.x,n.rect.width,t)}}}for(const i of n.children)u0(i,e,t);if(n.scrollView&&n.scrollContentLines&&n.scrollView.scrollTop>0&&n.rect.height>0){for(let i=n.scrollView.scrollTop-1;i>=0;i--){const s=n.scrollContentLines[i]??"";const r=ul(s);if(r){const o=n.scrollView.scrollTop-i;if(o<r.rows){const a=Math.min(n.rect.height,r.rows-o);const u=Hm(s,o,a);if(n.rect.x===0&&n.rect.width>=t)e[n.rect.y]=u}break}if(s!=="")break}}l4(n,e,t)}function Mr(n,e,t,i){const s=Math.max(1,Math.floor(e));const r=Math.max(1,Math.floor(t));const o={viewport:{width:s,height:r},renderCache:new Map,requestRender:i,primaryScrollView:void 0};const a=xl(o,n,0,0,s,r,{x:0,y:0,width:s,height:r});const u=Array.from({length:r},()=>"");u0(a,u,s);return{root:a,width:s,height:r,lines:u,...o.primaryScrollView===void 0?{}:{primaryScrollView:o.primaryScrollView}}}function uf(n,e,t){return e>=n.x&&e<n.x+n.width&&t>=n.y&&t<n.y+n.height}function l0(n,e,t){const i=[];const s=(r,o)=>{if(!uf(r.clip,e,t))return;i.push({box:r,depth:o});for(const a of r.children)s(a,o+1)};s(n.root,0);i.sort((r,o)=>o.box.layer-r.box.layer||o.depth-r.depth);return i.map(({box:r})=>r)}function dn(n,e){const t=i=>{if(i.scrollView===e)return i;for(const s of i.children){const r=t(s);if(r)return r}return void 0};return t(n.root)}function Il(n,e,t){const i=[];const s=(r,o)=>{if(!uf(r.clip,e,t))return;if(r.scrollView&&uf(r.rect,e,t))i.push({scrollView:r.scrollView,depth:o});for(const a of r.children)s(a,o+1)};s(n.root,0);i.sort((r,o)=>o.depth-r.depth);return i.map(r=>r.scrollView)}var d4=5;var c4=200;var h4=100;var p4=6;function m4(){const n=process.env;return process.platform==="darwin"&&n.SSH_CONNECTION===void 0&&n.SSH_CLIENT===void 0&&n.SSH_TTY===void 0}var Ml=class{lines;accelerate;lastTime=Number.NEGATIVE_INFINITY;lastDirection=0;averageGap;carry=0;constructor(e="auto",t=!m4()){this.lines=e;this.accelerate=t}setLines(e){this.lines=e;this.reset()}next(e,t){if(this.lines!=="auto")return Number.isFinite(this.lines)?Math.max(1,Math.floor(this.lines)):1;if(!this.accelerate)return 1;const i=t-this.lastTime;const s=e===this.lastDirection&&i<=c4;this.lastTime=t;this.lastDirection=e;if(!s){this.averageGap=void 0;this.carry=0;return 1}if(i<d4)return 1;this.averageGap=this.averageGap===void 0?i:(this.averageGap+i)/2;const r=Math.min(p4,Math.max(1,h4/this.averageGap))+this.carry;const o=Math.floor(r);this.carry=r-o;return o}reset(){this.lastTime=Number.NEGATIVE_INFINITY;this.lastDirection=0;this.averageGap=void 0;this.carry=0}};var f4="\x1B[?1049h";var d0="\x1B[?1049l";var c0="\x1B[?7l";var h0="\x1B[?7h";var g4="\x1B[?1000h\x1B[?1002h\x1B[?1004h\x1B[?1006h";var y4="\x1B[?1000h\x1B[?1002h\x1B[?1003h\x1B[?1004h\x1B[?1006h";var T4="\x1B[?1006l\x1B[?1004l\x1B[?1003l\x1B[?1002l\x1B[?1000l";var b4="\x1B[I";var v4="\x1B[O";var El="\x1B[?2026h";var Al="\x1B[?2026l";var p0=/^(?:\x1b\]133;[ABC](?:\x07|\x1b\\))+/;var S4=/^\x1b\]133;A(?:\x07|\x1b\\)/;var m0=4;var C4=5;var x4=16;var w4=32*1024*1024;var I4=64*1024*1024;var f0=500;var M4=5e3;var E4=new Set(["/","-"]);var A4=Ki();var ha=class extends yr{mode="fullscreen";[Vm]=true;previousScreen=[];lastDocument=[];previousScreenWidth=0;previousScreenHeight=0;layoutRoot;currentLayout;implicitDocument;implicitScrollView;flashes;altScreenActive=false;imageProtocol=null;savedCapabilities;uploadedKittyImages=new Map;selectionAnchor;selectionFocus;selectionGranularity="character";selectionInitialRange;lastClick;selectionDragPointer;selectionAutoScrollDirection=0;selectionAutoScrollTimer;selectionPressActive=false;scrollbarDrag;scrollbarHover;scrollToEndIndicatorRect;activeSearch;pressedUrl;selectionDragged=false;mouseCapture;mousePressTarget;mousePressPoint;mousePressMoved=false;lastComponentClick;wheelScroll;mouseEnabled;searchMatchStyle;searchCurrentMatchStyle;searchNavigationButtonStyle;scrollToEndIndicator;openUrl;onRightClickPaste;copyOnSelect;copySelection;constructor(e,t,i,s={}){super(e,t,i);this.implicitDocument={render:r=>super.render(r),handleMouse:r=>super.handleMouse(r),invalidate:()=>{for(const r of this.children)r.invalidate()}};this.implicitScrollView=new ii(this.implicitDocument,{follow:"end",primary:true});this.flashes=new Cl(()=>this.requestRender());this.wheelScroll=new Ml(s.wheelScrollLines??1);this.mouseEnabled=s.mouse??true;this.searchMatchStyle=s.searchMatchStyle??(r=>`\x1B[4m${r}\x1B[24m`);this.searchCurrentMatchStyle=s.searchCurrentMatchStyle??(r=>`\x1B[1;7m${r}\x1B[22;27m`);this.searchNavigationButtonStyle=s.searchNavigationButtonStyle??(r=>r);this.scrollToEndIndicator=s.scrollToEndIndicator;this.openUrl=s.openUrl;this.onRightClickPaste=s.onRightClickPaste;this.copyOnSelect=s.copyOnSelect??true;this.copySelection=s.copySelection;this.addInputListener(r=>this.handleViewportInput(r))}get viewportTop(){return this.getPrimaryScrollView().scrollTop}get isFollowingOutput(){return this.getPrimaryScrollView().isFollowingEnd}setWheelScrollLines(e){this.wheelScroll.setLines(e)}getCopyOnSelect(){return this.copyOnSelect}setCopyOnSelect(e){this.copyOnSelect=e}hasActiveSelection(){return this.getActiveSelectionText()!==void 0}async copyActiveSelectionToClipboard(){const e=this.getActiveSelectionText();if(!e)return false;return this.copyTextToClipboard(e)}resetTextSelection(){this.clearTextSelection();this.lastClick=void 0}getScreenLines(){return[...this.previousScreen]}setLayoutRoot(e){if(this.layoutRoot===e)return;this.layoutRoot=e;this.currentLayout=void 0;this.requestRender()}render(e){return this.layoutRoot?.render(e)??super.render(e)}getMountedRoots(){return this.layoutRoot?[this.layoutRoot]:this.children}getPrimaryScrollView(){return this.currentLayout?.primaryScrollView??this.implicitScrollView}beforeTerminalStart(){this.stopSelectionAutoScroll();this.selectionPressActive=false;this.stopScrollbarHover();this.stopScrollbarDrag();this.flashes.dispose();this.altScreenActive=true;const e=At();this.imageProtocol=e.images;this.uploadedKittyImages.clear();if(e.images==="iterm2"){this.savedCapabilities=e;ol({...e,images:null});this.invalidate()}this.lastDocument=[];this.selectionAnchor=void 0;this.selectionFocus=void 0;this.selectionGranularity="character";this.selectionInitialRange=void 0;this.lastClick=void 0;this.pressedUrl=void 0;this.selectionDragged=false;this.clearComponentMouseGesture();this.lastComponentClick=void 0;this.resetRenderState();const t=process.env.TERM?.toLowerCase()??"";const i=process.env.TMUX!==void 0||process.env.ZELLIJ!==void 0||process.env.STY!==void 0||t.startsWith("tmux")||t.startsWith("screen")?g4:y4;this.terminal.write(`${f4}${c0}${this.mouseEnabled?i:""}\x1B[2J\x1B[H\x1B[?25l`)}beforeTerminalStop(e){this.closeSearch();this.stopSelectionAutoScroll();this.selectionPressActive=false;this.stopScrollbarHover();this.stopScrollbarDrag();this.clearComponentMouseGesture();this.flashes.dispose();if(!this.altScreenActive)return;this.terminal.write(`${El}${this.deleteKittyImages()}${this.mouseEnabled?T4:""}${h0}${Al}`);this.uploadedKittyImages.clear()}afterTerminalStop(e){if(!this.altScreenActive)return;this.altScreenActive=false;if(e.preserveScreen){this.terminal.write(`${El}${d0}\x1B[?25h${Al}`)}else{const t=Math.max(1,this.terminal.columns);const i=this.resolveFakeCursors(this.render(t)).map(r=>r.replace(p0,""));this.lastDocument=this.applyLineResets(i.map(r=>r.replaceAll(Kt,""))).map(r=>Le(r)||w(r)<=t?r:xe(r,0,t,true));let s=`${El}${d0}${c0}`;for(let r=0;r<this.lastDocument.length;r++){if(r>0)s+="\r\n";s+=`\r\x1B[2K${this.lastDocument[r]??""}`}s+=`\x1B[0m${h0}\r
|
|
69
69
|
\x1B[?25h${Al}`;this.terminal.write(s)}if(this.savedCapabilities){ol(this.savedCapabilities);this.savedCapabilities=void 0}}deleteKittyImages(){return this.imageProtocol==="kitty"?$m():""}prepareKittyScreen(e){const t=new Set;const i=e.map(u=>{const l=Tv(u);if(!l)return u;t.add(l.imageId);const d=this.uploadedKittyImages.get(l.imageId);const h={transmissionGeneration:l.transmissionGeneration,transmissionBytes:l.transmissionBytes,estimatedDecodedBytes:l.estimatedDecodedBytes};if(d)this.uploadedKittyImages.delete(l.imageId);this.uploadedKittyImages.set(l.imageId,h);return d?.transmissionGeneration===l.transmissionGeneration?l.replacementLine:u});let s=0;let r=0;let o=0;for(const[u,l]of this.uploadedKittyImages){if(t.has(u))continue;s+=1;r+=l.transmissionBytes;o+=l.estimatedDecodedBytes}let a="";for(const[u,l]of this.uploadedKittyImages){if(s<=x4&&r<=w4&&o<=I4){break}if(t.has(u))continue;a+=Zo(u);this.uploadedKittyImages.delete(u);s-=1;r-=l.transmissionBytes;o-=l.estimatedDecodedBytes}return{lines:i,evictedImageDeletion:a}}resetRenderState(){this.previousScreen=[];this.previousScreenWidth=0;this.previousScreenHeight=0;this.currentLayout=void 0}scrollBy(e){this.getPrimaryScrollView().scrollBy(e);this.requestRender()}scrollToTop(){this.getPrimaryScrollView().scrollToStart();this.requestRender()}scrollToBottom(){this.getPrimaryScrollView().scrollToEnd();this.requestRender()}scrollToPrompt(e){if(!this.currentLayout)return;const t=this.getPrimaryScrollView();const i=dn(this.currentLayout,t)?.scrollContentLines;if(!i)return;for(let s=t.scrollTop+e;s>=0&&s<i.length;s+=e){if(!S4.test(i[s]??""))continue;t.scrollTo(s);this.requestRender();return}}toggleSearch(){if(this.activeSearch){this.closeSearch();return}const e=new Sl(i=>this.updateSearchQuery(i),this.searchNavigationButtonStyle);const t={component:e,index:new vl,query:"",matches:[],selectedIndex:-1,anchorRow:this.getPrimaryScrollView().scrollTop,selectionMode:"query"};this.activeSearch=t;t.overlay=this.showOverlay(e,{anchor:"top-right",width:"40%",minWidth:32,margin:1})}closeSearch(){const e=this.activeSearch;if(!e)return;this.activeSearch=void 0;e.overlay?.hide();this.requestRender()}updateSearchQuery(e){const t=this.activeSearch;if(!t||e===t.query)return;const i=t.matches[t.selectedIndex];t.anchorRow=i?.segments[0]?.row??this.getPrimaryScrollView().scrollTop;t.query=e;t.selectionMode="query";t.component.setResult(-1,0);this.requestRender()}navigateSearch(e){const t=this.activeSearch;if(!t?.query)return;t.selectionMode=e<0?"previous":"next";this.requestRender()}getSearchNavigationDirectionAt(e,t){const i=this.activeSearch;const s=i?.overlay?.getBounds();if(!i||!s)return void 0;if(e<s.col||e>=s.col+s.width||t<s.row||t>=s.row+s.height){return void 0}return i.component.getNavigationDirectionAt(t-s.row,e-s.col)}handleSearchMouseEvent(e){const t=this.activeSearch;if(!t)return false;const i=this.getSearchNavigationDirectionAt(e.x,e.y);if(t.component.setHoveredNavigationDirection(i))this.requestRender();if(i===void 0||e.release||(e.button&32)!==0||(e.button&3)!==0){return false}this.navigateSearch(i);return true}refreshSearch(e){const t=this.activeSearch;if(!t)return false;const i=e.primaryScrollView??this.implicitScrollView;const s=dn(e,i);const r=s?.scrollContentLines;if(!r||!t.query.trim()){t.matches=[];t.selectedIndex=-1;t.selectedKey=void 0;t.selectionMode="retain";t.component.setResult(-1,0);return false}const o=t.selectionMode!=="retain";const a=t.index.search(r,t.query);const u=a.matches;t.matches=u;if(!a.changed&&t.selectionMode==="retain")return false;const l=a.changed?t.selectedKey?u.findIndex(v=>af(v)===t.selectedKey):-1:t.selectedIndex;let d=-1;if(u.length>0){if(t.selectionMode==="query"){let v=0;let C=u.length;while(v<C){const I=v+Math.floor((C-v)/2);if((u[I].segments[0]?.row??0)<t.anchorRow)v=I+1;else C=I}d=v<u.length?v:0}else if(t.selectionMode==="next"){const v=l>=0?l:Math.min(t.selectedIndex,u.length-1);d=v<0?0:(v+1)%u.length}else if(t.selectionMode==="previous"){const v=l>=0?l:Math.min(t.selectedIndex,u.length-1);d=v<0?u.length-1:(v-1+u.length)%u.length}else{d=l>=0?l:Math.min(Math.max(0,t.selectedIndex),u.length-1)}}t.selectedIndex=d;t.selectedKey=d>=0?af(u[d]):void 0;t.selectionMode="retain";t.component.setResult(d,u.length);if(!o)return false;const h=u[d];const m=h?.segments[0];const f=h?.segments[h.segments.length-1];if(!s||!m||!f||i.viewportHeight<=0)return false;const y=i.scrollTop;const T=y+i.viewportHeight-1;let b=y;if(m.row<y||f.row>T){b=m.row-Math.floor(i.viewportHeight/3)}i.scrollTo(b,{disableFollow:true});return i.scrollTop!==y}flash(e,t){this.flashes.flash(e,t)}shouldDeferViewportInputToOverlay(){return this.isOverlayFocused()&&this.activeSearch?.overlay?.isFocused()!==true}clearComponentMouseGesture(){this.mouseCapture=void 0;this.mousePressTarget=void 0;this.mousePressPoint=void 0;this.mousePressMoved=false}handleViewportInput(e){if(e===v4){const o=this.selectionPressActive;const a=o&&this.getSelectionBounds()!==void 0;this.selectionPressActive=false;this.stopSelectionAutoScroll();this.stopScrollbarHover();if(this.activeSearch?.component.setHoveredNavigationDirection(void 0))this.requestRender();this.stopScrollbarDrag();this.pressedUrl=void 0;this.selectionDragged=false;this.clearComponentMouseGesture();this.lastComponentClick=void 0;if(o){this.selectionAnchor=void 0;this.selectionFocus=void 0;this.selectionGranularity="character";this.selectionInitialRange=void 0;if(a)this.requestRender()}this.lastClick=void 0;return{consume:true}}if(e===b4)return{consume:true};const t=this.parseWheelEvent(e);if(t){const o=this.wheelScroll.next(t.direction,performance.now());const a=t.direction*((t.button&8)!==0?o*C4:o);const u=this.createMouseEvent("wheel",t.button,t.x,t.y,{wheelDelta:a});const l=this.dispatchMouseToOverlay(u);const d=l.result??(l.hit?void 0:this.dispatchMouseToLayout(u));if(d){if(this.applyMouseDispatchResult(u,d))this.requestRender();return{consume:true}}this.routeWheel(t,a);return{consume:true}}const i=this.parseSgrMouseEvent(e);if(i){this.handleMouseEvent(i);return{consume:true}}if(this.isMouseSequence(e))return{consume:true};const s=te();const r=un(e);if(s.matches(e,"tui.altScreen.search")){if(!r)this.toggleSearch();return{consume:true}}if(this.activeSearch?.overlay?.isFocused()){if(s.matches(e,"tui.altScreen.searchNext")){if(!r)this.navigateSearch(1);return{consume:true}}if(s.matches(e,"tui.altScreen.searchPrevious")){if(!r)this.navigateSearch(-1);return{consume:true}}if(s.matches(e,"tui.altScreen.searchClose")){if(!r)this.closeSearch();return{consume:true}}}if(this.shouldDeferViewportInputToOverlay()||this.getFocusedComponent()?.handlesViewportKeys)return void 0;if(s.matches(e,"tui.altScreen.pageUp")){if(!r){this.scrollBy(-Math.max(1,this.getPrimaryScrollView().viewportHeight-m0))}return{consume:true}}if(s.matches(e,"tui.altScreen.pageDown")){if(!r){this.scrollBy(Math.max(1,this.getPrimaryScrollView().viewportHeight-m0))}return{consume:true}}if(s.matches(e,"tui.altScreen.halfPageUp")){if(!r)this.scrollBy(-Math.max(1,Math.floor(this.getPrimaryScrollView().viewportHeight/2)));return{consume:true}}if(s.matches(e,"tui.altScreen.halfPageDown")){if(!r)this.scrollBy(Math.max(1,Math.floor(this.getPrimaryScrollView().viewportHeight/2)));return{consume:true}}if(s.matches(e,"tui.altScreen.lineUp")){if(!r)this.scrollBy(-1);return{consume:true}}if(s.matches(e,"tui.altScreen.lineDown")){if(!r)this.scrollBy(1);return{consume:true}}if(s.matches(e,"tui.altScreen.previousPrompt")){if(!r)this.scrollToPrompt(-1);return{consume:true}}if(s.matches(e,"tui.altScreen.nextPrompt")){if(!r)this.scrollToPrompt(1);return{consume:true}}if(s.matches(e,"tui.altScreen.top")){if(!r)this.scrollToTop();return{consume:true}}if(s.matches(e,"tui.altScreen.bottom")){if(!r)this.scrollToBottom();return{consume:true}}return void 0}decodeMouseButton(e){switch(e&3){case 0:return"left";case 1:return"middle";case 2:return"right";default:return"none"}}createMouseEvent(e,t,i,s,r={}){return{type:e,button:e==="wheel"?"none":this.decodeMouseButton(t),x:i,y:s,screenX:i,screenY:s,width:Math.max(1,this.terminal.columns),height:Math.max(1,this.terminal.rows),shift:(t&4)!==0,alt:(t&8)!==0,ctrl:(t&16)!==0,...r.wheelDelta===void 0?{}:{wheelDelta:r.wheelDelta},...r.clickCount===void 0?{}:{clickCount:r.clickCount}}}dispatchMouseToLayout(e){if(!this.currentLayout)return void 0;const t=new Set;const i=l0(this.currentLayout,e.screenX,e.screenY);for(const s of i){if(t.has(s.component))continue;if(Un(s.component)&&s.component.handleMouse===xn.prototype.handleMouse)continue;t.add(s.component);const r=Tr(s.component,{...e,x:e.screenX-s.rect.x,y:e.screenY-s.rect.y,width:s.rect.width,height:s.rect.height});if(r)return r}return void 0}applyMouseDispatchResult(e,t){const i=this.resolveMouseFocusTarget(t.focusTarget??t.target.component);const s=t.focus===true&&this.getFocusedComponent()!==i;if(t.focus)this.setFocus(i);if(t.capture)this.mouseCapture=t.target;return t.render??(s||e.type==="press"||e.type==="click"||e.type==="drag"||e.type==="wheel")}dispatchMouseToTarget(e,t){return Tr(t.component,xv(e,t))}getComponentClickCount(e,t,i){const s=Date.now();const r=this.lastComponentClick;const o=r&&s-r.timestamp<=f0&&r.component===e.component&&r.x===t&&r.y===i?r.count%3+1:1;this.lastComponentClick={timestamp:s,count:o,component:e.component,x:t,y:i};return o}clearTextSelection(){this.stopSelectionAutoScroll();this.selectionPressActive=false;this.selectionAnchor=void 0;this.selectionFocus=void 0;this.selectionGranularity="character";this.selectionInitialRange=void 0;this.pressedUrl=void 0;this.selectionDragged=false}handleMouseEvent(e){const t=(e.button&32)!==0;const i=e.release?"release":t?this.decodeMouseButton(e.button)==="none"?"move":"drag":"press";const s=this.createMouseEvent(i,e.button,e.x,e.y);if(this.mouseCapture||this.mousePressTarget){const a=this.mouseCapture??this.mousePressTarget;if(this.mousePressPoint&&(e.x!==this.mousePressPoint.x||e.y!==this.mousePressPoint.y)){this.mousePressMoved=true;this.lastComponentClick=void 0}let u=false;const l=this.dispatchMouseToTarget(s,a);if(l)u=this.applyMouseDispatchResult(s,l);if(e.release){if(!this.mousePressMoved&&this.mousePressPoint?.x===e.x&&this.mousePressPoint.y===e.y){const d=this.createMouseEvent("click",e.button,e.x,e.y,{clickCount:this.getComponentClickCount(a,e.x,e.y)});const h=this.dispatchMouseToTarget(d,a);if(h)u=this.applyMouseDispatchResult(d,h)||u}this.clearComponentMouseGesture()}if(u)this.requestRender();return}if(this.handleSearchMouseEvent(e))return;const r=this.dispatchMouseToOverlay(s);if(!r.hit){if(this.handleScrollToEndIndicatorMouseEvent(e))return;const a=this.handleScrollbarMouseEvent(e);if(!this.scrollbarDrag)this.updateScrollbarHover(e.x,e.y);if(a)return}else{this.stopScrollbarHover()}const o=r.result??(r.hit?void 0:this.dispatchMouseToLayout(s));if(o){const a=this.applyMouseDispatchResult(s,o);if(i==="press"){this.clearTextSelection();this.mousePressTarget=o.target;this.mousePressPoint={x:e.x,y:e.y};this.mousePressMoved=false}if(a)this.requestRender();return}if(this.handleRightClickPaste(e))return;this.handleSelectionMouseEvent(e)}parseWheelEvent(e){const t=/^\x1b\[<(\d+);(\d+);(\d+)[Mm]$/.exec(e);if(t){const i=Number.parseInt(t[1],10);if((i&64)===0)return void 0;const s=i&3;if(s!==0&&s!==1)return void 0;return{direction:s===0?-1:1,x:Number.parseInt(t[2],10)-1,y:Number.parseInt(t[3],10)-1,button:i}}if(e.length===6&&e.startsWith("\x1B[M")){const i=e.charCodeAt(3)-32;if((i&64)===0)return void 0;const s=i&3;if(s!==0&&s!==1)return void 0;return{direction:s===0?-1:1,x:e.charCodeAt(4)-33,y:e.charCodeAt(5)-33,button:i}}return void 0}routeWheel(e,t){let i=t;const s=new Set;for(const o of this.currentLayout?Il(this.currentLayout,e.x,e.y):[]){s.add(o);i=o.scrollBy(i);if(i===0||o.overscroll==="contain")break}const r=this.getPrimaryScrollView();if(i!==0&&!s.has(r))r.scrollBy(i);this.updateScrollbarHover(e.x,e.y);this.requestRender()}parseSgrMouseEvent(e){const t=/^\x1b\[<(\d+);(\d+);(\d+)([Mm])$/.exec(e);if(!t)return void 0;return{button:Number.parseInt(t[1],10),x:Number.parseInt(t[2],10)-1,y:Number.parseInt(t[3],10)-1,release:t[4]==="m"}}handleRightClickPaste(e){if(!this.onRightClickPaste||process.platform!=="win32"||process.env.TERM_PROGRAM?.toLowerCase()==="vscode"||e.release||e.button!==2){return false}try{this.onRightClickPaste()}catch{}return true}handleScrollToEndIndicatorMouseEvent(e){const t=this.scrollToEndIndicatorRect;if(!t||e.release||(e.button&32)!==0||(e.button&3)!==0)return false;if(e.y!==t.row||e.x<t.column||e.x>=t.column+t.width)return false;this.scrollToBottom();return true}getScrollbarTargetAt(e,t,i=false){if(this.hasOverlay()||!this.currentLayout)return void 0;for(const s of Il(this.currentLayout,e,t)){const r=dn(this.currentLayout,s);const o=r?Ir(r,i):void 0;const a=r?s.scrollbar==="always"?r.rect.width-s.getContentWidth(r.rect.width):1:0;if(o&&e>=o.column-(a-1)&&e<=o.column&&t>=o.trackTop&&t<o.trackTop+o.trackHeight){return{scrollView:s,geometry:o}}}return void 0}setScrollbarHover(e){if(e===this.scrollbarHover)return;this.scrollbarHover?.setScrollbarActive(false);this.scrollbarHover=e;this.scrollbarHover?.setScrollbarActive(true)}updateScrollbarHover(e,t){this.setScrollbarHover(this.getScrollbarTargetAt(e,t,true)?.scrollView)}stopScrollbarHover(){this.setScrollbarHover(void 0)}scrollScrollbarToPointer(e,t,i,s){const r=t.trackHeight-t.thumbHeight;const o=Math.max(0,Math.min(r,i-t.trackTop-s));const a=r===0?0:Math.round(o/r*t.maxScrollTop);e.scrollTo(a)}handleScrollbarMouseEvent(e){if(this.hasOverlay()){this.stopScrollbarDrag();return false}if(this.scrollbarDrag){if(e.release){this.stopScrollbarDrag();return true}const r=this.currentLayout?dn(this.currentLayout,this.scrollbarDrag.scrollView):void 0;const o=r?Ir(r):void 0;if(o){this.scrollScrollbarToPointer(this.scrollbarDrag.scrollView,o,e.y,this.scrollbarDrag.grabOffset)}return true}if(e.release||(e.button&32)!==0||(e.button&3)!==0)return false;const t=this.getScrollbarTargetAt(e.x,e.y);if(!t)return false;this.stopSelectionAutoScroll();this.selectionPressActive=false;this.selectionAnchor=void 0;this.selectionFocus=void 0;this.selectionGranularity="character";this.selectionInitialRange=void 0;this.lastClick=void 0;this.pressedUrl=void 0;this.selectionDragged=false;this.setScrollbarHover(t.scrollView);const i=e.y>=t.geometry.thumbTop&&e.y<t.geometry.thumbTop+t.geometry.thumbHeight;const s=i?e.y-t.geometry.thumbTop:Math.floor(t.geometry.thumbHeight/2);if(!i)this.scrollScrollbarToPointer(t.scrollView,t.geometry,e.y,s);this.scrollbarDrag={scrollView:t.scrollView,grabOffset:s};return true}stopScrollbarDrag(){this.scrollbarDrag=void 0}getScrollSelectionPoint(e,t,i){if(!this.currentLayout)return void 0;const s=dn(this.currentLayout,e);if(!s||s.rect.height<=0||s.clip.height<=0)return void 0;const r=Math.max(0,s.rect.y,s.clip.y);const o=Math.min(this.terminal.rows-1,s.rect.y+s.rect.height-1,s.clip.y+s.clip.height-1);if(o<r)return void 0;const a=Math.max(r,Math.min(o,i));const u=Math.max(0,(s.scrollContentLines?.length??1)-1);return{row:Math.max(0,Math.min(u,e.scrollTop+a-s.rect.y)),col:Math.max(0,Math.min(s.rect.width-1,t-s.rect.x)),scrollView:e}}getSelectionPoint(e,t){if(t){const i=this.getScrollSelectionPoint(t,e.x,e.y);if(i)return i}return{row:Math.max(0,Math.min(this.terminal.rows-1,e.y)),col:Math.max(0,Math.min(this.terminal.columns-1,e.x))}}getSelectionSourceLine(e){if(e.scrollView&&this.currentLayout){const t=dn(this.currentLayout,e.scrollView)?.scrollContentLines;if(t)return t[e.row]??""}return this.previousScreen[e.row]??""}getWordSelection(e){const t=oe(this.getSelectionSourceLine(e));const i=[];let s=0;for(const l of A4.segment(t)){const d=s+w(l.segment);const h=E4.has(l.segment);i.push({start:s,end:d,selectable:l.isWordLike===true||h,joiner:h});s=d}const r=i.findIndex(l=>e.col>=l.start&&e.col<l.end);if(r<0)return void 0;const o=(l,d)=>l.selectable&&d.selectable&&(l.joiner||d.joiner);let a=i[r].start;let u=i[r].end;for(let l=r;l>0&&o(i[l-1],i[l]);l--){a=i[l-1].start}for(let l=r;l<i.length-1&&o(i[l],i[l+1]);l++){u=i[l+1].end}return{start:{...e,col:a},end:{...e,col:u,boundary:true}}}getLineSelection(e){return{start:{...e,col:0},end:{...e,col:w(this.getSelectionSourceLine(e)),boundary:true}}}updateSelectionFocus(e){if(this.selectionGranularity==="character"||!this.selectionInitialRange){this.selectionFocus=e;return}const t=this.selectionGranularity==="word"?this.getWordSelection(e):this.getLineSelection(e);if(!t)return;const i=this.selectionInitialRange;const s=t.start.row<i.start.row||t.start.row===i.start.row&&t.start.col<i.start.col;if(s){this.selectionAnchor=i.end;this.selectionFocus=t.start}else{this.selectionAnchor=i.start;this.selectionFocus=t.end}}getClickCount(e,t){const i=Date.now();const s=this.lastClick;const r=t&&s&&i-s.timestamp<=f0&&s.row===e.row&&s.scrollView===e.scrollView&&s.wordStart===t.start.col&&s.wordEnd===t.end.col?s.count%3+1:1;this.lastClick=t?{timestamp:i,count:r,row:e.row,scrollView:e.scrollView,wordStart:t.start.col,wordEnd:t.end.col}:void 0;return r}updateSelectionAutoScroll(e){const t=this.selectionAnchor?.scrollView;if(!t||!this.currentLayout){this.stopSelectionAutoScroll();return}const i=dn(this.currentLayout,t);if(!i||i.rect.height<=0||i.clip.height<=0){this.stopSelectionAutoScroll();return}const s=Math.max(0,i.rect.y,i.clip.y);const r=Math.min(this.terminal.rows-1,i.rect.y+i.rect.height-1,i.clip.y+i.clip.height-1);this.selectionDragPointer={x:e.x,y:e.y};this.selectionAutoScrollDirection=e.y<=s?-1:e.y>=r?1:0;if(this.selectionAutoScrollDirection===0){this.stopSelectionAutoScroll();return}if(this.selectionAutoScrollTimer)return;this.selectionAutoScrollTimer=setInterval(()=>this.autoScrollSelection(),50);this.selectionAutoScrollTimer.unref()}autoScrollSelection(){const e=this.selectionAnchor?.scrollView;const t=this.selectionDragPointer;const i=this.selectionAutoScrollDirection;if(!e||!t||i===0){this.stopSelectionAutoScroll();return}const s=e.scrollBy(i);if(s===i){this.stopSelectionAutoScroll();return}const r=this.getScrollSelectionPoint(e,t.x,t.y);if(r)this.updateSelectionFocus(r);this.requestRender()}stopSelectionAutoScroll(){if(this.selectionAutoScrollTimer){clearInterval(this.selectionAutoScrollTimer);this.selectionAutoScrollTimer=void 0}this.selectionAutoScrollDirection=0;this.selectionDragPointer=void 0}handleSelectionMouseEvent(e){const t=e.button&3;if(t!==0&&!(e.release&&t===3))return;const i=this.selectionAnchor?.scrollView;const s=this.getSelectionPoint(e,i);if(e.release){if(!this.selectionPressActive)return;this.selectionPressActive=false;this.stopSelectionAutoScroll();if(!this.selectionAnchor)return;this.updateSelectionFocus(s);const d=!this.selectionDragged&&this.selectionAnchor.scrollView===s.scrollView&&this.selectionAnchor.row===s.row&&this.selectionAnchor.col===s.col;const h=d?this.pressedUrl:void 0;this.pressedUrl=void 0;if(h&&this.openUrl){this.selectionAnchor=void 0;this.selectionFocus=void 0;try{this.openUrl(h)}catch{}this.requestRender();return}if(d){const m=this.createMouseEvent("click",e.button,e.x,e.y,{clickCount:this.lastClick?.count??1});const f=this.dispatchMouseToOverlay(m);const y=f.result??(f.hit?void 0:this.dispatchMouseToLayout(m));if(y){const T=this.applyMouseDispatchResult(m,y);this.clearTextSelection();if(T)this.requestRender();return}}if(this.copyOnSelect)void this.copySelectionToClipboard();this.requestRender();return}if((e.button&32)!==0){if(!this.selectionPressActive||!this.selectionAnchor)return;this.selectionDragged=true;this.lastClick=void 0;this.pressedUrl=void 0;this.updateSelectionFocus(s);this.updateSelectionAutoScroll(e);this.requestRender();return}this.stopSelectionAutoScroll();this.selectionPressActive=true;const r=!this.hasOverlay()&&this.currentLayout?Il(this.currentLayout,e.x,e.y)[0]:void 0;const o=this.getSelectionPoint(e,r);const a=this.getWordSelection(o);const u=this.getClickCount(o,a);const l=u===2?a:u===3?this.getLineSelection(o):void 0;this.selectionGranularity=l?u===2?"word":"line":"character";this.selectionInitialRange=l;this.selectionAnchor=l?.start??o;this.selectionFocus=l?.end??o;this.selectionDragged=false;this.pressedUrl=l?void 0:zu(this.previousScreen[Math.max(0,Math.min(this.terminal.rows-1,e.y))]??"",Math.max(0,Math.min(this.terminal.columns-1,e.x)));this.requestRender()}getSelectionBounds(){if(!this.selectionAnchor||!this.selectionFocus)return void 0;if(this.selectionAnchor.scrollView!==this.selectionFocus.scrollView)return void 0;const e=this.selectionAnchor.row<this.selectionFocus.row||this.selectionAnchor.row===this.selectionFocus.row&&this.selectionAnchor.col<this.selectionFocus.col;if(this.selectionAnchor.row===this.selectionFocus.row&&this.selectionAnchor.col===this.selectionFocus.col){return void 0}return e?{start:this.selectionAnchor,end:this.selectionFocus}:{start:this.selectionFocus,end:this.selectionAnchor}}getSelectionColumns(e,t,i,s=0,r=w(e)){const o=w(e);let a=Math.max(0,s);let u=Math.min(o,r);if(t===i.start.row){a=zo(e,i.start.col)?.start??Math.min(i.start.col,o)}if(t===i.end.row){u=i.end.boundary?Math.min(i.end.col,o):zo(e,i.end.col)?.end??Math.min(i.end.col+1,o)}return{start:Math.max(s,a),end:Math.min(r,u)}}getActiveSelectionText(){const e=this.getSelectionBounds();if(!e)return void 0;let t=this.previousScreen;if(e.start.scrollView){if(!this.currentLayout)return void 0;const r=dn(this.currentLayout,e.start.scrollView);if(!r?.scrollContentLines)return void 0;t=r.scrollContentLines}const i=[];for(let r=e.start.row;r<=e.end.row;r++){const o=t[r]??"";const a=this.getSelectionColumns(o,r,e);i.push(oe(xe(o,a.start,Math.max(0,a.end-a.start),true)).trimEnd())}const s=i.join("\n");return s.length===0?void 0:s}async copySelectionToClipboard(){const e=this.getActiveSelectionText();if(!e)return false;return this.copyTextToClipboard(e)}async copyTextToClipboard(e){if(this.copySelection){const t=await this.copySelection(e);const i=t===true;this.flash(i?"Copied!":typeof t==="string"?t:"Copy failed",i?void 0:M4);return i}this.terminal.write(`\x1B]52;c;${Buffer.from(e).toString("base64")}\x07`);this.flash("Copied!");return true}applySearchTextHighlight(e,t){const i=t?this.searchCurrentMatchStyle:this.searchMatchStyle;let s="";let r=0;let o=0;while(o<e.length){const a=Re(e,o);if(!a){o+=1;continue}if(o>r)s+=i(e.slice(r,o));s+=a.code;o+=a.length;r=o}if(r<e.length)s+=i(e.slice(r));return s}applySearchHighlights(e,t){const i=this.activeSearch;if(!i||i.selectedIndex<0||i.matches.length===0)return e;const s=t.primaryScrollView??this.implicitScrollView;const r=dn(t,s);if(!r)return e;const o=new Map;const a=Ir(r)?.column;const u=Math.max(0,r.rect.y,r.clip.y);const l=Math.min(e.length,r.rect.y+r.rect.height,r.clip.y+r.clip.height);const d=Math.max(0,r.rect.x,r.clip.x);const h=Math.min(this.terminal.columns,r.rect.x+r.rect.width,r.clip.x+r.clip.width,a??Number.POSITIVE_INFINITY);const m=s.scrollTop+u-r.rect.y;const f=s.scrollTop+l-r.rect.y-1;let y=0;let T=i.matches.length;while(y<T){const v=y+Math.floor((T-y)/2);const C=i.matches[v];const I=C.segments[C.segments.length-1]?.row??-1;if(I<m)y=v+1;else T=v}for(let v=y;v<i.matches.length;v++){const C=i.matches[v];if((C.segments[0]?.row??0)>f)break;for(const I of C.segments){const R=r.rect.y+I.row-s.scrollTop;if(R<u||R>=l)continue;const L=Math.max(d,r.rect.x+I.startCol);const _=Math.min(h,r.rect.x+I.endCol);if(_<=L)continue;const D=o.get(R)??[];D.push({startCol:L,endCol:_,current:v===i.selectedIndex});o.set(R,D)}}const b=[...e];for(const[v,C]of o){let I=b[v]??"";if(Le(I))continue;const R=w(I);for(const L of C.sort((_,D)=>D.startCol-_.startCol)){const _=Math.min(L.startCol,R);const D=Math.min(L.endCol,R);if(D<=_)continue;const k=xe(I,0,_,true);const K=xe(I,_,D-_,true);const j=xe(I,D,Math.max(0,R-D),true);I=`${k}${this.applySearchTextHighlight(K,L.current)}${j}`}b[v]=I}return b}applySelectionHighlight(e){let t="\x1B[7m";let i=0;while(i<e.length){const s=Re(e,i);if(!s){t+=e[i];i+=1;continue}t+=s.code;if(s.code.endsWith("m"))t+="\x1B[7m";i+=s.length}return`${t}\x1B[27m`}applySelection(e,t=this.currentLayout){const i=this.getSelectionBounds();if(!i)return e;let s=i;let r=0;let o=e.length-1;let a=0;let u=this.terminal.columns;if(i.start.scrollView){if(!t)return e;const l=dn(t,i.start.scrollView);if(!l)return e;r=Math.max(0,l.rect.y,l.clip.y);o=Math.min(e.length-1,l.rect.y+l.rect.height-1,l.clip.y+l.clip.height-1);a=Math.max(0,l.rect.x,l.clip.x);u=Math.min(this.terminal.columns,l.rect.x+l.rect.width,l.clip.x+l.clip.width);s={start:{...i.start,row:l.rect.y+i.start.row-i.start.scrollView.scrollTop,col:l.rect.x+i.start.col},end:{...i.end,row:l.rect.y+i.end.row-i.start.scrollView.scrollTop,col:l.rect.x+i.end.col}}}return e.map((l,d)=>{if(d<r||d>o||d<s.start.row||d>s.end.row||Le(l)){return l}const h=w(l);const m=this.getSelectionColumns(l,d,s,a,u);if(m.end<=m.start)return l;const f=xe(l,0,m.start,true);const y=xe(l,m.start,m.end-m.start,true);const T=xe(l,m.end,Math.max(0,h-m.end),true);return`${f}${this.applySelectionHighlight(y)}${T}`})}isMouseSequence(e){return/^\x1b\[<\d+;\d+;\d+[Mm]$/.test(e)||e.length===6&&e.startsWith("\x1B[M")}compositeScrollToEndIndicator(e,t,i){this.scrollToEndIndicatorRect=void 0;const s=t.primaryScrollView??this.implicitScrollView;if(!this.scrollToEndIndicator||!s.followEnd||s.isFollowingEnd)return e;const r=dn(t,s);const o=r?.clip;if(!o||o.width<=0||o.height<=0)return e;const a=o.y+o.height-1;if(a>=e.length||Le(e[a]??""))return e;const u=r?Ir(r)?.column:void 0;const l=E(this.scrollToEndIndicator(),o.width,"");const d=w(l);const h=o.x+Math.floor((o.width-d)/2);const m=u??o.x+o.width;const f=Math.max(0,m-h);const y=E(l,f,"");const T=w(y);if(T===0)return e;const b=[...e];b[a]=Wi(b[a]??"",y,h,T,i);this.scrollToEndIndicatorRect={row:a,column:h,width:T};return b}compositeFlashes(e,t,i){const s=this.flashes.render(t).slice(-i);if(s.length===0)return e;const r=[...e];while(r.length<i)r.push("");for(let o=0;o<s.length;o++){const a=s[o];const u=w(a);if(u===0)continue;r[o]=Wi(r[o]??"",a,t-u,u,t)}return r}doRender(){if(this.stopped||!this.altScreenActive)return;const e=Math.max(1,this.terminal.columns);const t=Math.max(1,this.terminal.rows);const i=this.layoutRoot??this.implicitScrollView;let s=Mr(i,e,t,()=>this.requestRender());if(this.refreshSearch(s)){s=Mr(i,e,t,()=>this.requestRender())}let r=this.resolveFakeCursors(s.lines.map(I=>I.replace(p0,"")));r=this.applySearchHighlights(r,s);r=this.compositeScrollToEndIndicator(r,s,e);r=this.compositeOverlays(r,e,t);if(r.length>t)r=r.slice(r.length-t);r=this.applySelection(r,s);r=this.compositeFlashes(r,e,t);const o=this.extractCursorPosition(r,t);r=this.applyLineResets(r).map(I=>{if(Le(I)||w(I)<=e)return I;return xe(I,0,e,true)});const a=this.previousScreen.length===0||this.previousScreenWidth!==e||this.previousScreenHeight!==t;const u=r.map((I,R)=>I!==this.previousScreen[R]);const l=r.some((I,R)=>u[R]&&(Le(I)||Le(this.previousScreen[R]??"")));const d=Boolean(process.env.WEZTERM_PANE)||process.env.TERM_PROGRAM?.toLowerCase()==="wezterm";const h=!l&&d&&this.imageProtocol==="kitty"&&u.some(Boolean)&&r.some((I,R)=>{const L=qm(I);if(L===void 0)return false;for(let _=R;_<R+L;_++){if(u[_])return true}return false});const m=l||h;const f=a||m;const y=this.uploadedKittyImages.size>0;const T=f&&this.imageProtocol==="kitty"?this.prepareKittyScreen(r):{lines:r,evictedImageDeletion:""};let b=El;if(a){this.fullRedrawCount+=1;if(this.imageProtocol==="kitty"&&y){b+=Bm()}else{b+=`${this.deleteKittyImages()}\x1B[2J`}}else if(m){if(this.imageProtocol==="iterm2")b+="\x1B[2J";else if(this.imageProtocol==="kitty")b+=Bm()}b+=T.evictedImageDeletion;let v=0;const C=f&&this.imageProtocol==="kitty"&&r.some(Le)&&d;if(C){for(let I=0;I<t;I++){if(!a&&!m&&r[I]===this.previousScreen[I])continue;b+=`\x1B[${I+1};1H\x1B[2K`}for(let I=0;I<t;I++){if(!a&&!m&&r[I]===this.previousScreen[I])continue;if(Le(T.lines[I]??""))continue;v+=1;b+=`\x1B[${I+1};1H${T.lines[I]??""}`}for(let I=0;I<t;I++){if(!a&&!m&&r[I]===this.previousScreen[I])continue;if(!Le(T.lines[I]??""))continue;v+=1;b+=`\x1B[${I+1};1H${T.lines[I]??""}`}}else{for(let I=0;I<t;I++){if(!a&&!m&&r[I]===this.previousScreen[I])continue;v+=1;b+=`\x1B[${I+1};1H\x1B[2K${T.lines[I]??""}`}}this.frameChangedLines=v;if(o){b+=`\x1B[${o.row+1};${Math.min(e,o.col)+1}H`;b+=this.getShowHardwareCursor()?"\x1B[?25h":"\x1B[?25l"}else{b+="\x1B[?25l"}b+=Al;this.terminal.write(b);this.previousScreen=r;this.previousScreenWidth=e;this.previousScreenHeight=t;this.currentLayout=s}};import*as si from"node:fs";import*as v0 from"node:os";import*as Rs from"node:path";var g0=sr("mcode:tui");var y0="\x1B_G";var T0=1024*1024;var R4=/^(?:\x1b\]133;[ABC](?:\x07|\x1b\\))+/;var pa=class{buffer="";writtenChars=0;write;constructor(e){this.write=e}append(e){let t=0;while(t<e.length){const i=T0-this.buffer.length;if(i===0){this.flush();continue}let s=Math.min(e.length,t+i);if(s<e.length&&e.charCodeAt(s-1)>=55296&&e.charCodeAt(s-1)<=56319&&e.charCodeAt(s)>=56320&&e.charCodeAt(s)<=57343){s--}if(s===t){this.flush();continue}this.buffer+=e.slice(t,s);t=s;if(this.buffer.length===T0){this.flush()}}}flush(){if(!this.buffer)return;this.write(this.buffer);this.writtenChars+=this.buffer.length;this.buffer=""}get length(){return this.writtenChars+this.buffer.length}};function S0(n){const e=n.indexOf(y0);if(e===-1)return void 0;const t=e+y0.length;const i=n.indexOf(";",t);if(i===-1)return void 0;const s=[];let r=1;for(const o of n.slice(t,i).split(",")){const[a,u]=o.split("=",2);if(u===void 0)continue;const l=Number(u);if(!Number.isInteger(l)||l<=0||l>4294967295)continue;if(a==="i")s.push(l);else if(a==="r")r=l}return{ids:s,rows:r}}function lf(n){return S0(n)?.ids??[]}function k4(n){return S0(n)?.rows??1}function b0(n){return JSON.stringify(oe(n).replace(new RegExp("\\p{L}","gu"),"a").replace(new RegExp("\\p{N}","gu"),"9").trimEnd().slice(0,48))}function df(){return Boolean(process.env.TERMUX_VERSION)}var P4=1e3;var ks=class extends yr{mode="regular";previousLines=[];previousKittyImageIds=new Set;previousWidth=0;previousHeight=0;cursorRow=0;hardwareCursorRow=0;maxLinesRendered=0;previousViewportTop=0;resizeTimer;historyReplayPending=false;historyReplayDeferred=false;historyReplayDeferredAt=0;lastUserInputAt=Number.NEGATIVE_INFINITY;forceHistoryReplay=false;viewportLayouts=[];hadOverlays=false;onTerminalResize(){if(this.previousWidth===this.terminal.columns&&this.previousHeight===this.terminal.rows)return;g0.debug("terminal.resize",{width:this.terminal.columns,height:this.terminal.rows,previousWidth:this.previousWidth,previousHeight:this.previousHeight,deferredReplay:this.previousLines.length>0&&!df()});if(this.previousLines.length>0&&!df()){if(this.resizeTimer)clearTimeout(this.resizeTimer);this.historyReplayPending=true;this.resizeTimer=setTimeout(()=>{this.resizeTimer=void 0;this.requestRender()},150)}this.requestImmediateRender()}onUserInput(){this.lastUserInputAt=performance.now();if(this.historyReplayDeferred)this.requestRender()}hostFollowsBottom(){return this.forceHistoryReplay||performance.now()-this.lastUserInputAt<=P4}userInputSince(e){return this.forceHistoryReplay||this.lastUserInputAt>=e}deferHistoryReplay(){if(!this.historyReplayDeferred)this.historyReplayDeferredAt=performance.now();this.historyReplayDeferred=true}cancelResize(){if(this.resizeTimer)clearTimeout(this.resizeTimer);this.resizeTimer=void 0}stop(e={}){this.cancelResize();if(!this.stopped&&(this.historyReplayPending||this.historyReplayDeferred||!e.preserveScreen&&this.hasPendingRender())){this.forceHistoryReplay=true;try{this.doRender()}finally{this.forceHistoryReplay=false}}super.stop(e)}captureRenderState(){return{previousLines:[...this.previousLines],previousWidth:this.previousWidth,previousHeight:this.previousHeight,cursorRow:this.cursorRow,hardwareCursorRow:this.hardwareCursorRow,maxLinesRendered:this.maxLinesRendered,previousViewportTop:this.previousViewportTop,viewportLayouts:this.viewportLayouts.map(e=>({...e})),hadOverlays:this.hadOverlays}}restoreRenderState(e){this.cancelResize();this.historyReplayPending=false;this.historyReplayDeferred=false;this.previousLines=e.previousLines.map(t=>Le(t)?"":t);this.previousKittyImageIds=new Set;this.previousWidth=e.previousWidth;this.previousHeight=e.previousHeight;this.cursorRow=e.cursorRow;this.hardwareCursorRow=e.hardwareCursorRow;this.maxLinesRendered=e.maxLinesRendered;this.previousViewportTop=e.previousViewportTop;this.viewportLayouts=e.viewportLayouts.map(t=>({...t}));this.hadOverlays=e.hadOverlays}resetRenderState(){this.viewportLayouts=[];this.hadOverlays=false;this.cancelResize();this.historyReplayPending=false;this.historyReplayDeferred=false;this.previousLines=[];this.previousWidth=-1;this.previousHeight=-1;this.cursorRow=0;this.hardwareCursorRow=0;this.maxLinesRendered=0;this.previousViewportTop=0}beforeTerminalStop(e){if(e.preserveScreen||this.previousLines.length===0)return;this.terminal.write(" ");const t=this.previousLines.length;const i=t-this.hardwareCursorRow;if(i>0)this.terminal.write(`\x1B[${i}B`);else if(i<0)this.terminal.write(`\x1B[${-i}A`);this.terminal.write("\r\n")}collectKittyImageIds(e){const t=new Set;for(const i of e){for(const s of lf(i)){t.add(s)}}return t}deleteKittyImages(e){let t="";for(const i of e){t+=Zo(i)}return t}getKittyImageReservedRows(e,t,i=e.length-1){const s=k4(e[t]??"");if(s<=1)return 1;const r=Math.min(s,i-t+1,e.length-t);let o=1;while(o<r){const a=e[t+o]??"";if(Le(a)||w(a)>0)break;o++}return o}expandChangedRangeForKittyImages(e,t,i){let s=e;let r=t;const o=a=>{for(let u=0;u<a.length;u++){if(lf(a[u]).length===0)continue;const l=u+this.getKittyImageReservedRows(a,u)-1;if(u>=e||u<=t&&l>=e){s=Math.min(s,u);r=Math.max(r,l)}}};o(this.previousLines);o(i);return{firstChanged:s,lastChanged:r}}deleteChangedKittyImages(e,t){if(e<0||t<e)return"";const i=new Set;const s=Math.min(t,this.previousLines.length-1);for(let r=e;r<=s;r++){for(const o of lf(this.previousLines[r]??"")){i.add(o)}}return this.deleteKittyImages(i)}doRender(){if(this.stopped)return;const e=this.terminal.columns;const t=this.terminal.rows;const i=this.previousWidth!==0&&this.previousWidth!==e;const s=this.previousHeight!==0&&this.previousHeight!==t;const r=this.previousHeight>0?this.previousViewportTop+this.previousHeight:t;let o=s?Math.max(0,r-t):this.previousViewportTop;let a=o;const u=this.hostFollowsBottom();const l=this.historyReplayDeferred&&this.userInputSince(this.historyReplayDeferredAt);let d=this.hardwareCursorRow;const h=$=>{const Q=d-o;const re=$-a;return re-Q};let m=this.resolveFakeCursors(this.render(e)).map($=>$.replace(R4,""));const f=this.children.length===1?Math.max(0,Math.floor(this.children[0]?.takeDiscardedRows?.()??0)):0;if(f>0&&f<=o&&!i&&!s&&!this.historyReplayPending){this.previousLines=this.previousLines.slice(f);this.previousViewportTop-=f;o-=f;a-=f;this.cursorRow=Math.max(0,this.cursorRow-f);this.hardwareCursorRow-=f;d-=f;this.maxLinesRendered=Math.max(0,this.maxLinesRendered-f)}const y=this.children.map($=>({component:$,key:$.getViewportLayoutKey?.()}));const T=y.length>0&&y.length===this.viewportLayouts.length&&y.every(({component:$,key:Q},re)=>Q!==void 0&&$===this.viewportLayouts[re]?.component&&Q===this.viewportLayouts[re]?.key);this.viewportLayouts=y;const b=this.hadOverlays;this.hadOverlays=this.hasOverlayEntries;if(this.hasOverlayEntries){m=this.compositeOverlays(m,e,t)}if((T||!u)&&!l&&!b&&!i&&!s&&!this.historyReplayPending&&!this.hasOverlayEntries&&o>0&&m.length>o&&m.length<o+t&&this.previousKittyImageIds.size===0&&!m.some(Le)){let $=true;for(let Q=0;Q<o;Q++){if(oe(this.previousLines[Q]??"")!==oe(m[Q]??"")){$=false;break}}if($){let Q=m.length;for(let ee=0;ee<m.length;ee++){if(oe(this.previousLines[ee]??"")!==oe(m[ee]??"")){Q=Math.max(o,ee);break}}const re=Array(o+t-m.length).fill("");m=[...m.slice(0,Q),...re,...m.slice(Q)];if(!T)this.deferHistoryReplay()}}const v=this.extractCursorPosition(m,t);m=this.applyLineResets(m);const C=($,Q=false,re=false)=>{if(Q&&!re&&!this.historyReplayPending&&m.length<=o){Q=false}const ee=Q?this.historyReplayPending||re?Math.max(0,m.length-t):o:0;this.fullRedrawCount+=1;const de=new pa(Ae=>this.terminal.write(Ae));de.append("\x1B[?2026h");if($){de.append(this.deleteKittyImages(this.previousKittyImageIds));if(Q){de.append("\x1B[H");for(let Ae=0;Ae<t;Ae++){if(Ae>0)de.append("\x1B[1B");de.append("\x1B[2K")}de.append("\x1B[H")}else{de.append("\x1B[2J\x1B[H\x1B[3J")}}for(let Ae=ee;Ae<m.length;Ae++){if(Ae>ee)de.append("\r\n");const it=m[Ae];const nn=Le(it);const It=nn?this.getKittyImageReservedRows(m,Ae):1;if(It>1&&It<=t){for(let Ri=1;Ri<It;Ri++){de.append("\r\n")}de.append(`\x1B[${It-1}A`);de.append(it);de.append(`\x1B[${It-1}B`);Ae+=It-1;continue}de.append(it)}this.cursorRow=Math.max(0,m.length-1);this.hardwareCursorRow=this.cursorRow;if($){this.maxLinesRendered=m.length}else{this.maxLinesRendered=Math.max(this.maxLinesRendered,m.length)}this.previousViewportTop=Math.max(ee,m.length-t);this.positionHardwareCursor(v,m.length,de);de.append("\x1B[?2026l");de.flush();this.frameChangedLines=m.length-ee;this.previousLines=m;this.previousKittyImageIds=this.collectKittyImageIds(m);this.previousWidth=e;this.previousHeight=t};const I=process.env.PI_DEBUG_REDRAW==="1";const R=($,Q="")=>{g0.debug("render.reconstruct",{reason:$,detail:Q||void 0,previousLines:this.previousLines.length,newLines:m.length,height:t});if(!I||this.logDirectory===void 0)return;const re=Rs.join(this.logDirectory,"pi-debug.log");const ee=`[${new Date().toISOString()}] [pid ${process.pid}] fullRender: ${$} (prev=${this.previousLines.length}, new=${m.length}, height=${t})${Q}
|
|
70
|
-
`;si.mkdirSync(Rs.dirname(re),{recursive:true});si.appendFileSync(re,ee)};const L=($=0)=>{for(let Q=$;Q<o;Q++){const re=this.previousLines[Q]??"";const ee=m[Q]??"";if(re!==ee&&oe(re)!==oe(ee))return Q}return-1};const _=($,Q,re)=>{const ee=!u;if(I){const de=re<0?"":` row=${re} old=${b0(this.previousLines[re]??"")} new=${b0(m[re]??"")}`;R($,` deferred=${ee?"yes":"no"}${de}`)}if(!ee){C(true);return}this.deferHistoryReplay();C(true,true,Q||m.length<=o)};if(this.historyReplayPending){const $=this.resizeTimer!==void 0;C(true,$);if(!$){this.historyReplayPending=false;this.historyReplayDeferred=false}return}if(l){R("deferred history replay after user input");this.historyReplayDeferred=false;C(true);return}if(this.previousLines.length===0&&!i&&!s){R("first render");C(false);return}if(i){R(`terminal width changed (${this.previousWidth} -> ${e})`);C(true);return}if(s&&!df()){R(`terminal height changed (${this.previousHeight} -> ${t})`);C(true);return}if(Math.max(0,m.length-t)<o){_("document shrink reveals scrolled rows",true,I?L():-1);return}if(this.getClearOnShrink()&&m.length<this.maxLinesRendered&&!this.hasOverlayEntries){R(`clearOnShrink (maxLinesRendered=${this.maxLinesRendered})`);C(true,true);return}let D=-1;let k=-1;const K=Math.max(m.length,this.previousLines.length);for(let $=0;$<K;$++){const Q=$<this.previousLines.length?this.previousLines[$]:"";const re=$<m.length?m[$]:"";if(Q!==re){if(D===-1){D=$}k=$}}const j=m.length>this.previousLines.length;if(j){if(D===-1){D=this.previousLines.length}k=m.length-1}if(D!==-1){const $=this.expandChangedRangeForKittyImages(D,k,m);D=$.firstChanged;k=$.lastChanged}const B=j&&D===this.previousLines.length&&D>0;if(D===-1){this.positionHardwareCursor(v,m.length);this.previousViewportTop=o;this.previousHeight=t;return}if(D>=m.length){if(this.previousLines.length>m.length){const $=new pa(it=>this.terminal.write(it));$.append("\x1B[?2026h");$.append(this.deleteChangedKittyImages(D,k));const Q=Math.max(0,m.length-1);if(Q<o){R(`deleted lines moved viewport up (${Q} < ${o})`);C(true,true);return}const re=h(Q);if(re>0)$.append(`\x1B[${re}B`);else if(re<0)$.append(`\x1B[${-re}A`);$.append("\r");const ee=this.previousLines.length-m.length;if(ee>t){R(`extraLines > height (${ee} > ${t})`);C(true,true);return}const de=m.length===0?0:1;if(ee>0&&de>0){$.append(`\x1B[${de}B`)}for(let it=0;it<ee;it++){$.append("\r\x1B[2K");if(it<ee-1)$.append("\x1B[1B")}const Ae=Math.max(0,ee-1+de);if(Ae>0){$.append(`\x1B[${Ae}A`)}this.cursorRow=Q;this.hardwareCursorRow=Q;this.positionHardwareCursor(v,m.length,$);$.append("\x1B[?2026l");$.flush();this.frameChangedLines=ee}this.previousLines=m;this.previousKittyImageIds=this.collectKittyImageIds(m);this.previousWidth=e;this.previousHeight=t;this.previousViewportTop=o;return}if(D<o){const $=`firstChanged < viewportTop (${D} < ${o})`;const Q=L(D);if(Q>=0){_($,false,Q);return}R($," style-only");C(true,true);return}const V=new pa($=>this.terminal.write($));V.append("\x1B[?2026h");V.append(this.deleteChangedKittyImages(D,k));const ve=o+t-1;const Me=B?D-1:D;if(Me>ve){const $=Math.max(0,Math.min(t-1,d-o));const Q=t-1-$;if(Q>0){V.append(`\x1B[${Q}B`)}const re=Me-ve;V.append("\r\n".repeat(re));o+=re;a+=re;d=Me}const nt=h(Me);if(nt>0){V.append(`\x1B[${nt}B`)}else if(nt<0){V.append(`\x1B[${-nt}A`)}V.append(B?"\r\n":"\r");const Tt=Math.min(k,m.length-1);for(let $=D;$<=Tt;$++){if($>D)V.append("\r\n");const Q=m[$];const re=Le(Q);const ee=re?this.getKittyImageReservedRows(m,$,Tt):1;if(ee>1){const de=$-a;if(de<0||de+ee>t){R(`kitty image pre-clear would scroll (${de} + ${ee} > ${t})`);C(true);return}V.append("\x1B[2K");for(let Ae=1;Ae<ee;Ae++){V.append("\r\n\x1B[2K")}V.append(`\x1B[${ee-1}A`);V.append(Q);V.append(`\x1B[${ee-1}B`);$+=ee-1;continue}V.append("\x1B[2K");if(!re&&w(Q)>e){const de=Rs.join(this.logDirectory??v0.tmpdir(),"pi-tui-crash.log");const Ae=[`Crash at ${new Date().toISOString()}`,`Terminal width: ${e}`,`Line ${$} visible width: ${w(Q)}`,"","=== All rendered lines ===",...m.map((nn,It)=>`[${It}] (w=${w(nn)}) ${nn}`),""].join("\n");si.mkdirSync(Rs.dirname(de),{recursive:true});si.writeFileSync(de,Ae);this.stop();const it=[`Rendered line ${$} exceeds terminal width (${w(Q)} > ${e}).`,"","This is likely caused by a custom TUI component not truncating its output.","Use visibleWidth() to measure and truncateToWidth() to truncate lines.","",`Debug log written to: ${de}`].join("\n");throw new Error(it)}V.append(Q)}let Ne=Tt;if(this.previousLines.length>m.length){if(Tt<m.length-1){const Q=m.length-1-Tt;V.append(`\x1B[${Q}B`);Ne=m.length-1}const $=this.previousLines.length-m.length;for(let Q=m.length;Q<this.previousLines.length;Q++){V.append("\r\n\x1B[2K")}V.append(`\x1B[${$}A`)}if(process.env.PI_TUI_DEBUG==="1"){const $="/tmp/tui";si.mkdirSync($,{recursive:true});const Q=Rs.join($,`render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);const re=[`firstChanged: ${D}`,`viewportTop: ${a}`,`cursorRow: ${this.cursorRow}`,`height: ${t}`,`lineDiff: ${nt}`,`hardwareCursorRow: ${d}`,`renderEnd: ${Tt}`,`finalCursorRow: ${Ne}`,`cursorPos: ${JSON.stringify(v)}`,`newLines.length: ${m.length}`,`previousLines.length: ${this.previousLines.length}`,"","=== newLines ===",JSON.stringify(m,null,2),"","=== previousLines ===",JSON.stringify(this.previousLines,null,2),"","=== buffer ===",`[${V.length} chars written in bounded chunks]`].join("\n");si.writeFileSync(Q,re)}this.cursorRow=Math.max(0,m.length-1);this.hardwareCursorRow=Ne;this.maxLinesRendered=Math.max(this.maxLinesRendered,m.length);this.previousViewportTop=Math.max(o,Ne-t+1);this.positionHardwareCursor(v,m.length,V);V.append("\x1B[?2026l");V.flush();this.frameChangedLines=Ne-D+1+Math.max(0,this.previousLines.length-m.length);this.previousLines=m;this.previousKittyImageIds=this.collectKittyImageIds(m);this.previousWidth=e;this.previousHeight=t}positionHardwareCursor(e,t,i){if(!e||t<=0){if(i)i.append("\x1B[?25l");else this.terminal.hideCursor();return}const s=Math.max(0,Math.min(e.row,t-1));const r=Math.max(0,e.col);const o=s-this.hardwareCursorRow;let a="";if(o>0){a+=`\x1B[${o}B`}else if(o<0){a+=`\x1B[${-o}A`}a+=`\x1B[${r+1}G`;if(a){if(i)i.append(a);else this.terminal.write(a)}this.hardwareCursorRow=s;if(i){i.append(this.getShowHardwareCursor()?"\x1B[?25h":"\x1B[?25l")}else if(this.getShowHardwareCursor()){this.terminal.showCursor()}else{this.terminal.hideCursor()}}};import{closeSync as L4,mkdirSync as O4,openSync as D4,writeSync as N4}from"node:fs";import{join as C0}from"node:path";function x0(n,e={}){const t=e.force===true||process.stderr.isTTY===true;if(!t)return{logFile:void 0,restore:()=>{}};const i=C0(n,"v2","observability","logs");const s=C0(i,`tui-stderr-${process.pid}.log`);let r;try{O4(i,{recursive:true});r=D4(s,"a")}catch{return{logFile:void 0,restore:()=>{}}}const o=process.stderr.write.bind(process.stderr);let a=false;process.stderr.write=((u,l,d)=>{try{const h=typeof u==="string"?Buffer.from(u):Buffer.from(u);N4(r,h)}catch{}if(typeof l==="function")l();else if(typeof d==="function")d();return true});return{logFile:s,restore:()=>{if(a)return;a=true;process.stderr.write=o;try{L4(r)}catch{}}}}function Rl(n){const e=B4(n.env);const t=q4(n.env);const i=F4(n.env);const s=n.isTTY&&n.env.TERM!=="dumb";const r=$4(n,s);return Object.freeze({terminalId:e,platform:n.platform,isTTY:n.isTTY,transport:i,multiplexer:t,color:r>0,colorLevel:r})}function F4(n){return w0(n)?"ssh":"local"}function Er(){return Rl({platform:process.platform,isTTY:Boolean(process.stdin.isTTY&&process.stdout.isTTY),env:process.env,colorDepth:process.stdout.getColorDepth?.(process.env)})}function $4(n,e){if(!e||n.env.NO_COLOR!==void 0||n.env.FORCE_COLOR==="0")return 0;if(n.env.FORCE_COLOR!==void 0){const s=Number.parseInt(n.env.FORCE_COLOR,10);if(Number.isInteger(s))return Math.max(1,Math.min(3,s));return 1}if((n.colorDepth??0)>=24)return 3;if((n.colorDepth??0)>=8)return 2;if((n.colorDepth??0)>=4)return 1;const t=n.env.COLORTERM?.toLocaleLowerCase();if(t==="truecolor"||t==="24bit")return 3;const i=n.env.TERM?.toLocaleLowerCase()??"";if(i.includes("truecolor")||i.includes("24bit"))return 3;if(i.includes("256color"))return 2;return 1}function B4(n){if(n.CMUX_SOCKET_PATH||n.TERM_PROGRAM?.toLowerCase()==="cmux")return"cmux";if(n.WT_SESSION&&!w0(n))return"windows-terminal";const e=n.TERM_PROGRAM?.toLocaleLowerCase();if(e==="apple_terminal")return"apple-terminal";if(e==="ghostty")return"ghostty";if(e==="iterm.app")return"iterm2";if(e==="vscode")return"vscode";if(e==="wezterm")return"wezterm";if(e==="warpterminal")return"warp";const t=n.TERM?.toLocaleLowerCase()??"";if(t.includes("ghostty"))return"ghostty";if(t.includes("kitty")||n.KITTY_WINDOW_ID)return"kitty";if(t.includes("wezterm"))return"wezterm";return"unknown"}function q4(n){if(n.TMUX)return"tmux";const e=n.TERM?.toLocaleLowerCase()??"";if(e.startsWith("tmux"))return"tmux";return e.startsWith("screen")?"screen":"none"}function w0(n){return Boolean(n.SSH_CONNECTION||n.SSH_CLIENT||n.SSH_TTY)}var H4=new Set(["EIO","EPIPE","ENOTCONN","EOF"]);function Ps(n,e){return K4(n)&&U4(e)}function U4(n){return typeof n==="object"&&n!==null&&"code"in n&&typeof n.code==="string"&&H4.has(n.code)}function K4(n){return n==="stdout.error"||n==="stderr.error"||n.startsWith("terminal.")}function I0(n){let e=false;let t=false;let i=false;let s=false;const r=k=>{try{n.report(k)}catch{}};const o=(k,K)=>{try{n.capture?.(k,K)}catch{}};const a=k=>{try{n.onStopFailure?.(k)}catch{}};const u=k=>{try{n.onStopCause?.(k)}catch{}};const l=(k,K,j=false)=>{if(e)return;e=true;u(k);const B=()=>j||k.terminalDead||n.isTerminalDead?.()===true;void Promise.resolve().then(()=>n.stop()).catch(V=>{n.process.exitCode=1;const ve=B()||Ps("terminal.stop.sync",V);o(V,{origin:"shutdown",...ve?{terminalDead:true}:{}});if(!ve)r(V);a(V)}).finally(()=>{if(K!==void 0&&!B())r(K)})};const d=(k,K,j)=>{n.process.exitCode=1;const B=Ps(k,j);o(j,{origin:K,...B?{terminalDead:true}:{}});l({source:k,error:j,terminalDead:B},j)};const h=k=>l({source:"signal",signal:k,terminalDead:false});const m=()=>h("SIGINT");const f=()=>h("SIGTERM");const y=()=>h("SIGHUP");const T=()=>h("SIGBREAK");const b=Boolean(n.suspend&&n.resume&&n.suspendProcess);const v=()=>{if(!b||e||i||s)return;i=true;void Promise.resolve().then(()=>n.suspend?.()).then(()=>{if(e||t)return;s=true;n.process.off("SIGTSTP",v);n.suspendProcess?.()}).catch(k=>d("suspend.failure","suspend",k)).finally(()=>{i=false})};const C=()=>{if(!b||e||!s)return;s=false;n.process.on("SIGTSTP",v);void Promise.resolve().then(()=>n.resume?.()).catch(k=>d("resume.failure","resume",k))};const I=k=>d("uncaughtException","uncaughtException",k);const R=k=>d("unhandledRejection","unhandledRejection",k);const L=(k,K)=>{const j={source:k,error:K,terminalDead:Ps(k,K)};const B=k==="stdout.error"?"stdout":"stderr";o(K,{origin:B,...j.terminalDead?{terminalDead:true}:{}});if(!j.terminalDead){n.process.exitCode=1;l(j,K);return}n.process.exitCode=1;l(j,void 0,true)};const _=k=>L("stdout.error",k);const D=k=>L("stderr.error",k);n.process.on("SIGINT",m);n.process.on("SIGTERM",f);n.process.on("SIGHUP",y);n.process.on("SIGBREAK",T);if(b){n.process.on("SIGTSTP",v);n.process.on("SIGCONT",C)}n.process.on("uncaughtException",I);n.process.on("unhandledRejection",R);n.process.stdout.on("error",_);n.process.stderr.on("error",D);return()=>{if(t)return;t=true;n.process.off("SIGINT",m);n.process.off("SIGTERM",f);n.process.off("SIGHUP",y);n.process.off("SIGBREAK",T);if(b){n.process.off("SIGTSTP",v);n.process.off("SIGCONT",C)}n.process.off("uncaughtException",I);n.process.off("unhandledRejection",R);n.process.stdout.off("error",_);n.process.stderr.off("error",D)}}function E0(n,e){const t=(i,s,r)=>{try{return s()}catch(o){M0(e,{source:i,error:o,terminalDead:Ps(i,o),...r===void 0?{}:{bytes:r}});throw o}};return{get columns(){return n.columns},get rows(){return n.rows},get kittyProtocolActive(){return n.kittyProtocolActive},get outputPending(){return n.outputPending},drainOutput:()=>n.drainOutput?.()??Promise.resolve(),setProgramStatus:i=>n.setProgramStatus?.(i),get focused(){return n.focused},start:(i,s)=>t("terminal.start.sync",()=>n.start(i,s)),stop:()=>t("terminal.stop.sync",()=>n.stop()),drainInput:(i,s)=>n.drainInput(i,s).catch(r=>{const o="terminal.drainInput.async";M0(e,{source:o,error:r,terminalDead:Ps(o,r)});throw r}),write:i=>t("terminal.write.sync",()=>n.write(i),Buffer.byteLength(i,"utf8")),moveBy:i=>t("terminal.moveBy.sync",()=>n.moveBy(i)),hideCursor:()=>t("terminal.hideCursor.sync",()=>n.hideCursor()),showCursor:()=>t("terminal.showCursor.sync",()=>n.showCursor()),clearLine:()=>t("terminal.clearLine.sync",()=>n.clearLine()),clearFromCursor:()=>t("terminal.clearFromCursor.sync",()=>n.clearFromCursor()),clearScreen:()=>t("terminal.clearScreen.sync",()=>n.clearScreen()),setTitle:i=>t("terminal.setTitle.sync",()=>n.setTitle(i)),setProgress:i=>t("terminal.setProgress.sync",()=>n.setProgress(i))}}function M0(n,e){try{n(e)}catch{}}import{executionAsyncId as W4,executionAsyncResource as j4,triggerAsyncId as V4}from"node:async_hooks";var G4=1024;var z4=8192;function P0(n,e){const t=e.asyncContext??{executionAsyncId:W4(),triggerAsyncId:V4(),resource:j4()};return{source:n.source,terminalDead:n.terminalDead,...n.signal?{signal:n.signal}:{},...n.bytes===void 0?{}:{bytes:n.bytes},...n.error===void 0?{}:{error:J4(n.error,e)},runtime:{nodeVersion:process.version,...process.versions.uv?{uvVersion:process.versions.uv}:{},platform:process.platform,arch:process.arch,pid:process.pid},asyncResource:Q4(t),stdout:R0(process.stdout),stderr:R0(process.stderr)}}function Q4(n){const e=cf(n.resource,["owner","_owner"]);const t=cf(n.resource,["stream","_stream"]);const i=cf(n.resource,["handle","_handle"]);return{executionAsyncId:n.executionAsyncId,triggerAsyncId:n.triggerAsyncId,resource:kl(n.resource),...e===void 0?{}:{owner:kl(e)},...t===void 0?{}:{stream:kl(t)},...i===void 0?{}:{handle:kl(i)}}}function kl(n){return{constructorName:_0(n).slice(0,128),identity:n===process.stdout?"stdout":n===process.stderr?"stderr":"other",fd:Y4(n),...X4(n)}}function Y4(n){const e=Rr(n,"fd");return e===1||e===2?e:"other"}function X4(n){const e=Rr(n,"listenerCount");if(typeof e!=="function")return{};try{const t=e.call(n,"error");return typeof t==="number"&&Number.isFinite(t)?{errorListenerCount:Math.max(0,Math.floor(t))}:{}}catch{return{}}}function cf(n,e){for(const t of e){const i=Rr(n,t);if(i!==void 0)return i}return void 0}function J4(n,e){const t=Pl(n,"name")??(n instanceof Error?n.name:void 0);const i=Pl(n,"message")??(typeof n==="string"||typeof n==="number"||typeof n==="boolean"?String(n):void 0);const s=Pl(n,"stack");const r=k0(n,"code");const o=k0(n,"errno");const a=Pl(n,"syscall");return{...t?{name:ma(t,e,256)}:{},...i?{message:ma(i,e,G4)}:{},...r===void 0?{}:{code:A0(r,e)},...o===void 0?{}:{errno:A0(o,e)},...a?{syscall:ma(a,e,256)}:{},...s?{stack:ma(s,e,z4)}:{}}}function A0(n,e){return typeof n==="number"?n:ma(n,e,256)}function R0(n){return{constructorName:_0(n),...Ar(n,"isTTY"),...Ar(n,"writable"),...Ar(n,"destroyed"),...Ar(n,"writableEnded"),...Ar(n,"writableFinished"),...Ar(n,"writableNeedDrain")}}function _0(n){try{if(typeof n!=="object"||n===null)return typeof n;const e=n.constructor?.name;return typeof e==="string"&&e?e:"unknown"}catch{return"unknown"}}function Ar(n,e){const t=Rr(n,e);return typeof t==="boolean"?{[e]:t}:{}}function Pl(n,e){const t=Rr(n,e);return typeof t==="string"?t:void 0}function k0(n,e){const t=Rr(n,e);return typeof t==="string"||typeof t==="number"?t:void 0}function Rr(n,e){try{if(typeof n!=="object"&&typeof n!=="function"||n===null){return void 0}return n[e]}catch{return void 0}}function ma(n,e,t){let i=Fu(n);const s=[{path:e.workspaceDir,label:"[workspace]"},{path:e.homeDirectory,label:"[home]"}].sort((r,o)=>o.path.length-r.path.length);for(const r of s){for(const o of Z4(r.path)){i=i.split(o).join(r.label)}}return i.slice(0,t)}function Z4(n){const e=new Set([n,n.replaceAll("\\","/"),n.replaceAll("/","\\")]);e.delete("");return[...e]}import e_ from"node:path";async function L0(n){try{const{loadConfigFromFile:e}=await import("./src-ED5HBSWE.js");const t=e(e_.join(n,"config.yaml"),{dataDir:n});const i=t.tui;return{...i?.terminalTitle!==void 0?{terminalTitle:i.terminalTitle}:{},...typeof i?.showTips==="boolean"?{showTips:i.showTips}:{},...Array.isArray(i?.statusLine)?{statusLineItems:i.statusLine}:{},...i?.notifications?{notifications:i.notifications}:{},...typeof i?.programStatus==="boolean"?{programStatus:i.programStatus}:{},...i?.customStatusLine?.command?{customStatusLine:i.customStatusLine}:{}}}catch{return{}}}var t_={ctrl:"Ctrl",alt:"Alt",shift:"Shift",super:"Super"};var n_={ctrl:"Ctrl",alt:"Option",shift:"Shift",super:"Command"};var i_={up:"Up",down:"Down",left:"Left",right:"Right"};var O0={escape:"Esc",enter:"Enter",tab:"Tab",space:"Space",backspace:"Backspace",delete:"Delete",home:"Home",end:"End",pageup:"PgUp",pagedown:"PgDn"};var s_={...O0,home:"Fn+Left",end:"Fn+Right",pageup:"Fn+Up",pagedown:"Fn+Down"};function r_(n){if(n==="darwin")return n_;return t_}function o_(n){if(n==="darwin")return s_;return O0}function D0(n,e=process.platform,t=process.env.TERM_PROGRAM){const i=n.toLowerCase().split("+");let s=i.pop()??"";if(s==="/"&&i.includes("ctrl")&&!a_(t)){s="-"}const r=r_(e);return[...i.map(o=>r[o]??o),i_[s]??o_(e)[s]??s.toUpperCase()].join("+")}function a_(n=process.env.TERM_PROGRAM){return n!=="Apple_Terminal"}var u_=/^[a-z0-9][a-z0-9._/-]*$/u;var l_=/^(?:(?:ctrl|shift|alt|super)\+)*(?:[a-z0-9\-/]|escape|enter|tab|space|backspace|delete|home|end|pageUp|pageDown|up|down|left|right)$/u;var Ll=class n{constructor(e=[],t=process.platform,i,s={}){this.platform=t;this.engineKeybindings=i;this.baseOverrides=s;for(const r of e)this.register(r)}platform;engineKeybindings;baseOverrides;bindings=new Map;register(e){f_(e);if(this.bindings.has(e.id)){throw new Error(`Duplicate keybinding id: ${e.id}`)}const t=[...this.bindings.values()].find(i=>_l(i.key)===_l(e.key)&&N0(i.when,e.when));if(t){throw new Error(`Keybinding conflict: ${e.key} is already registered for ${t.id}`)}this.bindings.set(e.id,e)}resolve(e,t){if(un(e))return void 0;return[...this.bindings.values()].find(i=>this.matches(e,i)&&g_(i.when,t)&&!(i.action==="restore-draft"&&t.hasRestorableDraft!==true)&&!(i.action==="toggle-side-session"&&t.hasRestorableDraft===true&&e==="")&&!(i.action==="restore-waiting"&&t.hasWaitingMessage!==true))?.action}list(){return[...this.bindings.values()].map(e=>this.effective(e))}get(e){const t=this.bindings.get(e);return t?this.effective(t):void 0}keys(e){const t=this.bindings.get(e);if(t){return this.engineKeybindings?.getKeys(e)??[t.key]}return Object.hasOwn(mr,e)?(this.engineKeybindings??te()).getKeys(e):[]}findConflicts(e){const t=[...this.bindings.values()].map(s=>({definition:s,keys:this.keysForOverrides(s.id,e)}));const i=[];for(let s=0;s<t.length;s+=1){const r=t[s];if(!r)continue;for(let o=s+1;o<t.length;o+=1){const a=t[o];if(!a)continue;if(!N0(r.definition.when,a.definition.when))continue;for(const u of r.keys){if(!a.keys.some(l=>_l(l)===_l(u)))continue;i.push({key:u,ids:[r.definition.id,a.definition.id]})}}}return i}format(e){return D0(e,this.platform)}help(e=true){return this.list().filter(t=>t.description&&t.helpOrder!==void 0&&(e||!t.queueOnly)).sort((t,i)=>(t.helpOrder??0)-(i.helpOrder??0))}helpRows(e=true){const t=new Map;for(const i of this.help(e)){const s=i.helpGroup??i.id;const r=t.get(s);if(r){r.ids.push(i.id);r.keys.push(...this.keys(i.id).map(o=>this.format(o)));r.order=Math.min(r.order,i.helpOrder??0);continue}t.set(s,{ids:[i.id],keys:this.keys(i.id).map(o=>this.format(o)),description:i.description??"",order:i.helpOrder??0})}return[...t.values()].sort((i,s)=>i.order-s.order).map(i=>({ids:i.ids,keys:i.keys.length>0?i.keys.join(" / "):"Unbound",description:i.description}))}withOverrides(e){const t=this.list().map(i=>{if(!(i.id in e))return i;const s=e[i.id];const r=Array.isArray(s)?s[0]:s;if(!r)return i;return{...i,key:r}});for(const i of Object.keys(e)){if(!this.bindings.has(i))throw new Error(`Unknown keybinding id: ${i}`)}return new n(t,this.platform)}matches(e,t){return this.engineKeybindings?.matches(e,t.id)??S(e,t.key)}effective(e){const t=this.keys(e.id)[0];return t&&t!==e.key?{...e,key:t}:e}keysForOverrides(e,t){const i=t[e];if(i!==void 0)return Array.isArray(i)?[...i]:[i];const s=this.baseOverrides[e];if(s!==void 0)return Array.isArray(s)?[...s]:[s];const r=this.bindings.get(e);return r?[r.key]:[]}};function _l(n){const e=n.toLocaleLowerCase().split("+");const t=e.pop()??"";return`${e.sort().join("+")}+${t}`}var F0=[{id:"app.clear",key:"ctrl+c",action:"clear",when:"composer",description:"Interrupt the active turn; when idle, clear the Composer (twice to exit)",helpOrder:120},{id:"app.interrupt",key:"escape",action:"interrupt",when:"composer",description:"Close the current panel, or interrupt the active turn",helpOrder:110},{id:"app.exit",key:"ctrl+d",action:"exit",when:"composer",description:"Exit immediately (the draft survives shutdown recovery)",helpOrder:121},{id:"app.suspend",key:"ctrl+z",action:"suspend",when:"application",description:"Suspend MCode and return to the shell",helpOrder:122},{id:"app.toggle-side-session",key:"ctrl+/",action:"toggle-side-session",when:"application",description:"Toggle between the parent and temporary side conversation",helpOrder:123},{id:"welcome.resume-codex",key:"ctrl+u",action:"resume-codex",when:"idle"},{id:"composer.paste-image",key:"ctrl+v",action:"paste-image",when:"composer",description:"Paste an image or copied video file from the clipboard",helpOrder:70},{id:"composer.paste-image-windows",key:"alt+v",action:"paste-image",when:"composer"},{id:"composer.paste-image-macos",key:"super+v",action:"paste-image",when:"composer",description:"Paste an image or copied video file from the clipboard",helpOrder:70},{id:"composer.external-editor",key:"ctrl+g",action:"open-external-editor",when:"composer",description:"Search prompt history / edit in an external editor",helpOrder:50,helpGroup:"composer.prompt-tools"},{id:"composer.search-history",key:"ctrl+r",action:"search-history",when:"composer",description:"Search prompt history / edit in an external editor",helpOrder:40,helpGroup:"composer.prompt-tools"},{id:"run.submit-guidance",key:"enter",action:"submit-guidance",when:"live-run",description:"Guide the current response with the current Draft",helpOrder:90},{id:"run.queue-draft",key:"alt+enter",action:"queue-draft",when:"live-run",description:"Queue the current Draft for the next turn",helpOrder:91,queueOnly:true},{id:"run.restore-waiting-option",key:"alt+up",action:"restore-waiting",when:"live-run",description:"Move the latest queued message back to the Composer",helpOrder:92,helpGroup:"run.restore-waiting",queueOnly:true},{id:"run.restore-waiting-shift-left",key:"shift+left",action:"restore-waiting",when:"live-run",description:"Move the latest queued message back to the Composer",helpOrder:92,helpGroup:"run.restore-waiting",queueOnly:true},{id:"composer.toggle-tasks",key:"ctrl+t",action:"toggle-tasks",when:"composer",description:"Show or hide the full Todo list",helpOrder:25},{id:"composer.toggle-details",key:"ctrl+o",action:"toggle-details",when:"composer",description:"Show or hide Thinking, Tool output, and diffs",helpOrder:20},{id:"interaction.view-plan",key:"ctrl+o",action:"view-plan",when:"interaction",description:"Show or hide the full Plan during Plan Review",helpOrder:82},{id:"composer.toggle-plan",key:"shift+tab",action:"toggle-plan",when:"composer",description:"Plan Mode: Default or Plan",helpOrder:10},{id:"composer.cycle-permission",key:"alt+m",action:"cycle-permission",when:"composer",description:"Permission mode: Ask, Auto, Full access",helpOrder:11},{id:"composer.restore-draft",key:"ctrl+-",action:"restore-draft",when:"composer",description:"Undo the last Draft clear",helpOrder:60},{id:"interaction.scroll-up",key:"pageUp",action:"scroll-up",when:"interaction",description:"Scroll the current interaction",helpOrder:80,helpGroup:"interaction.navigation"},{id:"interaction.scroll-down",key:"pageDown",action:"scroll-down",when:"interaction",description:"Scroll the current interaction",helpOrder:81,helpGroup:"interaction.navigation"}];function d_(){return new Ll(F0)}function c_(n){const e="composer.paste-media";const t=n.platform==="win32"||n.windowsClipboardInterop===true;const i=F0.flatMap(s=>{if(s.id==="app.suspend"&&!n.suspendSupported)return[];if(s.id==="composer.paste-image-windows"&&!t)return[];if(s.id==="composer.paste-image-macos"&&n.platform!=="darwin")return[];if(s.id==="composer.restore-draft"&&n.platform==="win32"){return[{...s,key:"ctrl+z"}]}if(s.id==="composer.paste-image"&&(t||n.platform==="darwin")){return[{...s,...t?{key:"alt+v"}:{},helpGroup:e}]}if(s.id==="composer.paste-image-windows"){return[{...s,key:"ctrl+v",description:"Paste an image or copied video file from the clipboard",helpOrder:70,helpGroup:e}]}if(s.id==="composer.paste-image-macos"){return[{...s,description:"Paste an image or copied video file from the clipboard",helpOrder:70,helpGroup:e}]}return[s]});return i}function $0(n){const e=c_(n);const t=h_(n.platform);const i=new pr({...mr,...p_(e)},{...t,...n.userOverrides??{}});return{manager:i,registry:new Ll(e,n.platform,i,t),hostOverrides:t}}function h_(n){return{"tui.altScreen.previousPrompt":["ctrl+shift+up","ctrl+up"],"tui.altScreen.nextPrompt":["ctrl+shift+down","ctrl+down"],...n==="win32"?{"tui.editor.undo":["ctrl+-","ctrl+z"]}:{}}}function p_(n){return Object.fromEntries(n.map(e=>[e.id,{defaultKeys:e.key,description:e.description}]))}var hf=d_();function ri(){return hf}function Te(n,e=hf){if(!Object.hasOwn(mr,n))m_(n,e);const t=e.keys(n);return t.length>0?t.map(i=>e.format(i)).join(" / "):"Unbound"}function m_(n,e=hf){const t=e.get(n);if(!t)throw new Error(`Unknown keybinding id: ${n}`);return t}function f_(n){if(!u_.test(n.id)){throw new Error(`Invalid keybinding id: ${n.id}`)}if(!l_.test(n.key)){throw new Error(`Invalid keybinding key: ${n.key}`)}}function g_(n,e){if(n==="application")return true;if(n==="interaction")return e.interactionActive;if(e.interactionActive)return false;if(n==="composer")return true;if(n==="idle")return!e.hasLiveRun;if(n==="waiting")return e.hasWaitingMessage===true;return e.hasLiveRun}function N0(n,e){if(n==="application"||e==="application")return true;if(n==="interaction"||e==="interaction")return n===e;if(n==="composer"||e==="composer")return true;if(n===e)return true;if(n==="waiting"||e==="waiting")return true;return false}import{mkdirSync as y_,readFileSync as T_,renameSync as b_,unlinkSync as v_,writeFileSync as S_}from"node:fs";import pf from"node:path";var C_="tui";var B0="keybindings.json";function q0(n){return pf.join(n,C_,B0)}function mf(n){const e=q0(n);try{const t=JSON.parse(T_(e,"utf8").replace(/^\uFEFF/u,""));if(!t||typeof t!=="object"||Array.isArray(t)){throw new Error("keybindings must be a JSON object")}const i={};for(const[s,r]of Object.entries(t)){if(typeof r==="string"){i[s]=r}else if(Array.isArray(r)&&r.every(o=>typeof o==="string")){i[s]=r}else if(r!==null){throw new Error(`binding "${s}" must be a string or an array of strings`)}}return{path:e,overrides:i}}catch(t){if(w_(t))return{path:e,overrides:{}};return{path:e,overrides:{},error:t instanceof Error?t.message:String(t)}}}function H0(n,e){const t=q0(n);const i=pf.dirname(t);y_(i,{recursive:true,mode:448});const s=pf.join(i,`.${B0}.${process.pid}.${Date.now()}.tmp`);const r=`${JSON.stringify(x_(e),null,2)}
|
|
70
|
+
`;si.mkdirSync(Rs.dirname(re),{recursive:true});si.appendFileSync(re,ee)};const L=($=0)=>{for(let Q=$;Q<o;Q++){const re=this.previousLines[Q]??"";const ee=m[Q]??"";if(re!==ee&&oe(re)!==oe(ee))return Q}return-1};const _=($,Q,re)=>{const ee=!u;if(I){const de=re<0?"":` row=${re} old=${b0(this.previousLines[re]??"")} new=${b0(m[re]??"")}`;R($,` deferred=${ee?"yes":"no"}${de}`)}if(!ee){C(true);return}this.deferHistoryReplay();C(true,true,Q||m.length<=o)};if(this.historyReplayPending){const $=this.resizeTimer!==void 0;C(true,$);if(!$){this.historyReplayPending=false;this.historyReplayDeferred=false}return}if(l){R("deferred history replay after user input");this.historyReplayDeferred=false;C(true);return}if(this.previousLines.length===0&&!i&&!s){R("first render");C(false);return}if(i){R(`terminal width changed (${this.previousWidth} -> ${e})`);C(true);return}if(s&&!df()){R(`terminal height changed (${this.previousHeight} -> ${t})`);C(true);return}if(Math.max(0,m.length-t)<o){_("document shrink reveals scrolled rows",true,I?L():-1);return}if(this.getClearOnShrink()&&m.length<this.maxLinesRendered&&!this.hasOverlayEntries){R(`clearOnShrink (maxLinesRendered=${this.maxLinesRendered})`);C(true,true);return}let D=-1;let k=-1;const K=Math.max(m.length,this.previousLines.length);for(let $=0;$<K;$++){const Q=$<this.previousLines.length?this.previousLines[$]:"";const re=$<m.length?m[$]:"";if(Q!==re){if(D===-1){D=$}k=$}}const j=m.length>this.previousLines.length;if(j){if(D===-1){D=this.previousLines.length}k=m.length-1}if(D!==-1){const $=this.expandChangedRangeForKittyImages(D,k,m);D=$.firstChanged;k=$.lastChanged}const B=j&&D===this.previousLines.length&&D>0;if(D===-1){this.positionHardwareCursor(v,m.length);this.previousViewportTop=o;this.previousHeight=t;return}if(D>=m.length){if(this.previousLines.length>m.length){const $=new pa(it=>this.terminal.write(it));$.append("\x1B[?2026h");$.append(this.deleteChangedKittyImages(D,k));const Q=Math.max(0,m.length-1);if(Q<o){R(`deleted lines moved viewport up (${Q} < ${o})`);C(true,true);return}const re=h(Q);if(re>0)$.append(`\x1B[${re}B`);else if(re<0)$.append(`\x1B[${-re}A`);$.append("\r");const ee=this.previousLines.length-m.length;if(ee>t){R(`extraLines > height (${ee} > ${t})`);C(true,true);return}const de=m.length===0?0:1;if(ee>0&&de>0){$.append(`\x1B[${de}B`)}for(let it=0;it<ee;it++){$.append("\r\x1B[2K");if(it<ee-1)$.append("\x1B[1B")}const Ae=Math.max(0,ee-1+de);if(Ae>0){$.append(`\x1B[${Ae}A`)}this.cursorRow=Q;this.hardwareCursorRow=Q;this.positionHardwareCursor(v,m.length,$);$.append("\x1B[?2026l");$.flush();this.frameChangedLines=ee}this.previousLines=m;this.previousKittyImageIds=this.collectKittyImageIds(m);this.previousWidth=e;this.previousHeight=t;this.previousViewportTop=o;return}if(D<o){const $=`firstChanged < viewportTop (${D} < ${o})`;const Q=L(D);if(Q>=0){_($,false,Q);return}R($," style-only");C(true,true);return}const V=new pa($=>this.terminal.write($));V.append("\x1B[?2026h");V.append(this.deleteChangedKittyImages(D,k));const ve=o+t-1;const Me=B?D-1:D;if(Me>ve){const $=Math.max(0,Math.min(t-1,d-o));const Q=t-1-$;if(Q>0){V.append(`\x1B[${Q}B`)}const re=Me-ve;V.append("\r\n".repeat(re));o+=re;a+=re;d=Me}const nt=h(Me);if(nt>0){V.append(`\x1B[${nt}B`)}else if(nt<0){V.append(`\x1B[${-nt}A`)}V.append(B?"\r\n":"\r");const Tt=Math.min(k,m.length-1);for(let $=D;$<=Tt;$++){if($>D)V.append("\r\n");const Q=m[$];const re=Le(Q);const ee=re?this.getKittyImageReservedRows(m,$,Tt):1;if(ee>1){const de=$-a;if(de<0||de+ee>t){R(`kitty image pre-clear would scroll (${de} + ${ee} > ${t})`);C(true);return}V.append("\x1B[2K");for(let Ae=1;Ae<ee;Ae++){V.append("\r\n\x1B[2K")}V.append(`\x1B[${ee-1}A`);V.append(Q);V.append(`\x1B[${ee-1}B`);$+=ee-1;continue}V.append("\x1B[2K");if(!re&&w(Q)>e){const de=Rs.join(this.logDirectory??v0.tmpdir(),"pi-tui-crash.log");const Ae=[`Crash at ${new Date().toISOString()}`,`Terminal width: ${e}`,`Line ${$} visible width: ${w(Q)}`,"","=== All rendered lines ===",...m.map((nn,It)=>`[${It}] (w=${w(nn)}) ${nn}`),""].join("\n");si.mkdirSync(Rs.dirname(de),{recursive:true});si.writeFileSync(de,Ae);this.stop();const it=[`Rendered line ${$} exceeds terminal width (${w(Q)} > ${e}).`,"","This is likely caused by a custom TUI component not truncating its output.","Use visibleWidth() to measure and truncateToWidth() to truncate lines.","",`Debug log written to: ${de}`].join("\n");throw new Error(it)}V.append(Q)}let Ne=Tt;if(this.previousLines.length>m.length){if(Tt<m.length-1){const Q=m.length-1-Tt;V.append(`\x1B[${Q}B`);Ne=m.length-1}const $=this.previousLines.length-m.length;for(let Q=m.length;Q<this.previousLines.length;Q++){V.append("\r\n\x1B[2K")}V.append(`\x1B[${$}A`)}if(process.env.PI_TUI_DEBUG==="1"){const $="/tmp/tui";si.mkdirSync($,{recursive:true});const Q=Rs.join($,`render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);const re=[`firstChanged: ${D}`,`viewportTop: ${a}`,`cursorRow: ${this.cursorRow}`,`height: ${t}`,`lineDiff: ${nt}`,`hardwareCursorRow: ${d}`,`renderEnd: ${Tt}`,`finalCursorRow: ${Ne}`,`cursorPos: ${JSON.stringify(v)}`,`newLines.length: ${m.length}`,`previousLines.length: ${this.previousLines.length}`,"","=== newLines ===",JSON.stringify(m,null,2),"","=== previousLines ===",JSON.stringify(this.previousLines,null,2),"","=== buffer ===",`[${V.length} chars written in bounded chunks]`].join("\n");si.writeFileSync(Q,re)}this.cursorRow=Math.max(0,m.length-1);this.hardwareCursorRow=Ne;this.maxLinesRendered=Math.max(this.maxLinesRendered,m.length);this.previousViewportTop=Math.max(o,Ne-t+1);this.positionHardwareCursor(v,m.length,V);V.append("\x1B[?2026l");V.flush();this.frameChangedLines=Ne-D+1+Math.max(0,this.previousLines.length-m.length);this.previousLines=m;this.previousKittyImageIds=this.collectKittyImageIds(m);this.previousWidth=e;this.previousHeight=t}positionHardwareCursor(e,t,i){if(!e||t<=0){if(i)i.append("\x1B[?25l");else this.terminal.hideCursor();return}const s=Math.max(0,Math.min(e.row,t-1));const r=Math.max(0,e.col);const o=s-this.hardwareCursorRow;let a="";if(o>0){a+=`\x1B[${o}B`}else if(o<0){a+=`\x1B[${-o}A`}a+=`\x1B[${r+1}G`;if(a){if(i)i.append(a);else this.terminal.write(a)}this.hardwareCursorRow=s;if(i){i.append(this.getShowHardwareCursor()?"\x1B[?25h":"\x1B[?25l")}else if(this.getShowHardwareCursor()){this.terminal.showCursor()}else{this.terminal.hideCursor()}}};import{closeSync as L4,mkdirSync as O4,openSync as D4,writeSync as N4}from"node:fs";import{join as C0}from"node:path";function x0(n,e={}){const t=e.force===true||process.stderr.isTTY===true;if(!t)return{logFile:void 0,restore:()=>{}};const i=C0(n,"v2","observability","logs");const s=C0(i,`tui-stderr-${process.pid}.log`);let r;try{O4(i,{recursive:true});r=D4(s,"a")}catch{return{logFile:void 0,restore:()=>{}}}const o=process.stderr.write.bind(process.stderr);let a=false;process.stderr.write=((u,l,d)=>{try{const h=typeof u==="string"?Buffer.from(u):Buffer.from(u);N4(r,h)}catch{}if(typeof l==="function")l();else if(typeof d==="function")d();return true});return{logFile:s,restore:()=>{if(a)return;a=true;process.stderr.write=o;try{L4(r)}catch{}}}}function Rl(n){const e=B4(n.env);const t=q4(n.env);const i=F4(n.env);const s=n.isTTY&&n.env.TERM!=="dumb";const r=$4(n,s);return Object.freeze({terminalId:e,platform:n.platform,isTTY:n.isTTY,transport:i,multiplexer:t,color:r>0,colorLevel:r})}function F4(n){return w0(n)?"ssh":"local"}function Er(){return Rl({platform:process.platform,isTTY:Boolean(process.stdin.isTTY&&process.stdout.isTTY),env:process.env,colorDepth:process.stdout.getColorDepth?.(process.env)})}function $4(n,e){if(!e||n.env.NO_COLOR!==void 0||n.env.FORCE_COLOR==="0")return 0;if(n.env.FORCE_COLOR!==void 0){const s=Number.parseInt(n.env.FORCE_COLOR,10);if(Number.isInteger(s))return Math.max(1,Math.min(3,s));return 1}if((n.colorDepth??0)>=24)return 3;if((n.colorDepth??0)>=8)return 2;if((n.colorDepth??0)>=4)return 1;const t=n.env.COLORTERM?.toLocaleLowerCase();if(t==="truecolor"||t==="24bit")return 3;const i=n.env.TERM?.toLocaleLowerCase()??"";if(i.includes("truecolor")||i.includes("24bit"))return 3;if(i.includes("256color"))return 2;return 1}function B4(n){if(n.CMUX_SOCKET_PATH||n.TERM_PROGRAM?.toLowerCase()==="cmux")return"cmux";if(n.WT_SESSION&&!w0(n))return"windows-terminal";const e=n.TERM_PROGRAM?.toLocaleLowerCase();if(e==="apple_terminal")return"apple-terminal";if(e==="ghostty")return"ghostty";if(e==="iterm.app")return"iterm2";if(e==="vscode")return"vscode";if(e==="wezterm")return"wezterm";if(e==="warpterminal")return"warp";const t=n.TERM?.toLocaleLowerCase()??"";if(t.includes("ghostty"))return"ghostty";if(t.includes("kitty")||n.KITTY_WINDOW_ID)return"kitty";if(t.includes("wezterm"))return"wezterm";return"unknown"}function q4(n){if(n.TMUX)return"tmux";const e=n.TERM?.toLocaleLowerCase()??"";if(e.startsWith("tmux"))return"tmux";return e.startsWith("screen")?"screen":"none"}function w0(n){return Boolean(n.SSH_CONNECTION||n.SSH_CLIENT||n.SSH_TTY)}var H4=new Set(["EIO","EPIPE","ENOTCONN","EOF"]);function Ps(n,e){return K4(n)&&U4(e)}function U4(n){return typeof n==="object"&&n!==null&&"code"in n&&typeof n.code==="string"&&H4.has(n.code)}function K4(n){return n==="stdout.error"||n==="stderr.error"||n.startsWith("terminal.")}function I0(n){let e=false;let t=false;let i=false;let s=false;const r=k=>{try{n.report(k)}catch{}};const o=(k,K)=>{try{n.capture?.(k,K)}catch{}};const a=k=>{try{n.onStopFailure?.(k)}catch{}};const u=k=>{try{n.onStopCause?.(k)}catch{}};const l=(k,K,j=false)=>{if(e)return;e=true;u(k);const B=()=>j||k.terminalDead||n.isTerminalDead?.()===true;void Promise.resolve().then(()=>n.stop()).catch(V=>{n.process.exitCode=1;const ve=B()||Ps("terminal.stop.sync",V);o(V,{origin:"shutdown",...ve?{terminalDead:true}:{}});if(!ve)r(V);a(V)}).finally(()=>{if(K!==void 0&&!B())r(K)})};const d=(k,K,j)=>{n.process.exitCode=1;const B=Ps(k,j);o(j,{origin:K,...B?{terminalDead:true}:{}});l({source:k,error:j,terminalDead:B},j)};const h=k=>l({source:"signal",signal:k,terminalDead:false});const m=()=>h("SIGINT");const f=()=>h("SIGTERM");const y=()=>h("SIGHUP");const T=()=>h("SIGBREAK");const b=Boolean(n.suspend&&n.resume&&n.suspendProcess);const v=()=>{if(!b||e||i||s)return;i=true;void Promise.resolve().then(()=>n.suspend?.()).then(()=>{if(e||t)return;s=true;n.process.off("SIGTSTP",v);n.suspendProcess?.()}).catch(k=>d("suspend.failure","suspend",k)).finally(()=>{i=false})};const C=()=>{if(!b||e||!s)return;s=false;n.process.on("SIGTSTP",v);void Promise.resolve().then(()=>n.resume?.()).catch(k=>d("resume.failure","resume",k))};const I=k=>d("uncaughtException","uncaughtException",k);const R=k=>d("unhandledRejection","unhandledRejection",k);const L=(k,K)=>{const j={source:k,error:K,terminalDead:Ps(k,K)};const B=k==="stdout.error"?"stdout":"stderr";o(K,{origin:B,...j.terminalDead?{terminalDead:true}:{}});if(!j.terminalDead){n.process.exitCode=1;l(j,K);return}n.process.exitCode=1;l(j,void 0,true)};const _=k=>L("stdout.error",k);const D=k=>L("stderr.error",k);n.process.on("SIGINT",m);n.process.on("SIGTERM",f);n.process.on("SIGHUP",y);n.process.on("SIGBREAK",T);if(b){n.process.on("SIGTSTP",v);n.process.on("SIGCONT",C)}n.process.on("uncaughtException",I);n.process.on("unhandledRejection",R);n.process.stdout.on("error",_);n.process.stderr.on("error",D);return()=>{if(t)return;t=true;n.process.off("SIGINT",m);n.process.off("SIGTERM",f);n.process.off("SIGHUP",y);n.process.off("SIGBREAK",T);if(b){n.process.off("SIGTSTP",v);n.process.off("SIGCONT",C)}n.process.off("uncaughtException",I);n.process.off("unhandledRejection",R);n.process.stdout.off("error",_);n.process.stderr.off("error",D)}}function E0(n,e){const t=(i,s,r)=>{try{return s()}catch(o){M0(e,{source:i,error:o,terminalDead:Ps(i,o),...r===void 0?{}:{bytes:r}});throw o}};return{get columns(){return n.columns},get rows(){return n.rows},get kittyProtocolActive(){return n.kittyProtocolActive},get outputPending(){return n.outputPending},drainOutput:()=>n.drainOutput?.()??Promise.resolve(),setProgramStatus:i=>n.setProgramStatus?.(i),get focused(){return n.focused},start:(i,s)=>t("terminal.start.sync",()=>n.start(i,s)),stop:()=>t("terminal.stop.sync",()=>n.stop()),drainInput:(i,s)=>n.drainInput(i,s).catch(r=>{const o="terminal.drainInput.async";M0(e,{source:o,error:r,terminalDead:Ps(o,r)});throw r}),write:i=>t("terminal.write.sync",()=>n.write(i),Buffer.byteLength(i,"utf8")),moveBy:i=>t("terminal.moveBy.sync",()=>n.moveBy(i)),hideCursor:()=>t("terminal.hideCursor.sync",()=>n.hideCursor()),showCursor:()=>t("terminal.showCursor.sync",()=>n.showCursor()),clearLine:()=>t("terminal.clearLine.sync",()=>n.clearLine()),clearFromCursor:()=>t("terminal.clearFromCursor.sync",()=>n.clearFromCursor()),clearScreen:()=>t("terminal.clearScreen.sync",()=>n.clearScreen()),setTitle:i=>t("terminal.setTitle.sync",()=>n.setTitle(i)),setProgress:i=>t("terminal.setProgress.sync",()=>n.setProgress(i))}}function M0(n,e){try{n(e)}catch{}}import{executionAsyncId as W4,executionAsyncResource as j4,triggerAsyncId as V4}from"node:async_hooks";var G4=1024;var z4=8192;function P0(n,e){const t=e.asyncContext??{executionAsyncId:W4(),triggerAsyncId:V4(),resource:j4()};return{source:n.source,terminalDead:n.terminalDead,...n.signal?{signal:n.signal}:{},...n.bytes===void 0?{}:{bytes:n.bytes},...n.error===void 0?{}:{error:J4(n.error,e)},runtime:{nodeVersion:process.version,...process.versions.uv?{uvVersion:process.versions.uv}:{},platform:process.platform,arch:process.arch,pid:process.pid},asyncResource:Q4(t),stdout:R0(process.stdout),stderr:R0(process.stderr)}}function Q4(n){const e=cf(n.resource,["owner","_owner"]);const t=cf(n.resource,["stream","_stream"]);const i=cf(n.resource,["handle","_handle"]);return{executionAsyncId:n.executionAsyncId,triggerAsyncId:n.triggerAsyncId,resource:kl(n.resource),...e===void 0?{}:{owner:kl(e)},...t===void 0?{}:{stream:kl(t)},...i===void 0?{}:{handle:kl(i)}}}function kl(n){return{constructorName:_0(n).slice(0,128),identity:n===process.stdout?"stdout":n===process.stderr?"stderr":"other",fd:Y4(n),...X4(n)}}function Y4(n){const e=Rr(n,"fd");return e===1||e===2?e:"other"}function X4(n){const e=Rr(n,"listenerCount");if(typeof e!=="function")return{};try{const t=e.call(n,"error");return typeof t==="number"&&Number.isFinite(t)?{errorListenerCount:Math.max(0,Math.floor(t))}:{}}catch{return{}}}function cf(n,e){for(const t of e){const i=Rr(n,t);if(i!==void 0)return i}return void 0}function J4(n,e){const t=Pl(n,"name")??(n instanceof Error?n.name:void 0);const i=Pl(n,"message")??(typeof n==="string"||typeof n==="number"||typeof n==="boolean"?String(n):void 0);const s=Pl(n,"stack");const r=k0(n,"code");const o=k0(n,"errno");const a=Pl(n,"syscall");return{...t?{name:ma(t,e,256)}:{},...i?{message:ma(i,e,G4)}:{},...r===void 0?{}:{code:A0(r,e)},...o===void 0?{}:{errno:A0(o,e)},...a?{syscall:ma(a,e,256)}:{},...s?{stack:ma(s,e,z4)}:{}}}function A0(n,e){return typeof n==="number"?n:ma(n,e,256)}function R0(n){return{constructorName:_0(n),...Ar(n,"isTTY"),...Ar(n,"writable"),...Ar(n,"destroyed"),...Ar(n,"writableEnded"),...Ar(n,"writableFinished"),...Ar(n,"writableNeedDrain")}}function _0(n){try{if(typeof n!=="object"||n===null)return typeof n;const e=n.constructor?.name;return typeof e==="string"&&e?e:"unknown"}catch{return"unknown"}}function Ar(n,e){const t=Rr(n,e);return typeof t==="boolean"?{[e]:t}:{}}function Pl(n,e){const t=Rr(n,e);return typeof t==="string"?t:void 0}function k0(n,e){const t=Rr(n,e);return typeof t==="string"||typeof t==="number"?t:void 0}function Rr(n,e){try{if(typeof n!=="object"&&typeof n!=="function"||n===null){return void 0}return n[e]}catch{return void 0}}function ma(n,e,t){let i=Fu(n);const s=[{path:e.workspaceDir,label:"[workspace]"},{path:e.homeDirectory,label:"[home]"}].sort((r,o)=>o.path.length-r.path.length);for(const r of s){for(const o of Z4(r.path)){i=i.split(o).join(r.label)}}return i.slice(0,t)}function Z4(n){const e=new Set([n,n.replaceAll("\\","/"),n.replaceAll("/","\\")]);e.delete("");return[...e]}import e_ from"node:path";async function L0(n){try{const{loadConfigFromFile:e}=await import("./src-7ZMHMWLX.js");const t=e(e_.join(n,"config.yaml"),{dataDir:n});const i=t.tui;return{...i?.terminalTitle!==void 0?{terminalTitle:i.terminalTitle}:{},...typeof i?.showTips==="boolean"?{showTips:i.showTips}:{},...Array.isArray(i?.statusLine)?{statusLineItems:i.statusLine}:{},...i?.notifications?{notifications:i.notifications}:{},...typeof i?.programStatus==="boolean"?{programStatus:i.programStatus}:{},...i?.customStatusLine?.command?{customStatusLine:i.customStatusLine}:{}}}catch{return{}}}var t_={ctrl:"Ctrl",alt:"Alt",shift:"Shift",super:"Super"};var n_={ctrl:"Ctrl",alt:"Option",shift:"Shift",super:"Command"};var i_={up:"Up",down:"Down",left:"Left",right:"Right"};var O0={escape:"Esc",enter:"Enter",tab:"Tab",space:"Space",backspace:"Backspace",delete:"Delete",home:"Home",end:"End",pageup:"PgUp",pagedown:"PgDn"};var s_={...O0,home:"Fn+Left",end:"Fn+Right",pageup:"Fn+Up",pagedown:"Fn+Down"};function r_(n){if(n==="darwin")return n_;return t_}function o_(n){if(n==="darwin")return s_;return O0}function D0(n,e=process.platform,t=process.env.TERM_PROGRAM){const i=n.toLowerCase().split("+");let s=i.pop()??"";if(s==="/"&&i.includes("ctrl")&&!a_(t)){s="-"}const r=r_(e);return[...i.map(o=>r[o]??o),i_[s]??o_(e)[s]??s.toUpperCase()].join("+")}function a_(n=process.env.TERM_PROGRAM){return n!=="Apple_Terminal"}var u_=/^[a-z0-9][a-z0-9._/-]*$/u;var l_=/^(?:(?:ctrl|shift|alt|super)\+)*(?:[a-z0-9\-/]|escape|enter|tab|space|backspace|delete|home|end|pageUp|pageDown|up|down|left|right)$/u;var Ll=class n{constructor(e=[],t=process.platform,i,s={}){this.platform=t;this.engineKeybindings=i;this.baseOverrides=s;for(const r of e)this.register(r)}platform;engineKeybindings;baseOverrides;bindings=new Map;register(e){f_(e);if(this.bindings.has(e.id)){throw new Error(`Duplicate keybinding id: ${e.id}`)}const t=[...this.bindings.values()].find(i=>_l(i.key)===_l(e.key)&&N0(i.when,e.when));if(t){throw new Error(`Keybinding conflict: ${e.key} is already registered for ${t.id}`)}this.bindings.set(e.id,e)}resolve(e,t){if(un(e))return void 0;return[...this.bindings.values()].find(i=>this.matches(e,i)&&g_(i.when,t)&&!(i.action==="restore-draft"&&t.hasRestorableDraft!==true)&&!(i.action==="toggle-side-session"&&t.hasRestorableDraft===true&&e==="")&&!(i.action==="restore-waiting"&&t.hasWaitingMessage!==true))?.action}list(){return[...this.bindings.values()].map(e=>this.effective(e))}get(e){const t=this.bindings.get(e);return t?this.effective(t):void 0}keys(e){const t=this.bindings.get(e);if(t){return this.engineKeybindings?.getKeys(e)??[t.key]}return Object.hasOwn(mr,e)?(this.engineKeybindings??te()).getKeys(e):[]}findConflicts(e){const t=[...this.bindings.values()].map(s=>({definition:s,keys:this.keysForOverrides(s.id,e)}));const i=[];for(let s=0;s<t.length;s+=1){const r=t[s];if(!r)continue;for(let o=s+1;o<t.length;o+=1){const a=t[o];if(!a)continue;if(!N0(r.definition.when,a.definition.when))continue;for(const u of r.keys){if(!a.keys.some(l=>_l(l)===_l(u)))continue;i.push({key:u,ids:[r.definition.id,a.definition.id]})}}}return i}format(e){return D0(e,this.platform)}help(e=true){return this.list().filter(t=>t.description&&t.helpOrder!==void 0&&(e||!t.queueOnly)).sort((t,i)=>(t.helpOrder??0)-(i.helpOrder??0))}helpRows(e=true){const t=new Map;for(const i of this.help(e)){const s=i.helpGroup??i.id;const r=t.get(s);if(r){r.ids.push(i.id);r.keys.push(...this.keys(i.id).map(o=>this.format(o)));r.order=Math.min(r.order,i.helpOrder??0);continue}t.set(s,{ids:[i.id],keys:this.keys(i.id).map(o=>this.format(o)),description:i.description??"",order:i.helpOrder??0})}return[...t.values()].sort((i,s)=>i.order-s.order).map(i=>({ids:i.ids,keys:i.keys.length>0?i.keys.join(" / "):"Unbound",description:i.description}))}withOverrides(e){const t=this.list().map(i=>{if(!(i.id in e))return i;const s=e[i.id];const r=Array.isArray(s)?s[0]:s;if(!r)return i;return{...i,key:r}});for(const i of Object.keys(e)){if(!this.bindings.has(i))throw new Error(`Unknown keybinding id: ${i}`)}return new n(t,this.platform)}matches(e,t){return this.engineKeybindings?.matches(e,t.id)??S(e,t.key)}effective(e){const t=this.keys(e.id)[0];return t&&t!==e.key?{...e,key:t}:e}keysForOverrides(e,t){const i=t[e];if(i!==void 0)return Array.isArray(i)?[...i]:[i];const s=this.baseOverrides[e];if(s!==void 0)return Array.isArray(s)?[...s]:[s];const r=this.bindings.get(e);return r?[r.key]:[]}};function _l(n){const e=n.toLocaleLowerCase().split("+");const t=e.pop()??"";return`${e.sort().join("+")}+${t}`}var F0=[{id:"app.clear",key:"ctrl+c",action:"clear",when:"composer",description:"Interrupt the active turn; when idle, clear the Composer (twice to exit)",helpOrder:120},{id:"app.interrupt",key:"escape",action:"interrupt",when:"composer",description:"Close the current panel, or interrupt the active turn",helpOrder:110},{id:"app.exit",key:"ctrl+d",action:"exit",when:"composer",description:"Exit immediately (the draft survives shutdown recovery)",helpOrder:121},{id:"app.suspend",key:"ctrl+z",action:"suspend",when:"application",description:"Suspend MCode and return to the shell",helpOrder:122},{id:"app.toggle-side-session",key:"ctrl+/",action:"toggle-side-session",when:"application",description:"Toggle between the parent and temporary side conversation",helpOrder:123},{id:"welcome.resume-codex",key:"ctrl+u",action:"resume-codex",when:"idle"},{id:"composer.paste-image",key:"ctrl+v",action:"paste-image",when:"composer",description:"Paste an image or copied video file from the clipboard",helpOrder:70},{id:"composer.paste-image-windows",key:"alt+v",action:"paste-image",when:"composer"},{id:"composer.paste-image-macos",key:"super+v",action:"paste-image",when:"composer",description:"Paste an image or copied video file from the clipboard",helpOrder:70},{id:"composer.external-editor",key:"ctrl+g",action:"open-external-editor",when:"composer",description:"Search prompt history / edit in an external editor",helpOrder:50,helpGroup:"composer.prompt-tools"},{id:"composer.search-history",key:"ctrl+r",action:"search-history",when:"composer",description:"Search prompt history / edit in an external editor",helpOrder:40,helpGroup:"composer.prompt-tools"},{id:"run.submit-guidance",key:"enter",action:"submit-guidance",when:"live-run",description:"Guide the current response with the current Draft",helpOrder:90},{id:"run.queue-draft",key:"alt+enter",action:"queue-draft",when:"live-run",description:"Queue the current Draft for the next turn",helpOrder:91,queueOnly:true},{id:"run.restore-waiting-option",key:"alt+up",action:"restore-waiting",when:"live-run",description:"Move the latest queued message back to the Composer",helpOrder:92,helpGroup:"run.restore-waiting",queueOnly:true},{id:"run.restore-waiting-shift-left",key:"shift+left",action:"restore-waiting",when:"live-run",description:"Move the latest queued message back to the Composer",helpOrder:92,helpGroup:"run.restore-waiting",queueOnly:true},{id:"composer.toggle-tasks",key:"ctrl+t",action:"toggle-tasks",when:"composer",description:"Show or hide the full Todo list",helpOrder:25},{id:"composer.toggle-details",key:"ctrl+o",action:"toggle-details",when:"composer",description:"Show or hide Thinking, Tool output, and diffs",helpOrder:20},{id:"interaction.view-plan",key:"ctrl+o",action:"view-plan",when:"interaction",description:"Show or hide the full Plan during Plan Review",helpOrder:82},{id:"composer.toggle-plan",key:"shift+tab",action:"toggle-plan",when:"composer",description:"Plan Mode: Default or Plan",helpOrder:10},{id:"composer.cycle-permission",key:"alt+m",action:"cycle-permission",when:"composer",description:"Permission mode: Ask, Auto, Full access",helpOrder:11},{id:"composer.restore-draft",key:"ctrl+-",action:"restore-draft",when:"composer",description:"Undo the last Draft clear",helpOrder:60},{id:"interaction.scroll-up",key:"pageUp",action:"scroll-up",when:"interaction",description:"Scroll the current interaction",helpOrder:80,helpGroup:"interaction.navigation"},{id:"interaction.scroll-down",key:"pageDown",action:"scroll-down",when:"interaction",description:"Scroll the current interaction",helpOrder:81,helpGroup:"interaction.navigation"}];function d_(){return new Ll(F0)}function c_(n){const e="composer.paste-media";const t=n.platform==="win32"||n.windowsClipboardInterop===true;const i=F0.flatMap(s=>{if(s.id==="app.suspend"&&!n.suspendSupported)return[];if(s.id==="composer.paste-image-windows"&&!t)return[];if(s.id==="composer.paste-image-macos"&&n.platform!=="darwin")return[];if(s.id==="composer.restore-draft"&&n.platform==="win32"){return[{...s,key:"ctrl+z"}]}if(s.id==="composer.paste-image"&&(t||n.platform==="darwin")){return[{...s,...t?{key:"alt+v"}:{},helpGroup:e}]}if(s.id==="composer.paste-image-windows"){return[{...s,key:"ctrl+v",description:"Paste an image or copied video file from the clipboard",helpOrder:70,helpGroup:e}]}if(s.id==="composer.paste-image-macos"){return[{...s,description:"Paste an image or copied video file from the clipboard",helpOrder:70,helpGroup:e}]}return[s]});return i}function $0(n){const e=c_(n);const t=h_(n.platform);const i=new pr({...mr,...p_(e)},{...t,...n.userOverrides??{}});return{manager:i,registry:new Ll(e,n.platform,i,t),hostOverrides:t}}function h_(n){return{"tui.altScreen.previousPrompt":["ctrl+shift+up","ctrl+up"],"tui.altScreen.nextPrompt":["ctrl+shift+down","ctrl+down"],...n==="win32"?{"tui.editor.undo":["ctrl+-","ctrl+z"]}:{}}}function p_(n){return Object.fromEntries(n.map(e=>[e.id,{defaultKeys:e.key,description:e.description}]))}var hf=d_();function ri(){return hf}function Te(n,e=hf){if(!Object.hasOwn(mr,n))m_(n,e);const t=e.keys(n);return t.length>0?t.map(i=>e.format(i)).join(" / "):"Unbound"}function m_(n,e=hf){const t=e.get(n);if(!t)throw new Error(`Unknown keybinding id: ${n}`);return t}function f_(n){if(!u_.test(n.id)){throw new Error(`Invalid keybinding id: ${n.id}`)}if(!l_.test(n.key)){throw new Error(`Invalid keybinding key: ${n.key}`)}}function g_(n,e){if(n==="application")return true;if(n==="interaction")return e.interactionActive;if(e.interactionActive)return false;if(n==="composer")return true;if(n==="idle")return!e.hasLiveRun;if(n==="waiting")return e.hasWaitingMessage===true;return e.hasLiveRun}function N0(n,e){if(n==="application"||e==="application")return true;if(n==="interaction"||e==="interaction")return n===e;if(n==="composer"||e==="composer")return true;if(n===e)return true;if(n==="waiting"||e==="waiting")return true;return false}import{mkdirSync as y_,readFileSync as T_,renameSync as b_,unlinkSync as v_,writeFileSync as S_}from"node:fs";import pf from"node:path";var C_="tui";var B0="keybindings.json";function q0(n){return pf.join(n,C_,B0)}function mf(n){const e=q0(n);try{const t=JSON.parse(T_(e,"utf8").replace(/^\uFEFF/u,""));if(!t||typeof t!=="object"||Array.isArray(t)){throw new Error("keybindings must be a JSON object")}const i={};for(const[s,r]of Object.entries(t)){if(typeof r==="string"){i[s]=r}else if(Array.isArray(r)&&r.every(o=>typeof o==="string")){i[s]=r}else if(r!==null){throw new Error(`binding "${s}" must be a string or an array of strings`)}}return{path:e,overrides:i}}catch(t){if(w_(t))return{path:e,overrides:{}};return{path:e,overrides:{},error:t instanceof Error?t.message:String(t)}}}function H0(n,e){const t=q0(n);const i=pf.dirname(t);y_(i,{recursive:true,mode:448});const s=pf.join(i,`.${B0}.${process.pid}.${Date.now()}.tmp`);const r=`${JSON.stringify(x_(e),null,2)}
|
|
71
71
|
`;try{S_(s,r,{encoding:"utf8",mode:384});b_(s,t)}catch(o){try{v_(s)}catch{}if(o instanceof Error)throw o;throw new Error(String(o))}return t}function x_(n){return Object.fromEntries(Object.entries(n).sort(([e],[t])=>e.localeCompare(t)))}function w_(n){return Boolean(n&&typeof n==="object"&&"code"in n&&n.code==="ENOENT")}var U0=new WeakSet;function kt(...n){for(const e of n){if(!e||U0.has(e))continue;U0.add(e);e.dispose?.()}}import{Worker as I_}from"node:worker_threads";import{open as M_}from"node:fs/promises";var E_=20*1024*1024;var A_=25e6;async function K0(n,e,t){const i=await M_(n,"r");let s;try{const a=await i.stat();if(!a.isFile()||a.size<=0||a.size>E_)return{};const u=Buffer.alloc(a.size);let l=0;while(l<u.length){t.throwIfAborted();const{bytesRead:d}=await i.read(u,l,u.length-l,l);if(!d)break;l+=d}s=u.subarray(0,l)}finally{await i.close()}t.throwIfAborted();const r=ea(s.toString("base64"),e)??void 0;if(!r||r.widthPx*r.heightPx>A_){return{dimensions:r}}const o=e==="image/png"?960:Math.min(960,r.widthPx-1);if(o<1)return{dimensions:r};try{const a=await R_(s,e,o,t);return{dimensions:r,png:a}}catch{t.throwIfAborted();return{dimensions:r}}}async function R_(n,e,t,i){i.throwIfAborted();const s=new I_(new URL(__mavis_tuiPackageEntryUrl.endsWith(".ts")?"./image-preview-worker.ts":"./image-preview-worker.js",__mavis_tuiPackageEntryUrl),{workerData:{bytes:n,mimeType:e,maxWidth:t}});let r;let o;try{return await new Promise((a,u)=>{o=()=>u(new Error("Image preview cancelled"));i.addEventListener("abort",o,{once:true});if(i.aborted){o();return}r=setTimeout(()=>u(new Error("Image preview timed out")),5e3);s.once("message",l=>a(typeof l==="string"?l:void 0));s.once("error",u);s.once("exit",()=>a(void 0))})}finally{if(r)clearTimeout(r);if(o)i.removeEventListener("abort",o);await s.terminate()}}var ff=10;var W0=(n=0)=>e=>`\x1B[${e+n}m`;var j0=(n=0)=>e=>`\x1B[${38+n};5;${e}m`;var V0=(n=0)=>(e,t,i)=>`\x1B[${38+n};2;${e};${t};${i}m`;var He={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};var _Y=Object.keys(He.modifier);var k_=Object.keys(He.color);var P_=Object.keys(He.bgColor);var LY=[...k_,...P_];function __(){const n=new Map;for(const[e,t]of Object.entries(He)){for(const[i,s]of Object.entries(t)){He[i]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`};t[i]=He[i];n.set(s[0],s[1])}Object.defineProperty(He,e,{value:t,enumerable:false})}Object.defineProperty(He,"codes",{value:n,enumerable:false});He.color.close="\x1B[39m";He.bgColor.close="\x1B[49m";He.color.ansi=W0();He.color.ansi256=j0();He.color.ansi16m=V0();He.bgColor.ansi=W0(ff);He.bgColor.ansi256=j0(ff);He.bgColor.ansi16m=V0(ff);Object.defineProperties(He,{rgbToAnsi256:{value(e,t,i){if(e===t&&t===i){if(e<8){return 16}if(e>248){return 231}return Math.round((e-8)/247*24)+232}return 16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(i/255*5)},enumerable:false},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t){return[0,0,0]}let[i]=t;if(i.length===3){i=[...i].map(r=>r+r).join("")}const s=Number.parseInt(i,16);return[s>>16&255,s>>8&255,s&255]},enumerable:false},hexToAnsi256:{value:e=>He.rgbToAnsi256(...He.hexToRgb(e)),enumerable:false},ansi256ToAnsi:{value(e){if(e<8){return 30+e}if(e<16){return 90+(e-8)}let t;let i;let s;if(e>=232){t=((e-232)*10+8)/255;i=t;s=t}else{e-=16;const a=e%36;t=Math.floor(e/36)/5;i=Math.floor(a/6)/5;s=a%6/5}const r=Math.max(t,i,s)*2;if(r===0){return 30}let o=30+(Math.round(s)<<2|Math.round(i)<<1|Math.round(t));if(r===2){o+=60}return o},enumerable:false},rgbToAnsi:{value:(e,t,i)=>He.ansi256ToAnsi(He.rgbToAnsi256(e,t,i)),enumerable:false},hexToAnsi:{value:e=>He.ansi256ToAnsi(He.hexToAnsi256(e)),enumerable:false}});return He}var L_=__();var wn=L_;import gf from"node:process";import O_ from"node:os";import G0 from"node:tty";function cn(n,e=globalThis.Deno?globalThis.Deno.args:gf.argv){const t=n.startsWith("-")?"":n.length===1?"-":"--";const i=e.indexOf(t+n);const s=e.indexOf("--");return i!==-1&&(s===-1||i<s)}var{env:Ue}=gf;var Ol;if(cn("no-color")||cn("no-colors")||cn("color=false")||cn("color=never")){Ol=0}else if(cn("color")||cn("colors")||cn("color=true")||cn("color=always")){Ol=1}function D_(){if("FORCE_COLOR"in Ue){if(Ue.FORCE_COLOR==="true"){return 1}if(Ue.FORCE_COLOR==="false"){return 0}return Ue.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Ue.FORCE_COLOR,10),3)}}function N_(n){if(n===0){return false}return{level:n,hasBasic:true,has256:n>=2,has16m:n>=3}}function F_(n,{streamIsTTY:e,sniffFlags:t=true}={}){const i=D_();if(i!==void 0){Ol=i}const s=t?Ol:i;if(s===0){return 0}if(t){if(cn("color=16m")||cn("color=full")||cn("color=truecolor")){return 3}if(cn("color=256")){return 2}}if("TF_BUILD"in Ue&&"AGENT_NAME"in Ue){return 1}if(n&&!e&&s===void 0){return 0}const r=s||0;if(Ue.TERM==="dumb"){return r}if(gf.platform==="win32"){const o=O_.release().split(".");if(Number(o[0])>=10&&Number(o[2])>=10586){return Number(o[2])>=14931?3:2}return 1}if("CI"in Ue){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(o=>o in Ue)){return 3}if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(o=>o in Ue)||Ue.CI_NAME==="codeship"){return 1}return r}if("TEAMCITY_VERSION"in Ue){return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Ue.TEAMCITY_VERSION)?1:0}if(Ue.COLORTERM==="truecolor"){return 3}if(Ue.TERM==="xterm-kitty"){return 3}if(Ue.TERM==="xterm-ghostty"){return 3}if(Ue.TERM==="wezterm"){return 3}if("TERM_PROGRAM"in Ue){const o=Number.parseInt((Ue.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Ue.TERM_PROGRAM){case"iTerm.app":{return o>=3?3:2}case"Apple_Terminal":{return 2}}}if(/-256(color)?$/i.test(Ue.TERM)){return 2}if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Ue.TERM)){return 1}if("COLORTERM"in Ue){return 1}return r}function z0(n,e={}){const t=F_(n,{streamIsTTY:n&&n.isTTY,...e});return N_(t)}var $_={stdout:z0({isTTY:G0.isatty(1)}),stderr:z0({isTTY:G0.isatty(2)})};var Q0=$_;function Y0(n,e,t){let i=n.indexOf(e);if(i===-1){return n}const s=e.length;let r=0;let o="";do{o+=n.slice(r,i)+e+t;r=i+s;i=n.indexOf(e,r)}while(i!==-1);o+=n.slice(r);return o}function X0(n,e,t,i){let s=0;let r="";do{const o=n[i-1]==="\r";r+=n.slice(s,o?i-1:i)+e+(o?"\r\n":"\n")+t;s=i+1;i=n.indexOf("\n",s)}while(i!==-1);r+=n.slice(s);return r}var{stdout:J0,stderr:Z0}=Q0;var yf=Symbol("GENERATOR");var kr=Symbol("STYLER");var fa=Symbol("IS_EMPTY");var eS=["ansi","ansi","ansi256","ansi16m"];var Pr=Object.create(null);var B_=(n,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3)){throw new Error("The `level` option should be an integer from 0 to 3")}const t=J0?J0.level:0;n.level=e.level===void 0?t:e.level};var Dl=class{constructor(e){return tS(e)}};var tS=n=>{const e=(...t)=>t.join(" ");B_(e,n);Object.setPrototypeOf(e,ga.prototype);return e};function ga(n){return tS(n)}Object.setPrototypeOf(ga.prototype,Function.prototype);for(const[n,e]of Object.entries(wn)){Pr[n]={get(){const t=Nl(this,bf(e.open,e.close,this[kr]),this[fa]);Object.defineProperty(this,n,{value:t});return t}}}Pr.visible={get(){const n=Nl(this,this[kr],true);Object.defineProperty(this,"visible",{value:n});return n}};var Tf=(n,e,t,...i)=>{if(n==="rgb"){if(e==="ansi16m"){return wn[t].ansi16m(...i)}if(e==="ansi256"){return wn[t].ansi256(wn.rgbToAnsi256(...i))}return wn[t].ansi(wn.rgbToAnsi(...i))}if(n==="hex"){return Tf("rgb",e,t,...wn.hexToRgb(...i))}return wn[t][n](...i)};var q_=["rgb","hex","ansi256"];for(const n of q_){Pr[n]={get(){const{level:t}=this;return function(...i){const s=bf(Tf(n,eS[t],"color",...i),wn.color.close,this[kr]);return Nl(this,s,this[fa])}}};const e="bg"+n[0].toUpperCase()+n.slice(1);Pr[e]={get(){const{level:t}=this;return function(...i){const s=bf(Tf(n,eS[t],"bgColor",...i),wn.bgColor.close,this[kr]);return Nl(this,s,this[fa])}}}}var H_=Object.defineProperties(()=>{},{...Pr,level:{enumerable:true,get(){return this[yf].level},set(n){this[yf].level=n}}});var bf=(n,e,t)=>{let i;let s;if(t===void 0){i=n;s=e}else{i=t.openAll+n;s=e+t.closeAll}return{open:n,close:e,openAll:i,closeAll:s,parent:t}};var Nl=(n,e,t)=>{const i=(...s)=>U_(i,s.length===1?""+s[0]:s.join(" "));Object.setPrototypeOf(i,H_);i[yf]=n;i[kr]=e;i[fa]=t;return i};var U_=(n,e)=>{if(n.level<=0||!e){return n[fa]?"":e}let t=n[kr];if(t===void 0){return e}const{openAll:i,closeAll:s}=t;if(e.includes("\x1B")){while(t!==void 0){e=Y0(e,t.close,t.open);t=t.parent}}const r=e.indexOf("\n");if(r!==-1){e=X0(e,s,i,r)}return i+e+s};Object.defineProperties(ga.prototype,Pr);var KY=ga();var WY=ga({level:Z0?Z0.level:0});var kd=cT(iw(),1);var h6=Object.freeze({dark:Object.freeze({brand:"cyan",wordmarkHighlight:"whiteBright",wordmarkShadow:"cyan",signal:"cyan",orbit:"cyan",accent:"cyan",markdownHeading:"magentaBright",markdownCode:"greenBright",markdownLink:"cyan",text:"default",muted:"defaultDim",dim:"gray",border:"gray",line:"gray",success:"greenBright",warning:"yellowBright",error:"redBright"}),light:Object.freeze({brand:"blueBright",wordmarkHighlight:"blueBright",wordmarkShadow:"blue",signal:"blueBright",orbit:"cyan",accent:"blueBright",markdownHeading:"magenta",markdownCode:"green",markdownLink:"blue",text:"black",muted:"black",dim:"gray",border:"gray",line:"gray",success:"green",warning:"yellow",error:"red"})});function sw(n,e,t,i){const s=i.toLocaleLowerCase();const r=Object.keys(e);const o=r.find(u=>e[u].toLocaleLowerCase()===s);if(!o)return void 0;const a=h6[t][o];if(a==="default")return n;if(a==="defaultDim")return n.dim;return a?n[a]:void 0}function rw(n,e){const t=e.toLocaleLowerCase();return[n.userMessageBg,n.diffAddedBg,n.diffRemovedBg].some(i=>i.toLocaleLowerCase()===t)}var p6=[{r:0,g:0,b:0},{r:128,g:0,b:0},{r:0,g:128,b:0},{r:128,g:128,b:0},{r:0,g:0,b:128},{r:128,g:0,b:128},{r:0,g:128,b:128},{r:192,g:192,b:192},{r:128,g:128,b:128},{r:255,g:0,b:0},{r:0,g:255,b:0},{r:255,g:255,b:0},{r:0,g:0,b:255},{r:255,g:0,b:255},{r:0,g:255,b:255},{r:255,g:255,b:255}];function m6(n){if(!n)return void 0;const e=n.split(";").at(-1)?.trim();if(!e||!/^\d{1,3}$/u.test(e))return void 0;const t=Number(e);if(!Number.isInteger(t)||t<0||t>255)return void 0;return b1(g6(t))}function Na(n){const e=m6(n.COLORFGBG);if(e){return{appearance:e,source:"colorfgbg",detail:`COLORFGBG=${n.COLORFGBG}`}}return{appearance:"dark",source:"fallback",detail:"no terminal background hint"}}function b1(n){return f6(n)>=.5?"light":"dark"}function f6(n){const e=t=>{const i=Math.max(0,Math.min(255,t))/255;return i<=.03928?i/12.92:((i+.055)/1.055)**2.4};return .2126*e(n.r)+.7152*e(n.g)+.0722*e(n.b)}function g6(n){const e=p6[n];if(e)return e;if(n>=232){const a=8+(n-232)*10;return{r:a,g:a,b:a}}const t=n-16;const i=Math.floor(t/36);const s=Math.floor(t%36/6);const r=t%6;const o=a=>a===0?0:55+a*40;return{r:o(i),g:o(s),b:o(r)}}var v1=Object.freeze({dark:Object.freeze({blue:"#89B4FA",flamingo:"#F2CDCD",green:"#A6E3A1",mauve:"#CBA6F7",overlay2:"#9399B2",peach:"#FAB387",pink:"#F5C2E7",red:"#F38BA8",sapphire:"#74C7EC",subtext0:"#A6ADC8",teal:"#94E2D5",text:"#CDD6F4",yellow:"#F9E2AF"}),light:Object.freeze({blue:"#1E66F5",flamingo:"#DD7878",green:"#40A02B",mauve:"#8839EF",overlay2:"#7C7F93",peach:"#FE640B",pink:"#EA76CB",red:"#D20F39",sapphire:"#209FB5",subtext0:"#6C6F85",teal:"#179299",text:"#4C4F69",yellow:"#DF8E1D"})});var y6={dark:{blue:"blueBright",flamingo:"magentaBright",green:"greenBright",mauve:"magentaBright",overlay2:"whiteBright",peach:"yellowBright",pink:"magentaBright",red:"redBright",sapphire:"cyanBright",subtext0:"white",teal:"cyanBright",text:"white",yellow:"yellowBright"},light:{blue:"blue",flamingo:"magenta",green:"green",mauve:"magenta",overlay2:"gray",peach:"yellow",pink:"magenta",red:"red",sapphire:"cyan",subtext0:"black",teal:"cyan",text:"black",yellow:"yellow"}};function ow(n,e,t){const i=r=>o=>{const a=t();if(n.level!==1)return n.hex(e()[r])(o);const u=n[y6[a][r]](o);return a==="dark"&&r==="overlay2"?n.dim(u):u};const s=r=>n.bold(i("red")(r));return{default:i("text"),keyword:i("mauve"),built_in:i("red"),type:i("yellow"),literal:i("peach"),number:i("peach"),regexp:i("pink"),string:i("green"),subst:i("subtext0"),symbol:i("flamingo"),class:i("yellow"),function:i("blue"),title:i("blue"),params:i("text"),comment:i("overlay2"),doctag:i("red"),meta:i("peach"),"meta-keyword":i("peach"),"meta-string":i("green"),section:i("blue"),tag:i("teal"),name:i("mauve"),"builtin-name":i("red"),attr:i("blue"),attribute:i("green"),variable:i("mauve"),bullet:i("teal"),code:i("green"),emphasis:i("red"),strong:s,formula:i("teal"),link:i("sapphire"),quote:i("green"),"selector-tag":i("yellow"),"selector-id":i("blue"),"selector-class":i("teal"),"selector-attr":i("mauve"),"selector-pseudo":i("teal"),"template-tag":i("flamingo"),"template-variable":i("flamingo"),addition:i("green"),deletion:i("red")}}function Zi(n,e,t,i){return Object.freeze({id:n,appearance:e,colors:Object.freeze(t),syntax:Object.freeze(i)})}var Bs=Zi("minimax","dark",{brand:"#68C0FF",wordmarkHighlight:"#93D2FF",wordmarkShadow:"#3DAEFF",signal:"#68C0FF",orbit:"#1CCDD2",accent:"#68C0FF",markdownHeading:"#CBA6F7",markdownCode:"#A6E3A1",markdownLink:"#68C0FF",userMessageBg:"#262626",diffAddedBg:"#213A2B",diffRemovedBg:"#4A221D",text:"#D6D6D6",muted:"#ADADAD",dim:"#666666",border:"#303030",line:"#666666",success:"#28C567",warning:"#FFC340",error:"#FF5E6C"},v1.dark);var Vr=Zi("minimax","light",{brand:"#0094FC",wordmarkHighlight:"#3DAEFF",wordmarkShadow:"#0077D9",signal:"#0094FC",orbit:"#00767D",accent:"#0094FC",markdownHeading:"#8839EF",markdownCode:"#267A3F",markdownLink:"#0066CC",userMessageBg:"#F5F5F5",diffAddedBg:"#DAFBE1",diffRemovedBg:"#FFEBE9",text:"#303030",muted:"#666666",dim:"#949494",border:"#EDEDED",line:"#949494",success:"#008635",warning:"#916300",error:"#E31937"},v1.light);function S1(n){return n==="light"?Vr:Bs}var T6=Object.freeze({id:"midnight",label:"Midnight",description:"Deep blue-black with lifted contrast",source:"builtin",dark:Zi("midnight","dark",{brand:"#5AB9FF",wordmarkHighlight:"#8FD0FF",wordmarkShadow:"#3A9BE0",signal:"#5AB9FF",orbit:"#2AD4DE",accent:"#5AB9FF",markdownHeading:"#B79CFF",markdownCode:"#7EE787",markdownLink:"#5AB9FF",userMessageBg:"#141A22",diffAddedBg:"#12301F",diffRemovedBg:"#3D1A1A",text:"#E6EDF3",muted:"#9AA7B4",dim:"#6B7785",border:"#232C36",line:"#7D8B99",success:"#3FB950",warning:"#E3B341",error:"#F85149"},{blue:"#79C0FF",flamingo:"#F0B7B0",green:"#7EE787",mauve:"#D2A8FF",overlay2:"#8B949E",peach:"#FFA657",pink:"#F778BA",red:"#FF7B72",sapphire:"#A5D6FF",subtext0:"#B1BAC4",teal:"#39C5CF",text:"#C9D1D9",yellow:"#D29922"}),light:Zi("midnight","light",{brand:"#0A6FCE",wordmarkHighlight:"#3DAEFF",wordmarkShadow:"#07599F",signal:"#0A6FCE",orbit:"#0B7A82",accent:"#0A6FCE",markdownHeading:"#7A3FD1",markdownCode:"#1A7F37",markdownLink:"#0550AE",userMessageBg:"#F2F5F9",diffAddedBg:"#DDFBE4",diffRemovedBg:"#FFE7E5",text:"#1F2933",muted:"#52606D",dim:"#7B8794",border:"#E4E9EF",line:"#6B7785",success:"#0F7B33",warning:"#8A6100",error:"#C21F39"},{blue:"#0550AE",flamingo:"#B3594F",green:"#116329",mauve:"#8250DF",overlay2:"#6E7781",peach:"#953800",pink:"#BF3989",red:"#CF222E",sapphire:"#1F6FEB",subtext0:"#57606A",teal:"#137C8B",text:"#24292F",yellow:"#9A6700"})});var b6=Object.freeze({id:"graphite",label:"Graphite",description:"Neutral low-chroma surfaces for dense output",source:"builtin",dark:Zi("graphite","dark",{brand:"#68C0FF",wordmarkHighlight:"#9BD8FF",wordmarkShadow:"#3D9AD6",signal:"#68C0FF",orbit:"#5AC8D2",accent:"#68C0FF",markdownHeading:"#C9D1D9",markdownCode:"#A5D6A7",markdownLink:"#68C0FF",userMessageBg:"#22262B",diffAddedBg:"#1B3324",diffRemovedBg:"#3B2426",text:"#DDE1E6",muted:"#A8B0B8",dim:"#71797F",border:"#2E3338",line:"#848C94",success:"#3FB463",warning:"#E0A92E",error:"#F2606B"},{blue:"#7FB8E8",flamingo:"#D9A0A8",green:"#9CCFA5",mauve:"#B5AEDA",overlay2:"#8A9199",peach:"#D9A97E",pink:"#D5A8C4",red:"#E08087",sapphire:"#8FC9E0",subtext0:"#AEB5BC",teal:"#7FC5CB",text:"#D7DBDF",yellow:"#D6C07A"}),light:Zi("graphite","light",{brand:"#0B6FB8",wordmarkHighlight:"#3DAEFF",wordmarkShadow:"#07558F",signal:"#0B6FB8",orbit:"#0C7680",accent:"#0B6FB8",markdownHeading:"#3D444D",markdownCode:"#1F7A3D",markdownLink:"#0A5C9E",userMessageBg:"#F4F5F6",diffAddedBg:"#E2F3E6",diffRemovedBg:"#FBE6E7",text:"#2B3036",muted:"#565E66",dim:"#7C848C",border:"#E6E8EA",line:"#767E86",success:"#0F7033",warning:"#835A00",error:"#B5202E"},{blue:"#2C6FAF",flamingo:"#9E5A5F",green:"#2F7A42",mauve:"#6A5AA8",overlay2:"#6D747B",peach:"#96602A",pink:"#9A4E80",red:"#B23A44",sapphire:"#2A7F9E",subtext0:"#5B636B",teal:"#237A82",text:"#2B3036",yellow:"#8A6D1F"})});var v6=Object.freeze({id:"aurora",label:"Aurora",description:"Cool cyan and mint secondary ramp",source:"builtin",dark:Zi("aurora","dark",{brand:"#5CC8E8",wordmarkHighlight:"#8FE0F5",wordmarkShadow:"#38A5C4",signal:"#5CC8E8",orbit:"#5FE3B0",accent:"#5CC8E8",markdownHeading:"#8FD9C0",markdownCode:"#7BE0B4",markdownLink:"#5CC8E8",userMessageBg:"#16232A",diffAddedBg:"#113028",diffRemovedBg:"#3A1F26",text:"#DCE9EE",muted:"#93AAB3",dim:"#647D86",border:"#22333B",line:"#7E99A3",success:"#4FD18B",warning:"#E8C15A",error:"#F2788A"},{blue:"#6FC7E8",flamingo:"#E8A9A0",green:"#6FE0AE",mauve:"#8FC9D9",overlay2:"#7E99A3",peach:"#E8B88C",pink:"#E5A8CE",red:"#F2788A",sapphire:"#5AD4D4",subtext0:"#A8C0C9",teal:"#5FE3B0",text:"#DCE9EE",yellow:"#E8D08A"}),light:Zi("aurora","light",{brand:"#0A6E8C",wordmarkHighlight:"#2FA8C9",wordmarkShadow:"#07536A",signal:"#0A6E8C",orbit:"#0C7A5C",accent:"#0A6E8C",markdownHeading:"#0F6B57",markdownCode:"#0F7350",markdownLink:"#075C78",userMessageBg:"#F1F6F8",diffAddedBg:"#DDF3E9",diffRemovedBg:"#FBE7EC",text:"#1E2B31",muted:"#4E646D",dim:"#758D96",border:"#E2EBEE",line:"#6B8590",success:"#0E7A52",warning:"#856000",error:"#B32B45"},{blue:"#0E6E8C",flamingo:"#9E5A56",green:"#0F7350",mauve:"#0F6A72",overlay2:"#6B8590",peach:"#8A5A28",pink:"#8E4470",red:"#B32B45",sapphire:"#0A7A7D",subtext0:"#5A737D",teal:"#0C7A5C",text:"#1E2B31",yellow:"#7A6418"})});var qs="minimax";var Ed=Object.freeze({id:Bs.id,label:"MCode",description:"The default MCode blue palette",source:"builtin",dark:Bs,light:Vr});var Ad=Object.freeze([Ed,T6,b6,v6]);var lw=Er();var Pd=Na(process.env).appearance;var Gn={name:"minimax",appearance:Pd,colorLevel:lw.colorLevel,signature:""};var We=Pd==="light"?Vr.colors:Bs.colors;var dw=Pd==="light"?Vr.syntax:Bs.syntax;Gn={...Gn,signature:Fa(Pd==="light"?Vr:Bs)};var c=Object.freeze({get brand(){return We.brand},get wordmarkHighlight(){return We.wordmarkHighlight},get wordmarkShadow(){return We.wordmarkShadow},get signal(){return We.signal},get orbit(){return We.orbit},get accent(){return We.accent},get markdownHeading(){return We.markdownHeading},get markdownCode(){return We.markdownCode},get markdownLink(){return We.markdownLink},get userMessageBg(){return We.userMessageBg},get diffAddedBg(){return We.diffAddedBg},get diffRemovedBg(){return We.diffRemovedBg},get text(){return We.text},get muted(){return We.muted},get dim(){return We.dim},get border(){return We.border},get line(){return We.line},get success(){return We.success},get warning(){return We.warning},get error(){return We.error}});function cw(n){const e=n.isTTY===false||n.noColor?0:n.colorLevel??3;return new Dl({level:e})}var hw=cw({colorLevel:lw.colorLevel});var S6=new Set(["bold","italic","strikethrough","underline"]);function Rd(n){let e=hw;for(const t of n)e=e[t];return e}function pw(n=[]){const e=(()=>"");return new Proxy(e,{apply:(t,i,s)=>{const r=Rd(n);return Reflect.apply(r,r,s)},get:(t,i)=>{if(i==="hex"){return r=>{const o=Rd(n);if(Gn.colorLevel===1){return sw(o,We,Gn.appearance,r)??o.hex(r)}return o.hex(r)}}if(i==="bgHex"){return r=>{const o=Rd(n);if(Gn.colorLevel===1&&rw(We,r)){return o}return o.bgHex(r)}}if(typeof i==="string"&&S6.has(i)){return pw([...n,i])}const s=Rd(n);return Reflect.get(s,i,s)}})}var p=pw();var C6=/(?<![\p{L}\p{N}_])(?:(?:(?:Ctrl|Shift|Alt|Cmd|Meta|Option|Command|Fn|Super)\+)+(?:Enter|Esc|Tab|Space|PgUp|PgDn|Home|End|Delete|Backspace|Up|Down|Left|Right|F\d+|[\p{L}\p{N}]|[+\-\\/])|Enter|Esc|Tab|Space|PgUp|PgDn|Home|End|Delete|Backspace|Wheel|F\d+|\d-\d|\/[a-z][a-z0-9-]*|\/(?=\s)|[↑↓←→])(?![\p{L}\p{N}_])/giu;function Y(n){const e=n.split(/( · )/u);return e.map(t=>{if(t===" \xB7 ")return p.hex(c.dim)(t);const i=[...t.matchAll(C6)];if(i.length===0){const o=/^(\s*)([a-z0-9/])(?=\s)/iu.exec(t);if(!o)return p.hex(c.muted)(t);const a=o[1]??"";const u=o[2]??"";return`${p.hex(c.muted)(a)}${p.bold.hex(c.text)(u)}${p.hex(c.muted)(t.slice(a.length+u.length))}`}const s=[];let r=0;for(const o of i){const a=o.index??0;if(a>r){s.push(p.hex(c.muted)(t.slice(r,a)))}s.push(p.bold.hex(c.text)(o[0]));r=a+o[0].length}if(r<t.length){s.push(p.hex(c.muted)(t.slice(r)))}return s.join("")}).join("")}function Fa(n){return JSON.stringify([n.id,n.appearance,n.colors,n.syntax])}function mw(n,e){const t=Fa(n);const i=Gn.signature!==t||Gn.colorLevel!==e;if(!i)return false;const s=Gn.colorLevel!==e;Gn={name:n.id,appearance:n.appearance,colorLevel:e,signature:t};We=n.colors;dw=n.syntax;if(s)hw=cw({colorLevel:e});return true}var x6=ow(p,()=>dw,()=>Gn.appearance);var w6=64*1024;var I6=1250;var aw=4*1024;function M6(n){if(n.length>w6)return true;let e=1;let t=0;for(let i=n.indexOf("\n");i>=0;i=n.indexOf("\n",i+1)){if(++e>I6||i-t>aw)return true;t=i+1}return n.length-t>aw}function uw(n){return n.split("\n").map(e=>p.hex(c.text)(e))}function _d(n,e){if(M6(n))return uw(n);const t=e.trim().toLowerCase();const i=(0,kd.supportsLanguage)(t)?t:"text";try{return(0,kd.highlight)(n,{language:i,ignoreIllegals:true,theme:x6}).split("\n")}catch{return uw(n)}}function E6(){return{heading:n=>p.bold.hex(c.markdownHeading)(n),link:n=>p.hex(c.markdownLink)(n),linkUrl:n=>p.hex(c.dim)(n),code:n=>p.hex(c.markdownCode)(n),codeBlock:n=>p.hex(c.text)(n),codeBlockBorder:n=>p.hex(c.muted)(n),quote:n=>p.italic.hex(c.muted)(n),quoteBorder:n=>p.hex(c.muted)(n),hr:n=>p.hex(c.muted)(n),listBullet:n=>p.hex(c.muted)(n),bold:n=>p.bold(n),italic:n=>p.italic(n),strikethrough:n=>p.strikethrough(n),underline:n=>p.underline(n),codeBlockChrome:"plain",highlightCode:(n,e)=>{return _d(n,e??"text")}}}var jt=E6();var fw=jt;var mt={selectedPrefix:n=>p.hex(c.signal)(n),selectedText:n=>p.bold.hex(c.signal)(n),description:n=>p.hex(c.muted)(n),scrollInfo:n=>p.hex(c.dim)(n),noMatch:n=>p.hex(c.dim)(n)};var gw={borderColor:n=>p.hex(c.line)(n),placeholder:n=>p.hex(c.muted)(n),selectList:mt};import{stat as Sw}from"node:fs/promises";import{homedir as P6}from"node:os";import{basename as _6,extname as L6,isAbsolute as O6,resolve as Od}from"node:path";import{posix as Ld,win32 as Tw}from"node:path";var A6=new Set([".avif",".bmp",".gif",".jpeg",".jpg",".png",".webp"]);function C1(n){const e=k6(n);if(e.length>1&&e.every(yw)){return e}if(yw(n))return[n];return void 0}function R6(n){return C1(n)!==void 0}function k6(n){const e=vw(n.trim());if(!e||/[\r\n]/u.test(e))return[];const t=[];let i="";for(let s=0;s<e.length;s+=1){const r=e[s];const o=e[s+1];if(r==="\\"&&(o==="\\"||o!==void 0&&/\s/u.test(o))){i+=o;s+=1}else if(/\s/u.test(r)){if(i)t.push(i);i=""}else{i+=r}}if(i)t.push(i);return t}function yw(n){const e=vw(n.trim());if(!e||/[\r\n]/u.test(e))return false;const t=e.replaceAll("\\","/");if(!t.includes("/otty-paste/")&&!Ld.isAbsolute(t)&&!Tw.isAbsolute(e)){return false}const i=Ld.extname(t).toLocaleLowerCase();return A6.has(i)}function bw(n,e=process.platform){const t=n.trim();if(e==="win32"||!R6(t)||!Ld.isAbsolute(t)||Tw.parse(t).root!==Ld.parse(t).root){return void 0}const i=t.replace(/\\([\\ ])/gu,"$1");return i===t?void 0:i}function vw(n){if(n.length<2)return n;const e=n[0];const t=n.at(-1);return e==='"'&&t==='"'||e==="'"&&t==="'"?n.slice(1,-1):n}function $a(n,e){if(n.type==="image")return`[Image #${e+1}]`;if(!n.mimeType.startsWith("video/"))return`[File #${e+1}]`;const t=n.fileName.replaceAll(/[\u0000-\u001F\u007F[\]]/gu,"_").trim();return`[Video #${e+1} ${t||"video"}]`}var D6={".avif":"image/avif",".bmp":"image/bmp",".csv":"text/csv",".gif":"image/gif",".html":"text/html",".jpeg":"image/jpeg",".jpg":"image/jpeg",".json":"application/json",".log":"text/plain",".md":"text/markdown",".pdf":"application/pdf",".png":"image/png",".svg":"image/svg+xml",".tsv":"text/tab-separated-values",".txt":"text/plain",".webp":"image/webp",".xml":"application/xml",".yaml":"application/yaml",".yml":"application/yaml"};async function Cw(n,e){const t=N6(n.trim());if(!t)throw new Error("Attachment path is required.");const i=e.homeDir??P6();const s=await FT(t==="~"?i:t.startsWith("~/")||t.startsWith("~\\")?Od(i,t.slice(2)):t);let r=O6(s)?Od(s):Od(e.workspaceDir,s);const o=await Sw(r).catch(l=>{const d=l&&typeof l==="object"&&"code"in l?l.code:void 0;const h=d==="ENOENT"||d==="ENOTDIR"||d==="ENAMETOOLONG";if(e.source!=="terminal-paste"||!h){throw l}const m=bw(n);if(!m)throw l;r=Od(m);return Sw(r)}).catch(l=>{const d=l instanceof Error?l.message:String(l);throw new Error(`Cannot attach ${x(t)}: ${x(d)}`)});if(!o.isFile()){throw new Error(`Cannot attach ${x(t)}: path is not a file.`)}const a=_6(r);const u=D6[L6(a).toLowerCase()]??NT(a)??"application/octet-stream";return{type:u.startsWith("image/")?"image":"file",filePath:r,fileName:a,mimeType:u,sizeBytes:o.size}}function xw(n,e){return n}function Ba(n,e){return n}function An(n){return n.map(e=>({type:e.type,fileName:e.fileName,mimeType:e.mimeType,...e.sizeBytes!==void 0?{sizeBytes:e.sizeBytes}:{},...e.filePath?{filePath:e.filePath}:{},...e.assetId?{assetId:e.assetId}:{},...e.previewUrl?{previewUrl:e.previewUrl}:{}}))}function N6(n){if(n.length<2)return n;const e=n[0];const t=n.at(-1);return e==='"'&&t==='"'||e==="'"&&t==="'"?n.slice(1,-1):n}function ww(n){if(n<1024)return`${n} B`;if(n<1024*1024)return`${x1(n/1024)} KB`;if(n<1024*1024*1024)return`${x1(n/(1024*1024))} MB`;return`${x1(n/(1024*1024*1024))} GB`}function x1(n){return n>=10||Number.isInteger(n)?n.toFixed(0):n.toFixed(1)}var Iw={imagePreviewLoading:"Loading preview\u2026",imagePreviewUnavailable:"Preview unavailable \xB7 attachment is still ready to send",imagePreviewTextOnly:"Image preview is not supported by this terminal",imagePreviewHint:"Esc dismiss \xB7 Enter send",placeholder:"Ask Ncode to do anything",draftSaveFailed:"Couldn't save draft recovery.",draftCleanupFailed:"Couldn't clean up draft recovery.",draftMigrationFailed:"Couldn't move draft recovery to this session.",draftRestoreFailed:"Couldn't read draft recovery.",draftRecoveryUnavailable:"You can continue using MCode. Unsent input may not be recoverable after restarting.",draftCleanupNextStep:"An older draft or attachment backup may remain on disk."};var Mw={imagePreviewLoading:"\u6B63\u5728\u52A0\u8F7D\u9884\u89C8\u2026",imagePreviewUnavailable:"\u65E0\u6CD5\u9884\u89C8 \xB7 \u9644\u4EF6\u4ECD\u53EF\u53D1\u9001",imagePreviewTextOnly:"\u5F53\u524D\u7EC8\u7AEF\u4E0D\u652F\u6301\u663E\u793A\u56FE\u7247\u9884\u89C8",imagePreviewHint:"Esc \u6536\u8D77 \xB7 Enter \u53D1\u9001",placeholder:"Ask Ncode to do anything",draftSaveFailed:"\u65E0\u6CD5\u4FDD\u5B58\u8349\u7A3F\u6062\u590D\u5907\u4EFD\u3002",draftCleanupFailed:"\u65E0\u6CD5\u6E05\u7406\u8349\u7A3F\u6062\u590D\u5907\u4EFD\u3002",draftMigrationFailed:"\u65E0\u6CD5\u5C06\u8349\u7A3F\u6062\u590D\u5907\u4EFD\u8FC1\u79FB\u5230\u5F53\u524D\u4F1A\u8BDD\u3002",draftRestoreFailed:"\u65E0\u6CD5\u8BFB\u53D6\u8349\u7A3F\u6062\u590D\u5907\u4EFD\u3002",draftRecoveryUnavailable:"\u53EF\u7EE7\u7EED\u6B63\u5E38\u4F7F\u7528 MCode\uFF0C\u91CD\u542F\u540E\u53EF\u80FD\u65E0\u6CD5\u6062\u590D\u672A\u53D1\u9001\u5185\u5BB9\u3002",draftCleanupNextStep:"\u78C1\u76D8\u4E0A\u53EF\u80FD\u4ECD\u4FDD\u7559\u65E7\u8349\u7A3F\u6216\u9644\u4EF6\u5907\u4EFD\u3002"};function F6(){try{return Intl.DateTimeFormat().resolvedOptions().locale}catch{return"en"}}function Hs(n,e=F6()){return Fn(e)==="zh"?Mw[n]:Iw[n]}var Dd=class{constructor(e){this.options=e}options;entry;disposed=false;attachments=()=>[];setAttachmentSource(e){this.attachments=e}invalidate(){this.entry?.image?.invalidate()}dispose(){this.disposed=true;this.clear()}clear(){this.entry?.abort.abort();this.entry=void 0}render(e){const t=this.options.editor.getAttachmentPreview();const i=t&&this.attachments().find(f=>(f.id??f.filePath)===t.id&&f.type==="image");if(this.disposed||!t||!i||e<12){this.clear();return[]}const s=JSON.stringify([t.id,i.filePath,i.mimeType,i.sizeBytes]);if(this.entry?.key!==s){this.clear();const f={key:s,abort:new AbortController,settled:false};this.entry=f;const y=i.filePath?(this.options.load??K0)(i.filePath,x(i.mimeType),f.abort.signal):Promise.resolve({});void y.then(T=>{f.data=T}).catch(()=>{f.data={}}).finally(()=>{f.settled=true;if(!this.disposed&&this.entry===f)this.options.requestRender()})}const r=this.entry;if(!r)return[];const o=f=>E(f,e,"\u2026");const a=r.data?.dimensions;const u=[x(i.mimeType),...a?[`${a.widthPx} \xD7 ${a.heightPx}`]:[],...i.sizeBytes===void 0?[]:[ww(i.sizeBytes)],x(i.fileName)].join(" \xB7 ");const l=[o(p.hex(c.signal)(x(t.label))),o(p.hex(c.muted)(u))];const d=Math.max(0,Math.floor(this.options.terminalRows())-12);const h=Math.min(6,d);const m=At().images;if(r.data?.png&&m&&h>=2){const f=`${m}:${h}`;if(!r.image||r.imageLayout!==f){r.image=new aa(r.data.png,"image/png",{fallbackColor:y=>p.hex(c.muted)(y)},{maxWidthCells:56,maxHeightCells:h});r.imageLayout=f}l.push(...r.image.render(e))}else{const f=!r.settled?"imagePreviewLoading":!r.data?.png?"imagePreviewUnavailable":"imagePreviewTextOnly";l.push(o(p.hex(c.muted)(Hs(f))))}l.push(o(p.hex(c.dim)(Hs("imagePreviewHint"))));return l}};async function Nd(){const n=await import("@mariozechner/clipboard");const e=n.getText??n.default?.getText;if(!e)return null;try{return await e()||null}catch{return null}}async function qa(n){const e=await import("@mariozechner/clipboard");const t=e.setText??e.default?.setText;if(!t)throw new Error("The system clipboard text API is unavailable.");await t(n)}var Fd=class{constructor(e,t){this.telemetry=e;this.context=t}telemetry;context;btwOpenedAtMs=new Map;trackBtwSessionOpened(e){this.btwOpenedAtMs.set(e.sideSessionId,Date.now());this.track("btw_session_lifecycle",{phase:"opened",duration_bucket:"not_applicable",exit_reason:""})}trackBtwSessionClosed(e){const t=this.btwOpenedAtMs.get(e.sideSessionId);this.btwOpenedAtMs.delete(e.sideSessionId);this.track("btw_session_lifecycle",{phase:"closed",duration_bucket:qT(t===void 0?0:Math.max(0,Date.now()-t)),exit_reason:e.exitReason})}trackChatSend(e){this.track("chat_send",{...this.chatContext(),is_first_message:e.isFirstMessage??this.context.userMessageCount()===0?1:0,is_attachment:e.attachmentCount>0?"attachment":"text"})}trackAutocompleteView(e){if(e.kind==="argument")return;if(e.prefix.startsWith("/")){this.track("slash_command_menu_view",this.chatContext())}else if(e.prefix.startsWith("@")){this.track("at_command_menu_view",this.chatContext())}}trackAutocompleteSelection(e,t){if(e.kind==="argument")return;if(e.prefix.startsWith("/")){this.track("slash_command_click",{...this.chatContext(),command_type:this.slashCommandType(t.value)})}else if(e.prefix.startsWith("@")){this.track("at_command_click",{...this.chatContext(),command_type:t.label.endsWith("/")?"directory":"file"})}}chatContext(){return{chat_type:this.context.chatType()}}slashCommandType(e){const t=e.trim().toLocaleLowerCase();if(this.context.skillCommandNames().has(t))return"skill";if(t==="new"||t==="clear")return"new_chat";if(t==="compact")return"summarize";if(t==="plan")return"plan_mode";if(t==="goal")return"goal_mode";return"other"}track(e,t){try{this.telemetry.track(e,t)}catch{}}};var $6=["path","filePath","file_path","command","query","pattern","url","description"];var B6=["target","operation","action","name"];function es(n){const e=x(n).trim();if(!e)return"";try{const t=JSON.parse(e);if(typeof t==="string")return Vt(t);if(q6(t)){const i=t.agent_name;const s=t.description;if(typeof i==="string"&&i.trim()&&typeof s==="string"&&s.trim()){return`${Vt(i)} \xB7 ${Vt(s)}`}const r=[t.path,t.filePath,t.file_path,t.cwd].find(u=>typeof u==="string"&&Boolean(u.trim()));const o=[t.query,t.pattern].find(u=>typeof u==="string"&&Boolean(u.trim()));if(typeof t.command==="string"&&t.command.trim()){if(typeof s==="string"&&s.trim())return Vt(s);const u=Vt(t.command);return r?`${u} \xB7 in ${Vt(r)}`:u}if(o)return r?`${Vt(o)} in ${Vt(r)}`:Vt(o);for(const u of $6){const l=t[u];if(typeof l==="string"&&l.trim()){return Vt(l)}if(Array.isArray(l)&&l.length>0&&l.every(d=>typeof d==="string")){return l.map(Vt).filter(Boolean).join(" ")}}const a=B6.flatMap(u=>{const l=t[u];return typeof l==="string"&&l.trim()?[Vt(l)]:[]});return a.slice(0,2).join(" \xB7 ")}if(Array.isArray(t))return`${t.length} item${t.length===1?"":"s"}`}catch{return Vt(e)}return""}function Vt(n){return x(n).split(/\r\n?|\n/u,1)[0]?.trim()??""}function q6(n){return n!==null&&typeof n==="object"&&!Array.isArray(n)}var Ew={failed:0,waiting:1,running:2,queued:3,done:4,stopped:5};var $d=class{rootSessionId;members=new Map;reset(){this.rootSessionId=void 0;this.members.clear()}replace(e,t,i,s){const r=new Map;for(const o of t){const a=i.get(o.sessionId);const u=this.members.get(o.sessionId);const l=H6(o.status,a?.state);const d=u!==void 0&&(u.status==="running"||u.status==="waiting")&&u.turnId!==void 0&&l==="queued"&&a?.state==="idle";const h=u!==void 0&&K6(u.status)&&l==="queued"&&a?.state==="idle";const m=d?"done":h?u.status:l;const f=a?.turnId??(d||h?u.turnId:void 0);const y=h||u?.turnId===f&&w1(m)?u:void 0;const T=U6(m,o.errorMessage);r.set(o.sessionId,{sessionId:o.sessionId,parentSessionId:o.parentSessionId,agentName:Us(o.agentName,"sub-agent"),task:Us(o.task,"Delegated task"),status:m,phase:y?.phase??T.phase,activity:y?.activity??T.activity,toolIds:y?.toolIds??new Set,...f?{turnId:f}:{},startedAtMs:o.createdAtMs??u?.startedAtMs??s,updatedAtMs:Math.max(o.updatedAtMs??0,u?.updatedAtMs??0)||s,...o.errorMessage?.trim()?{errorMessage:Us(o.errorMessage,"")}:{}})}this.rootSessionId=e;this.members=r}applyStreamEvent(e,t,i,s){const r=this.members.get(e);const o=i.type==="message"?i.message.turnId:i.turnId;if(!r||r.turnId!==t||o&&o!==t)return;if(i.type==="delta"){this.applyDelta(r,t,i,s);return}if(i.type==="message"){this.applyMessage(r,t,i.message,s);return}if(i.type==="messages-replaced"){this.hydrateMessages(e,t,i.messages,s);return}if(i.type==="messages-rewound"){this.resetActivity(r,s);return}if(i.type==="error"){r.status="failed";r.phase="failed";r.activity="Failed";r.errorMessage=Us(i.message,"Agent failed");r.updatedAtMs=s;return}if(i.type==="session-status"){if(i.status==="error"){r.status="failed";r.phase="failed";r.activity="Failed"}else if(i.status==="aborted"||i.status==="interrupted"){r.status="stopped";r.phase="stopped";r.activity="Stopped"}else if(i.status==="finished"){r.status="done";r.phase="done";r.activity="Done"}else if(i.status==="started"||i.status==="idle"){r.status="running";if(r.phase==="done"||r.phase==="failed"||r.phase==="stopped"||r.phase==="queued"){r.phase="running";r.activity="Running"}}r.updatedAtMs=s}}hydrateMessages(e,t,i,s){const r=this.members.get(e);if(!r||r.turnId!==t)return;const o=r.status==="waiting"&&r.phase==="waiting"?r.activity:void 0;this.resetActivity(r,s);const a=i.filter(l=>l.turnId===t);const u=a.length>0?a:i.filter(l=>!l.turnId).slice(-1);for(const l of u)this.applyMessage(r,t,l,s);if(o){r.phase="waiting";r.activity=o}}markWaiting(e,t,i){const s=this.members.get(e);if(!s||!w1(s.status))return;s.status="waiting";s.phase="waiting";s.activity=Us(t,"Waiting for input");s.updatedAtMs=i}markDone(e,t,i){const s=this.members.get(e);if(!s||s.status==="failed"||s.status==="stopped"||t!==void 0&&s.turnId!==void 0&&s.turnId!==t){return false}s.status="done";s.phase="done";s.activity="Done";if(t!==void 0)s.turnId=t;s.updatedAtMs=i;return true}snapshot(e=Date.now()){const t=[...this.members.values()].map(W6).sort((i,s)=>Ew[i.status]-Ew[s.status]||i.startedAtMs-s.startedAtMs||i.sessionId.localeCompare(s.sessionId));return{rootSessionId:this.rootSessionId??"",capturedAtMs:e,summary:j6(t),members:t}}applyDelta(e,t,i,s){if(i.toolCalls?.length){for(const r of i.toolCalls)this.applyTool(e,t,r)}else if(i.thinking!==void 0){e.phase="thinking";e.activity="Thinking"}else if(i.content!==void 0||i.started){e.phase="responding";e.activity="Responding"}if(e.status==="waiting")e.status="running";e.updatedAtMs=s}applyMessage(e,t,i,s){for(const r of i.parts??[]){if(r.type==="tool")this.applyTool(e,t,r.toolCall);else if(r.type==="thinking"){e.phase="thinking";e.activity="Thinking"}else if(r.type==="text"){e.phase="responding";e.activity="Responding"}}for(const r of i.toolCalls??[])this.applyTool(e,t,r);if(!i.parts?.length&&!i.toolCalls?.length){if(i.thinking!==void 0){e.phase="thinking";e.activity="Thinking"}if(i.content!==void 0){e.phase="responding";e.activity="Responding"}}e.updatedAtMs=s}applyTool(e,t,i){const s=V6(i.input);const r=i.id??`${t}:${kw(i.name)}:${s}`;e.toolIds.add(r);e.phase="tool";e.activity=G6(i.name,s)}resetActivity(e,t){e.toolIds=new Set;e.phase=e.status==="waiting"?"waiting":"running";e.activity=e.status==="waiting"?"Waiting for input":"Starting";e.updatedAtMs=t}};function Rw(n){const e=n.members.filter(i=>Aw(i.status));const t=n.members.filter(i=>!Aw(i.status));return[...e,...t].slice(0,3)}function Gr(n,e){const t=n.status==="done"||n.status==="failed"||n.status==="stopped"?n.updatedAtMs:e;return Math.max(0,t-n.startedAtMs)}function zr(n,e){const t=new Map(e.members.map(o=>[o.sessionId,o]));const i=[n.agentName];const s=new Set([n.sessionId]);let r=n.parentSessionId;while(r&&r!==e.rootSessionId&&!s.has(r)){s.add(r);const o=t.get(r);if(!o)break;i.unshift(o.agentName);r=o.parentSessionId}return i.slice(-4).join(" \u203A ")}function H6(n,e){if(n==="failed")return"failed";if(n==="stopped")return"stopped";if(n==="completed")return"done";if(e==="terminal")return"done";if(e==="decision-blocked")return"waiting";if(e==="running"||n==="running")return"running";return"queued"}function U6(n,e){if(n==="failed")return{phase:"failed",activity:"Failed"};if(n==="waiting")return{phase:"waiting",activity:"Waiting for input"};if(n==="running")return{phase:"running",activity:"Starting"};if(n==="queued")return{phase:"queued",activity:"Queued"};if(n==="done")return{phase:"done",activity:"Done"};return{phase:"stopped",activity:"Stopped"}}function w1(n){return n==="running"||n==="waiting"}function Aw(n){return n==="queued"||w1(n)}function K6(n){return n==="done"||n==="failed"||n==="stopped"}function W6(n){return{sessionId:n.sessionId,parentSessionId:n.parentSessionId,agentName:n.agentName,task:n.task,status:n.status,phase:n.phase,activity:n.activity,toolCount:n.toolIds.size,...n.turnId?{turnId:n.turnId}:{},startedAtMs:n.startedAtMs,updatedAtMs:n.updatedAtMs,...n.errorMessage?{errorMessage:n.errorMessage}:{}}}function j6(n){return n.reduce((e,t)=>({...e,[t.status]:e[t.status]+1}),{total:n.length,running:0,waiting:0,queued:0,done:0,failed:0,stopped:0})}function V6(n){if(n===void 0)return"";try{return Q6(es(typeof n==="string"?n:JSON.stringify(n)))}catch{return""}}function G6(n,e){const t=kw(n);const i=t==="read"||t==="readfile"?"Reading":t==="grep"||t==="glob"||t==="search"?"Searching":t==="edit"||t==="editfile"||t==="replace"?"Editing":t==="write"||t==="writefile"?"Writing":t.includes("test")?"Running tests":t==="bash"||t==="exec"||t==="shell"?"Running command":`Using ${Us(n,"tool")}`;return e&&z6(t)?`${i} ${e}`:i}function z6(n){return n==="read"||n==="readfile"||n==="grep"||n==="glob"||n==="search"||n==="edit"||n==="editfile"||n==="replace"||n==="write"||n==="writefile"}function Q6(n){const e=Us(n,"").replace(/\b(authorization)(\s*[:=]\s*)(?:(?:Basic|Bearer)\s+)?(?:"[^"]*"|'[^']*'|[^\s,;]+)/giu,"$1$2[redacted]").replace(/\bBearer\s+[^\s,;]+/giu,"Bearer [redacted]").replace(/\b(authorization|api[-_ ]?key|access[-_ ]?token|token|password|secret)(\s*[:=]\s*)[^\s,;]+/giu,"$1$2[redacted]");return e.length>160?`${e.slice(0,159)}\u2026`:e}function kw(n){return n.trim().toLocaleLowerCase().replace(/[^a-z0-9]/gu,"")}function Us(n,e){const t=n?x(n).replace(/[\r\n\t]+/gu," ").trim():"";return t||e}function ae(n,e,t){const i=Math.max(0,Math.floor(n));const s=e===void 0?Infinity:Math.max(0,Math.floor(e));const r=i>=12&&s>=6;const o=ft(i,r);const a=fi(t,o);const u=Math.max(1,Math.floor((s-2)/3));const l=a.length<=u?a:[...a.slice(0,Math.max(0,u-1)),...a.slice(-1)];const d=(r?2:1)+l.length+(r&&l.length?1:0);const h=Math.max(0,s-d);return{contentWidth:o,bodyHeight:h,render(m,f="signal"){if(!i||!s)return[];const y=m.body.slice(0,h);const T=r?gi(m.title,m.meta,i,f):E(p.bold.hex(c[f])(m.title),i,"\u2026");const b=r?[T,...y.map(v=>Ee(v,i)),...l.length?[Qn(i),...l.map(v=>Ee(v,i))]:[],yi(i)]:[T,...y,...l];return(s===1&&l.length?l.slice(-1):b.slice(0,s)).map(v=>E(v,i,""))}}}function zn(n,e,t,i="signal"){return ae(e,t,n.footer).render(n,i)}function ft(n,e=n>=12){return Math.max(0,Math.floor(n)-(e?4:0))}function fi(n,e){if(!n||e<=0)return[];const t=typeof n==="string"?[n]:n;const i=t.flatMap(o=>oe(o).split(" \xB7 "));const s=i.filter(o=>/^(?:Esc|Ctrl\+C)\b/iu.test(o));const r=i.filter(o=>!/^(?:Esc|Ctrl\+C)\b/iu.test(o));return[[...r,...s].join(" \xB7 ")].flatMap(o=>{const a=[];let u="";for(const l of oe(o).split(" \xB7 ")){const d=u?`${u} \xB7 ${l}`:l;if(w(d)<=e){u=d;continue}if(u)a.push(u);const h=J(l,Math.max(1,e));a.push(...h.slice(0,-1));u=h.at(-1)??""}if(u)a.push(u);return a.map(Y)})}function gi(n,e,t,i="signal"){if(t<12)return E(p.bold.hex(c[i])(n),Math.max(0,t),"");const s=p.hex(c.line);const r=e?t-w(e)-8:0;const o=r>=6?r:t-6;const a=p.bold.hex(c[i])(E(n,Math.max(1,o),"\u2026"));const u=`${s("\u256D\u2500")} ${a} `;const l=e?` ${p.hex(c.muted)(e)} ${s("\u2500\u256E")}`:s("\u256E");if(w(u)+w(l)<=t){return`${u}${s("\u2500".repeat(t-w(u)-w(l)))}${l}`}return E(`${u}${s("\u2500".repeat(Math.max(0,t-w(u)-1)))}${s("\u256E")}`,t,"")}function Ee(n,e){if(e<4)return E(n,Math.max(0,e),"");const t=p.hex(c.line);const i=Math.max(0,e-4);const s=E(n,i,"");return`${t("\u2502")} ${s}${" ".repeat(Math.max(0,i-w(s)))} ${t("\u2502")}`}function Qn(n){return E(p.hex(c.line)(`\u251C${"\u2500".repeat(Math.max(0,n-2))}\u2524`),Math.max(0,n),"")}function yi(n){return E(p.hex(c.line)(`\u2570${"\u2500".repeat(Math.max(0,n-2))}\u256F`),Math.max(0,n),"")}var Yn=class extends ii{activeRow;ensureActiveRowOnLayout=false;constructor(e,t={}){super(e,t)}setActiveRow(e,t=false){const i=Math.max(0,Math.floor(e));if(!t&&this.activeRow===i)return;this.activeRow=i;this.ensureActiveRowOnLayout=true}setActiveRowPreservingScroll(e){this.activeRow=Math.max(0,Math.floor(e))}updateLayout(e,t,i){super.updateLayout(e,t,i);if(!this.ensureActiveRowOnLayout||this.activeRow===void 0)return;this.ensureActiveRowOnLayout=false;if(this.activeRow<this.scrollTop){this.scrollTo(this.activeRow,{disableFollow:true});return}if(this.viewportHeight>0&&this.activeRow>=this.scrollTop+this.viewportHeight){this.scrollTo(this.activeRow-this.viewportHeight+1,{disableFollow:true})}}};var Bd=class{constructor(e){this.options=e;const t={render:r=>this.renderHeader(r),invalidate:()=>void 0};const i={render:r=>this.renderFramedBody(r),invalidate:()=>void 0};const s={render:r=>this.renderFooter(r),invalidate:()=>void 0};this.bodyViewport=new Yn(i,{primary:true,overscroll:"contain"});this.layoutRoot=new Ot([{component:t,basis:"auto",shrink:1,minSize:1},{component:this.bodyViewport,basis:0,grow:1,shrink:1,minSize:1},{component:s,basis:"auto",shrink:1,minSize:1}])}options;id="agent-team";layoutRoot;bodyViewport;selectedIndex=0;selectedSessionId;invalidate(){this.layoutRoot.invalidate()}handleInput(e){const t=this.options.snapshot().members;this.syncSelection(t);if(S(e,"escape")||S(e,"ctrl+c")){this.options.onCancel();return}if(t.length===0)return;if(S(e,"up")){this.selectedIndex=this.selectedIndex===0?t.length-1:this.selectedIndex-1;this.selectedSessionId=t[this.selectedIndex]?.sessionId;this.bodyViewport.setActiveRow(this.selectedIndex,true);this.options.requestRender();return}if(S(e,"down")){this.selectedIndex=(this.selectedIndex+1)%t.length;this.selectedSessionId=t[this.selectedIndex]?.sessionId;this.bodyViewport.setActiveRow(this.selectedIndex,true);this.options.requestRender();return}if(S(e,"enter")){const s=t[this.selectedIndex];if(s)void this.options.onSelect(s.sessionId);return}const i=st(e)??e;if(i==="q"||i==="Q")this.options.onCancel()}render(e){return[...this.renderHeader(e),...this.renderFramedBody(e),...this.renderFooter(e)]}renderHeader(e){const t=Math.max(0,Math.floor(e));if(t===0)return[];const i=this.options.snapshot();return[gi(Y6(i),void 0,t)].map(s=>E(s,t,""))}renderFramedBody(e){const t=this.renderBody(ft(e));while(t.length<this.bodyViewport.viewportHeight)t.push("");return t.map(i=>Ee(i,e))}renderBody(e){const t=Math.max(0,Math.floor(e));if(t===0)return[];const i=this.options.snapshot();this.syncSelection(i.members);this.bodyViewport.setActiveRow(this.selectedIndex);if(i.members.length===0)return[p.hex(c.dim)("No delegated agents")];return i.members.map((s,r)=>X6(s,r===this.selectedIndex,i,this.options.activeSessionId(),t)).map(s=>E(s,t,""))}renderFooter(e){const t=Math.max(0,Math.floor(e));if(t===0)return[];return[Qn(t),...fi("\u2191\u2193 select \xB7 PgUp/PgDn scroll \xB7 Enter open transcript \xB7 Esc return",ft(t)).map(i=>Ee(i,t)),yi(t)]}syncSelection(e){if(e.length===0){this.selectedIndex=0;this.selectedSessionId=void 0;return}const t=this.selectedSessionId??this.options.activeSessionId();const i=t?e.findIndex(s=>s.sessionId===t):-1;this.selectedIndex=i>=0?i:Math.min(this.selectedIndex,e.length-1);this.selectedSessionId=e[this.selectedIndex]?.sessionId;this.bodyViewport.setActiveRow(this.selectedIndex)}};function Y6(n){const{summary:e}=n;return[`Agents \xB7 ${String(e.total)} total`,e.running?`${String(e.running)} running`:void 0,e.waiting?`${String(e.waiting)} waiting`:void 0,e.queued?`${String(e.queued)} queued`:void 0,e.done?`${String(e.done)} done`:void 0,e.failed?`${String(e.failed)} failed`:void 0,e.stopped?`${String(e.stopped)} stopped`:void 0].filter(t=>Boolean(t)).join(" \xB7 ")}function X6(n,e,t,i,s){const r=e?p.bold.hex(c.signal)("\u203A"):" ";const o=(e?p.bold.hex(c.signal):p.hex(c.text))(zr(n,t));const a=Z6(n.status,J6(n.status));const u=n.sessionId===i?p.hex(c.signal)("current"):"";const l=e3(Gr(n,t.capturedAtMs));const d=n.toolCount?`${String(n.toolCount)} tools`:"";if(s<54){return`${r} ${a} ${p.hex(c.muted)(n.activity)} \xB7 ${o}`}const h=n.task===n.activity?"":n.task;return`${r} ${o} ${a} ${p.hex(c.muted)([n.activity,h].filter(Boolean).join(" \xB7 "))} ${p.hex(c.dim)([d,l,u].filter(Boolean).join(" \xB7 "))}`}function J6(n){if(n==="done")return"Done";return`${n.charAt(0).toLocaleUpperCase()}${n.slice(1)}`}function Z6(n,e){if(n==="failed")return p.hex(c.error)(e);if(n==="waiting")return p.hex(c.warning)(e);if(n==="done")return p.hex(c.success)(e);if(n==="stopped")return p.hex(c.muted)(e);return p.hex(c.accent)(e)}function e3(n){const e=Math.floor(n/1e3);if(e<60)return`${String(e)}s`;const t=Math.floor(e/60);if(t<60)return`${String(t)}m`;return`${String(Math.floor(t/60))}h`}var qd=class{constructor(e){this.options=e;const t={render:r=>this.renderHeader(r),invalidate:()=>void 0};const i={render:r=>this.renderFramedBody(r),invalidate:()=>void 0};const s={render:r=>this.renderFooter(r),invalidate:()=>void 0};this.bodyViewport=new Yn(i,{primary:true,overscroll:"contain"});this.layoutRoot=new Ot([{component:t,basis:"auto",shrink:1,minSize:1},{component:this.bodyViewport,basis:0,grow:1,shrink:1,minSize:1},{component:s,basis:"auto",shrink:1,minSize:1}])}options;id="background-work";layoutRoot;bodyViewport;selectedIndex=0;selectedKey;detailTaskId;invalidate(){this.layoutRoot.invalidate()}handleInput(e){const t=st(e)??e;if(t==="q"||t==="Q"){this.options.onCancel();return}if(S(e,"escape")||S(e,"ctrl+c")){if(this.detailTaskId){this.detailTaskId=void 0;this.bodyViewport.setActiveRow(this.selectedIndex,true);this.options.requestRender()}else{this.options.onCancel()}return}if(this.detailTaskId)return;const i=this.view().entries;this.syncSelection(i);if(i.length===0)return;if(S(e,"up")){this.select(i,this.selectedIndex===0?i.length-1:this.selectedIndex-1);return}if(S(e,"down")){this.select(i,(this.selectedIndex+1)%i.length);return}if(!S(e,"enter"))return;const s=i[this.selectedIndex];if(!s)return;if(s.kind==="agent"){void this.options.onOpenAgent(s.member.sessionId);return}this.detailTaskId=s.task.taskId;this.bodyViewport.setActiveRow(0,true);this.options.requestRender()}render(e){const t=this.view();return[...this.renderHeader(e,t),...this.renderFramedBody(e,t),...this.renderFooter(e,t)]}renderHeader(e,t=this.view()){const i=M1(e);if(i===0)return[];const{entries:s}=t;const r=s.filter(n3).length;const o=s.filter(i3).length;const a=[`${String(s.length)} total`,r>0?`${String(r)} active`:void 0,o>0?`${String(o)} failed`:void 0].filter(u=>Boolean(u));return[gi("Tasks",a.join(" \xB7 "),i)].map(u=>E(u,i,""))}renderFramedBody(e,t=this.view()){const i=this.renderBody(ft(e,e>=4),t);while(i.length<this.bodyViewport.viewportHeight)i.push("");return i.map(s=>Ee(s,e))}renderBody(e,t=this.view()){const i=M1(e);if(i===0)return[];if(this.detailTaskId)return this.renderTaskDetail(this.detailTaskId,i);const{agentTeam:s,entries:r}=t;this.syncSelection(r);this.bodyViewport.setActiveRowPreservingScroll(this.selectedIndex);if(r.length===0){return[E(p.hex(c.dim)("No background work"),i,"")]}return r.map((o,a)=>E(t3(o,a===this.selectedIndex,s,i),i,p.hex(c.dim)("\u2026")))}renderTaskDetail(e,t){const i=this.options.backgroundTasks().find(s=>s.taskId===e);if(!i){return[E(p.bold.hex(c.error)("Background task unavailable"),t,""),E(p.hex(c.muted)("The Runtime task list changed. Press Esc to return."),t,"")]}return[...J(p.bold.hex(r3(i.status))(`Background task \xB7 ${Lw(i.status)}`),t),"",...I1("Task ID",i.taskId,t),...i.lastError?["",...I1("Error",i.lastError,t,c.error)]:[],"",...I1(i.command!==void 0?"Command":"Description",i.command??i.description??i.kind,t)]}renderFooter(e,t=this.view()){const i=M1(e);if(i===0)return[];let s;if(this.detailTaskId){s="PgUp/PgDn scroll \xB7 Esc back \xB7 Q close"}else{this.syncSelection(t.entries);const r=t.entries[this.selectedIndex];const o=r?.kind==="agent"?"Enter open transcript":r?.kind==="runtime-task"?"Enter inspect":void 0;s=["\u2191\u2193 select","PgUp/PgDn scroll",o,"Esc return"].filter(Boolean).join(" \xB7 ")}return[Qn(i),...fi(s,ft(i)).map(r=>Ee(r,i)),yi(i)]}view(){const e=this.options.agentTeam();return{agentTeam:e,entries:this.entries(e)}}entries(e){const t=e.members.map(s=>({key:`agent:${s.sessionId}`,kind:"agent",member:s}));const i=this.options.backgroundTasks().map(s=>({key:`task:${s.taskId}`,kind:"runtime-task",task:s}));return[...t,...i]}syncSelection(e){if(e.length===0){this.selectedIndex=0;this.selectedKey=void 0;return}const t=this.selectedIndex;const i=this.selectedKey??this.activeAgentKey(e);const s=i?e.findIndex(r=>r.key===i):-1;this.selectedIndex=s>=0?s:Math.min(this.selectedIndex,e.length-1);this.selectedKey=e[this.selectedIndex]?.key;if(this.selectedIndex!==t){this.bodyViewport.setActiveRow(this.selectedIndex,true)}}activeAgentKey(e){const t=this.options.activeSessionId();return t&&e.some(i=>i.key===`agent:${t}`)?`agent:${t}`:void 0}select(e,t){this.selectedIndex=t;this.selectedKey=e[t]?.key;this.bodyViewport.setActiveRow(t,true);this.options.requestRender()}};function I1(n,e,t,i=c.text){return[...J(p.hex(c.muted)(n),t),...J(p.hex(i)(x(e).replaceAll(" "," ")),t)]}function t3(n,e,t,i){const s=e?p.bold.hex(c.signal)("\u203A"):" ";if(n.kind==="agent"){const d=n.member;const h=zr(d,t);const m=a3(Gr(d,t.capturedAtMs));const f=[d.activity,d.task,`${String(d.toolCount)} tools`,m].filter((y,T,b)=>Boolean(y)&&b.indexOf(y)===T).join(" \xB7 ");return`${s} ${Pw(d.status)} ${p.hex(c.dim)("[Agent]")} ${p.bold.hex(e?c.signal:c.text)(h)} ${p.hex(c.muted)(f)}`}const r=n.task;const o=`[${r.kind==="bash"?"Bash":Ow(r.kind)}]`;const a=o3(r.description??r.kind);const u=[Lw(r.status),_w(r.taskId)].join(" \xB7 ");const l=`${s} ${Pw(r.status)} ${p.hex(c.dim)(o)} ${p.bold.hex(e?c.signal:c.text)(a)} ${p.hex(c.muted)(u)}`;return i<48?l.replace(` ${_w(r.taskId)}`,""):l}function n3(n){if(n.kind==="agent"){return n.member.status==="queued"||n.member.status==="running"||n.member.status==="waiting"}return s3(n.task.status)}function i3(n){return n.kind==="agent"?n.member.status==="failed":n.task.status==="failed"||n.task.status==="lost"}function s3(n){return n==="queued"||n==="running"||n==="stopping"}function Pw(n){if(n==="failed"||n==="lost")return p.hex(c.error)("\xD7");if(n==="waiting"||n==="stopping")return p.hex(c.warning)("\u25C9");if(n==="done"||n==="succeeded")return p.hex(c.success)("\u2713");if(n==="stopped"||n==="canceled")return p.hex(c.muted)("\u25A0");return p.hex(c.accent)("\u25CF")}function r3(n){if(n==="failed"||n==="lost")return c.error;if(n==="stopping")return c.warning;if(n==="succeeded")return c.success;if(n==="canceled")return c.muted;return c.accent}function Lw(n){if(n==="canceled")return"Cancelled";return Ow(n)}function Ow(n){return`${n.charAt(0).toLocaleUpperCase()}${n.slice(1)}`}function o3(n){return x(n).replace(/\s+/gu," ").trim()}function _w(n){return n.length>16?`${n.slice(0,15)}\u2026`:n}function a3(n){const e=Math.max(0,Math.floor(n/1e3));if(e<60)return`${String(e)}s`;const t=Math.floor(e/60);if(t<60)return`${String(t)}m`;return`${String(Math.floor(t/60))}h`}function M1(n){return Number.isFinite(n)?Math.max(0,Math.floor(n)):0}import{extname as u3}from"node:path";var l3={".bash":"bash",".c":"c",".cc":"cpp",".cpp":"cpp",".css":"css",".go":"go",".h":"c",".hpp":"cpp",".html":"html",".java":"java",".js":"javascript",".json":"json",".jsx":"jsx",".md":"markdown",".mjs":"javascript",".py":"python",".rb":"ruby",".rs":"rust",".sh":"bash",".sql":"sql",".toml":"toml",".ts":"typescript",".tsx":"tsx",".yaml":"yaml",".yml":"yaml",".zsh":"bash"};function d3(n){if(!n)return void 0;const e=n.split(/[\\/]/u).at(-1)?.toLocaleLowerCase();if(e==="dockerfile")return"dockerfile";if(e==="makefile")return"makefile";return l3[u3(n).toLocaleLowerCase()]}function E1(n,e){const t=x(n);return jt.highlightCode?.(t,e)??t.split("\n")}function Ha(n,e){return E1(n,d3(e))}function Dw(n,e){const t=n.map(c3).join("\n");return Ha(t,e)}function c3(n){if(h3(n))return"";return/^[+\- ]/u.test(n)?n.slice(1):n}function h3(n){return n.startsWith("@@")||n.startsWith("diff --git ")||n.startsWith("index ")||n.startsWith("--- ")||n.startsWith("+++ ")}function Qr(n,e,t={}){const i=Math.max(0,Math.floor(e));if(i===0||n.blocks.length===0)return[];const s=t.prefix??" ";let r=Math.max(1,t.maxBodyLines??14);const o=[];for(const[a,u]of n.blocks.entries()){if(r<=0){const d=n.blocks.length-a;o.push(Ua(`${s}${p.hex(c.dim)("\u2514")} ${p.hex(c.muted)(`${d} more ${d===1?"change":"changes"} hidden`)}`,i));break}const l=p3(u,n,i,s,r);o.push(...l.lines);r-=l.bodyLines}return o}function p3(n,e,t,i,s){const r=x(n.path??"file");const o=f3(e.state);const a=n.kind==="diff"?`${p.hex(c.success)(`+${n.addedLines}`)} ${p.hex(c.error)(`-${n.removedLines}`)}`:n.kind==="file"?`${n.lineCount} ${n.lineCount===1?"line":"lines"}`:void 0;const u=Ua(`${i}${p.hex(c.dim)("\u250C")} ${p.bold.hex(c.text)(r)}${a?p.hex(c.muted)(` \xB7 ${a}`):""}${p.hex(g3(e.state))(` \xB7 ${o}`)}`,t);if(n.kind==="summary"){return{lines:[u,Ua(`${i}${p.hex(c.dim)("\u2514")} ${p.hex(c.muted)(x(n.message))}`,t)],bodyLines:1}}const l=n.kind==="diff"?x(n.diff).split("\n"):x(n.content).split("\n");const d=l.slice(0,s);const h=n.kind==="file"?Ha(d.join("\n"),n.path):[];const m=n.kind==="diff"?Dw(d,n.path):[];const f=Math.max(0,l.length-d.length)+(n.omittedLines??0);const y=n.kind==="file"?String(n.lineCount).length:0;const T=`${i}${p.hex(c.dim)("\u2502")} `;const b=Math.max(1,t-w(T));const v=d.map((R,L)=>{const _=n.kind==="diff"?m3(R,m[L]??"",b):`${p.hex(c.dim)(String(L+1).padStart(y))} ${h[L]??p.hex(c.text)(R)}`;return Ua(`${T}${_}`,t)});const C=f>0?`${f} ${f===1?"line":"lines"} hidden`:n.truncated?"Preview truncated":void 0;const I=C?[Ua(`${i}${p.hex(c.dim)("\u2514")} ${p.hex(c.muted)(C)}`,t)]:[];return{lines:[u,...v,...I],bodyLines:d.length}}function m3(n,e,t){if(n.startsWith("+")&&!n.startsWith("+++")){const i=`${p.bold.hex(c.success)("+")}${e}`;return Et(i,t,p.bgHex(c.diffAddedBg))}if(n.startsWith("-")&&!n.startsWith("---")){const i=`${p.bold.hex(c.error)("-")}${e}`;return Et(i,t,p.bgHex(c.diffRemovedBg))}if(n.startsWith("@@"))return p.hex(c.accent)(n);if(n.startsWith("diff --git ")||n.startsWith("index ")||n.startsWith("--- ")||n.startsWith("+++ ")){return p.hex(c.muted)(n)}if(n.startsWith(" ")){return`${p.hex(c.dim)(" ")}${e}`}return e||p.hex(c.muted)(n)}function f3(n){if(n==="applied")return"Applied";if(n==="not-applied")return"Not applied";return"Proposed"}function g3(n){if(n==="applied")return c.success;if(n==="not-applied")return c.error;return c.warning}function Ua(n,e){return E(n,e,p.hex(c.muted)("\u2026"))}import{basename as A1,isAbsolute as R1,relative as y3,resolve as Fw,sep as Nw}from"node:path";import{fileURLToPath as T3,pathToFileURL as b3}from"node:url";function Ka(n,e,t=process.cwd()){const i=Math.max(0,Math.floor(e));if(n.length===0||i===0)return[];const s="Created ";const r=w(s);const o=" ".repeat(r);const a=[];n.forEach((u,l)=>{const d=x(u.path).trim();const h=C3(d,t);const m=x3(u,d,h);const f=S3(d,t);const y=p.hex(c.dim)(l===0?s:o);const T=m?p.hex(c.muted)(` \xB7 ${m}`):"";a.push(...w3(`${v3(`${h||"file"} \u2197`,f)}${T}`,y,p.hex(c.dim)(o),i))});return a}function v3(n,e){const t=p.underline.hex(c.signal)(n);return e?Hn(t,e):t}function S3(n,e){if(/^https?:\/\//iu.test(n)||/^file:\/\//iu.test(n))return n;const t=R1(n)||n.startsWith("./")||n.startsWith("../")||/[\\/]/u.test(n)||/\.[A-Za-z0-9]{1,12}$/u.test(n);if(!t)return void 0;try{return b3(Fw(e,n)).href}catch{return void 0}}function C3(n,e){if(!n)return"file";try{if(/^https?:\/\//iu.test(n)){const r=new URL(n);return A1(decodeURIComponent(r.pathname))||r.hostname}const t=/^file:\/\//iu.test(n)?T3(n):n;const i=R1(t)?t:Fw(e,t);const s=y3(e,i);if(s&&s!==".."&&!s.startsWith(`..${Nw}`)&&!R1(s)){return s.split(Nw).join("/")}return A1(t)||t}catch{return A1(n)||n}}function x3(n,e,t){const i=x(n.name??"").trim();const s=e.split(/[\\/]/u).filter(Boolean).at(-1);if(!i||i===e||i===s||i===t)return void 0;const r=e?i.indexOf(e):-1;const o=(r<0?i:i.slice(0,r)).trimEnd().replace(/[\s·•|:—–-]+$/u,"").trimEnd();return o&&o!==t&&o!==s?o:void 0}function w3(n,e,t,i){const s=Math.max(1,i-w(e));const r=Math.max(1,i-w(t));const o=J(n,Math.min(s,r));if(o.length===0)return[E(e,i,"")];return o.map((a,u)=>E(`${u===0?e:t}${a}`,i,""))}function Wa(n,e){const t=x(n).replace(/\t/gu," ").replace(/[\r\n]+$/u,"");if(!t.trim())return[];const i=p.hex(c.text);return J(t,Math.max(1,e)).map(s=>s?i(s):s)}var I3=[{names:["bash"],family:"shell",runningAction:"Running",completedAction:"Ran",failedAction:"Command failed",previewLines:{running:3,completed:3,failed:8}},{names:["edit","edit_file","apply_patch"],family:"edit",runningAction:"Editing",completedAction:"Edited",failedAction:"Edit failed",previewLines:{running:3,completed:3,failed:8}},{names:["grep","search"],family:"search",runningAction:"Searching",completedAction:"Searched",failedAction:"Search failed",failedActionsByCode:{invalid_regex:"Invalid search pattern"},previewLines:{running:3,completed:3,failed:6}},{names:["glob","list","list_files"],family:"search",runningAction:"Listing",completedAction:"Listed",failedAction:"List failed"},{names:["run_code"],runningAction:"Running code",completedAction:"Ran code",failedAction:"Code failed",previewLines:{running:3,completed:3,failed:8}},{names:["memory"],runningAction:"Updating memory",completedAction:"Updated memory",failedAction:"Memory update failed"},{names:["read","read_file","readfile"],family:"read",runningAction:"Reading",completedAction:"Read",failedAction:"Read failed"},{names:["write","write_file"],family:"write",runningAction:"Writing",completedAction:"Wrote",failedAction:"Write failed",previewLines:{running:3,completed:3,failed:8}},{names:["task","delegate","spawn_agent"],family:"task",runningAction:"Delegating",completedAction:"Delegated",failedAction:"Delegation failed",previewLines:{running:3,completed:3,failed:8}},{names:["task_output"],family:"task-control",summaryStyle:"dot",succeededMarker:"check",runningAction:"Reading task result",completedAction:"Read task result",failedAction:"Read task result"},{names:["task_query"],family:"task-control",summaryStyle:"dot",succeededMarker:"check",runningAction:"Checking background tasks",completedAction:"Checked background tasks",failedAction:"Background task check failed"},{names:["web_search","matrix_web_search","mcp__matrix__web_search"],runningAction:"Using WebSearch",completedAction:"Used WebSearch",failedAction:"WebSearch failed",accentLabel:"WebSearch"},{names:["web_fetch"],runningAction:"Using WebFetch",completedAction:"Used WebFetch",failedAction:"WebFetch failed",accentLabel:"WebFetch"},{names:["mcp"],family:"mcp",runningAction:"Calling",completedAction:"Called",failedAction:"Call failed",previewLines:{running:3,completed:3,failed:8}}];var $w=new Map(I3.flatMap(n=>n.names.map(e=>[Gt(e),n])));function Ti(n){const e=Gt(n);return $w.get(e)??(M3(e)?$w.get("mcp"):void 0)}function Bw(n,e){return(e?n.failedActionsByCode?.[e]:void 0)??n.failedAction??n.completedAction}function Gt(n){return n?.trim().toLocaleLowerCase().replaceAll("-","_")||"tool"}function qw(n,e){if(e?.family!=="mcp")return void 0;const t=Gt(n);if(t.startsWith("mcp__")){const[,i,...s]=t.split("__");return i&&s.length>0?`${i}.${s.join(".")}`:t}if(t.startsWith("mcp_"))return t.slice(4).replaceAll("__",".");return t==="mcp"?void 0:t}function M3(n){return n==="mcp"||n.startsWith("mcp__")||n.startsWith("mcp_")}var E3=512*1024;var A3=1e4;var R3=4*1024;var k3=new Set(["&&","||","|",";","&","(","{","\n"]);var P3=new Set(["do","elif","else","if","then","until","while"]);var _3=new Set(["case","do","done","elif","else","esac","fi","for","function","if","in","select","then","time","until","while"]);function Hd(n){if(n===void 0)return void 0;const e=n.trim();if(!e.startsWith("{"))return n;try{const t=JSON.parse(e);if(!t||typeof t!=="object"||Array.isArray(t))return void 0;const i=t.command;return typeof i==="string"?i:void 0}catch{return n}}function ja(n){if(L3(n))return p.hex(c.text)(n);const e=O3(n);if(e.length===0)return _d(n,"bash").join("\n");const t=e.map((r,o)=>({...r,token:n.slice(r.start,r.end),placeholder:q3(n,o)}));let i=n;for(const r of[...t].reverse()){i=`${i.slice(0,r.start)}${r.placeholder}${i.slice(r.end)}`}let s=_d(i,"bash").join("\n");for(const r of t){s=s.replace(r.placeholder,`${p.bold.hex(c.accent)(r.token)}${H3(c.text)}`)}return s}function Uw(n){return ja(n).split("\n")}function L3(n){if(Hw(n)>E3)return true;const e=n.split("\n");return e.length>A3||e.some(t=>Hw(t)>R3)}function Hw(n){return new TextEncoder().encode(n).byteLength}function O3(n){const e=[];let t=true;let i=0;while(i<n.length){const s=n[i]??"";if(s===" "||s===" "||s==="\r"){i+=1;continue}if(s==="#"){i=F3(n,i);continue}const r=D3(n,i);if(r){if(k3.has(r.value))t=true;i=r.end;continue}const o=N3(n,i);if(o.end===i){i+=1;continue}i=o.end;if(!t)continue;const a=$3(n.slice(o.start,o.end));if(B3(a))continue;if(_3.has(a)){t=P3.has(a);continue}e.push(o);t=false}return e}function D3(n,e){const t=n.slice(e,e+2);if(t==="&&"||t==="||")return{value:t,end:e+2};const i=n[e];if("|;&(){}\n<>".includes(i??"")){return{value:i??"",end:e+1}}return void 0}function N3(n,e){let t=e;let i;while(t<n.length){const s=n[t]??"";if(s==="\\"){t=Math.min(n.length,t+2);continue}if(i){if(s===i)i=void 0;t+=1;continue}if(s==="'"||s==='"'){i=s;t+=1;continue}if(/\s/u.test(s)||"|;&(){}<>".includes(s))break;t+=1}return{start:e,end:t}}function F3(n,e){const t=n.indexOf("\n",e);return t===-1?n.length:t}function $3(n){if(n.length>=2){const e=n[0];const t=n.at(-1);if((e==="'"||e==='"')&&t===e)return n.slice(1,-1)}return n}function B3(n){return/^[A-Za-z_][A-Za-z0-9_]*=/u.test(n)}function q3(n,e){let t=`MCODECOMMANDTOKEN${String(e)}X`;while(n.includes(t))t+="X";return t}function H3(n){const e="MCODECOLOR";const t=p.hex(n)(e);const i=t.indexOf(e);return i<0?"":t.slice(0,i)}var U3=/<bash_background\b/iu;var K3=/<bash_background\b[^>]*\btask_id=["']([^"']+)["']/iu;function Kw(n){if(!n)return void 0;const e=x(n);const t=e.split(/\r\n?|\n/u);const i=t[0]?.trim()??"";if(!i)return void 0;const s=t.slice(1).some(r=>r.trim().length>0);return s?`${i}\u2026`:i}function W3(n,e){const t=Kw(n);return[t,e].filter(Boolean).join(" \xB7 ")||void 0}function k1(n){return j3(n.title,n.content,n.detail)}function j3(n,e,t){if(Gt(n)!=="bash")return false;return P1(n,e)||U3.test(t??"")}function P1(n,e){return Gt(n)==="bash"&&Kd(e).runInBackground===true}function Va(n,e,t){const i=Kd(n.content);const s=e?.family;if(k1(n)){return Q3(n,t)}if(s==="shell")return jw(n,t);if(s==="read")return X3(n,i,t);if(s==="search")return J3(n,i,t);if(s==="task-control")return V3(n,i,t);return Vw(n,t)}function V3(n,e,t){const i=Gt(n.title);const s=i==="task_output"?[Ww(e.taskId),G3(n)].filter(Boolean).join(" \xB7 "):z3(n.detail,e.taskId);if(n.status==="failed")return Ud(n.detail,s,t);return{...Vw(n,t),...s?{summary:s}:{}}}function G3(n){if(n.status!=="failed")return void 0;const e=n.detail??"";if(/\b(?:local\s+)?background\s+task\s+not\s+found\b/iu.test(e)){return"task not found"}if(/\bowned\s+by\s+another\s+session\b/iu.test(e))return"access denied";return"failed"}function z3(n,e){const t=[...(n??"").matchAll(/\[[^/\]\s]+\/(queued|running|stopping|succeeded|failed|canceled|lost)\]/giu)].map(i=>i[1]?.toLocaleLowerCase());if(t.length>0){const i=t.filter(s=>s==="succeeded"||s==="failed"||s==="canceled"||s==="lost").length;return i===t.length?`${i} done`:`${i}/${t.length} done`}if(/\bno\s+local\s+background\s+tasks\b/iu.test(n??""))return"no tasks";return Ww(e)??""}function Ww(n){if(!n)return void 0;return n.length>7?`${n.slice(0,6)}\u2026`:n}function Q3(n,e){const t=jw({...n,status:"running",detail:void 0},e);const i=n.status==="failed"?Ud(n.detail,void 0,e):{lines:[]};const s=K3.exec(n.detail??"")?.[1];return{summary:[Kd(n.content).description,s].filter(Boolean).join(" \xB7 "),lines:[...t.lines,...i.lines],handlesDetail:true}}function jw(n,e){const t=Ga(n.detail);const i=Hd(n.content)?.trim();const s=[];if(e.displayMode!=="collapsed"&&i){const o=Uw(i);const a=e.displayMode==="expanded"?o.length:2;o.slice(0,a).forEach((u,l)=>{const d=l===0?p.bold.hex(c.signal)("$ "):" ";s.push(zt(`${d}${u}`,e))});if(o.length>a){s.push(zt(p.hex(c.muted)(`\u2026 ${o.length-a} more command lines`),e))}}if(e.displayMode!=="collapsed"){if(t.length>0){const o=e.displayMode==="expanded"?t.length:n.status==="failed"?6:3;const a=_1(t,o,n.status==="running"||n.status==="pending"||n.status==="failed"?"tail":"head-tail");a.forEach(u=>{if(u.kind==="omitted"){s.push(zt(p.hex(c.muted)(u.label),e));return}const l=p.hex(c.dim)("\u2502 ");const d=n.status==="failed"?p.hex(c.error)(u.value):p.hex(c.muted)(u.value);s.push(zt(`${l}${d}`,e))})}else if(n.status==="succeeded"){s.push(zt(p.hex(c.dim)("(no output)"),e))}}const r=Kd(n.content).description;return{summaryKind:r?"description":"command",summary:W3(r||i,Y3(t.length,n.status)),lines:s,handlesDetail:true}}function Y3(n,e){if(n>0){return`${n} output ${n===1?"line":"lines"}`}return e==="succeeded"?"no output":void 0}function X3(n,e,t){const i=e.path??(sD(n.content)?void 0:n.content.trim());if(n.status==="failed")return Ud(n.detail,i,t);const s=Z3(n.detail,e.offset??1);const r=[];if(t.displayMode!=="collapsed"&&s.length>0){const a=String(s.at(-1)?.number??s.length).length;const u=Ha(s.map(m=>m.code).join("\n"),i);const l=s.flatMap((m,f)=>{const y=`${p.hex(c.dim)(String(m.number).padStart(a))} ${p.hex(c.line)("\u2502")} `;const T=`${" ".repeat(a)} ${p.hex(c.line)("\u2502")} `;return nD(u[f]??m.code,y,T,t)});const d=t.displayMode==="expanded"?l.length:3;const h=_1(l,d,n.status==="running"||n.status==="pending"?"tail":"head-tail");h.forEach(m=>{r.push(m.kind==="line"?m.value:zt(p.hex(c.muted)(m.label),t))})}const o=s.length;return{summary:[i,o>0?`${o} ${o===1?"line":"lines"}`:void 0].filter(Boolean).join(" \xB7 "),lines:r,handlesDetail:true}}function J3(n,e,t){const i=Ga(n.detail);if(n.status==="failed")return Ud(n.detail,e.query,t);const s=Gt(n.title);const r=s==="glob"||s==="list"||s==="list_files";const o=r?"file":"match";const a=[];if(t.displayMode!=="collapsed"){const l=t.displayMode==="expanded"?i.length:3;i.slice(0,l).forEach(d=>{a.push(zt(`${p.hex(c.dim)("\u2502")} ${eD(d)}`,t))});if(i.length>l){const d=i.length-l;a.push(zt(p.hex(c.muted)(`\u2026 ${d} more ${d===1?o:`${o}es`}`),t))}}const u=`${i.length} ${i.length===1?o:`${o}es`}`;return{summary:[e.query,u].filter(Boolean).join(" \xB7 "),lines:a,handlesDetail:true}}function Vw(n,e){if(e.displayMode==="collapsed"||!n.detail?.trim()){return{lines:[],handlesDetail:false}}const t=tD(n.detail);if(!t)return{lines:[],handlesDetail:false};const i=Ga(t);const s=e.displayMode==="expanded"?i.length:n.status==="failed"?8:3;const r=E1(i.slice(0,s).join("\n"),"json");const o=r.map(a=>zt(`${p.hex(c.dim)("\u2502")} ${a}`,e));if(i.length>s){o.push(zt(p.hex(c.muted)(`\u2026 ${i.length-s} more lines`),e))}return{lines:o,handlesDetail:true}}function Ud(n,e,t){if(t.displayMode==="collapsed"){return{summary:e,lines:[],handlesDetail:true}}const i=Ga(n);const s=t.displayMode==="expanded"?i.length:6;const r=_1(i,s,"tail");const o=r.map(a=>a.kind==="line"?zt(`${p.bold.hex(c.error)("\xD7")} ${p.hex(c.error)(a.value)}`,t):zt(p.hex(c.muted)(a.label),t));return{summary:e,lines:o,handlesDetail:true}}function Kd(n){let e;try{e=JSON.parse(n)}catch{return{}}if(!e||typeof e!=="object"||Array.isArray(e))return{};const t=e;return{description:Kw(Ks(t.description)),path:Ks(t.path)??Ks(t.filePath)??Ks(t.file_path),query:Ks(t.query)??Ks(t.pattern),taskId:Ks(t.task_id),offset:iD(t.offset),runInBackground:typeof t.run_in_background==="boolean"?t.run_in_background:void 0}}function Z3(n,e){const t=Ga(n);const i=t.map(r=>/^\s*(\d+)\s*[|│]\s?(.*)$/u.exec(r));const s=i.filter(Boolean).length;if(s>0&&s>=Math.ceil(t.length/2)){return t.flatMap((r,o)=>{const a=i[o];return a?[{number:Number(a[1]),code:a[2]??""}]:[]})}return t.map((r,o)=>({number:e+o,code:r}))}function Ga(n){if(!n?.trim())return[];return x(n).replace(/\r\n?/gu,"\n").replace(/\n+$/u,"").split("\n")}function _1(n,e,t){if(n.length<=e)return n.map(r=>({kind:"line",value:r}));const i=n.length-e;if(t==="tail"){return[{kind:"omitted",label:`\u2026 ${i} earlier ${i===1?"line":"lines"}`},...n.slice(-e).map(r=>({kind:"line",value:r}))]}const s=Math.max(1,e-1);return[...n.slice(0,s).map(r=>({kind:"line",value:r})),{kind:"omitted",label:`\u2026 ${i} ${i===1?"line":"lines"} hidden`},...n.slice(-1).map(r=>({kind:"line",value:r}))]}function eD(n){const e=/^(.*?)(:\d+(?::\d+)?:)(.*)$/u.exec(n);if(!e)return p.hex(c.muted)(n);return`${p.hex(c.text)(e[1]??"")}${p.hex(c.accent)(e[2]??"")}${p.hex(c.muted)(e[3]??"")}`}function tD(n){try{return JSON.stringify(JSON.parse(n),void 0,2)}catch{return void 0}}function zt(n,e){const t=Math.max(0,Math.floor(e.width));if(t===0)return"";const i=p.hex(c.dim)(e.prefix);const s=Math.max(1,t-w(e.prefix));return`${i}${E(n,s,p.hex(c.muted)("\u2026"))}`}function nD(n,e,t,i){const s=Math.max(0,Math.floor(i.width));if(s===0)return[];const r=w(i.prefix);const o=Math.max(w(e),w(t));const a=Math.max(1,s-r-o);const u=new we(n,0,0).render(a);return u.map((l,d)=>zt(`${d===0?e:t}${l}`,i))}function Ks(n){return typeof n==="string"&&n.trim()?n.trim():void 0}function iD(n){return typeof n==="number"&&Number.isFinite(n)?Math.max(1,Math.floor(n)):void 0}function sD(n){const e=n.trim();return e.startsWith("{")||e.startsWith("[")}function ts(n){const e=Number.isFinite(n)?Math.max(0,Math.floor(n)):0;if(e<60)return`${e}s`;const t=e%60;const i=Math.floor(e/60);if(i<60)return`${i}min${t}s`;const s=Math.floor(i/60);return`${s}h${i%60}min${t}s`}function Yr(n){const e=oD(n);const t=aD(n);const i=rD(n);const s=lD(n);const r=uD(n);return{...s,title:e,...t?{summary:t}:{},rawText:i,searchText:x([e,t,i].filter(Boolean).join("\n")).toLocaleLowerCase(),...r?{target:r}:{}}}function rD(n){const e=[];if(n.kind==="shell"&&n.title)e.push(x(n.title));if(n.kind==="tool"&&n.title)e.push(`Tool: ${x(n.title)}`);if(n.content.trim())e.push(x(n.content));if(n.detail?.trim())e.push(x(n.detail));for(const t of n.structuredPreview?.blocks??[]){if(t.path)e.push(x(t.path));if(t.kind==="diff")e.push(x(t.diff));if(t.kind==="file")e.push(x(t.content));if(t.kind==="summary")e.push(x(t.message))}return e.join("\n\n").trim()}function oD(n){if(n.kind==="shell")return"Shell";if(n.kind==="user")return"You";if(n.kind==="assistant")return"Response";if(n.kind==="assistant-preamble")return"Preamble";if(n.kind==="review")return n.title??"Code review";if(n.kind==="thinking")return n.status==="running"?"Thinking\u2026":"Thinking";if(n.kind==="tool"){const e=Ti(n.title);if(e){return n.status==="running"||n.status==="pending"?e.runningAction:e.completedAction}return Gw(Gt(n.title))}if(n.kind==="permission")return n.status==="resolved"?"Permission resolved":"Approval needed";if(n.kind==="question")return n.status==="resolved"?"Answers sent":"Agent question";if(n.kind==="turn-duration")return"Run duration";if(n.kind==="compaction")return n.title??"Context compacted";if(n.kind==="usage")return"Usage";if(n.kind==="inspection")return n.inspection?.title??n.title??"Inspection";if(n.kind==="warning")return x(n.title??"Warning");if(n.kind==="error")return"Error";if(n.kind==="diff")return"Changes";if(n.kind==="final-summary")return"Summary";return n.title??Gw(n.kind)}function aD(n){if(n.kind==="shell")return n.title;if(n.kind==="thinking"){const t=n.durationMs??Math.max(0,n.updatedAtMs-n.createdAtMs);return t>0?dD(t):void 0}if(n.kind==="tool")return es(n.content)||void 0;if(n.kind==="turn-duration")return ts((n.durationMs??0)/1e3);if(n.kind==="compaction"&&n.tokensBefore!==void 0&&n.tokensAfter!==void 0){return`${Math.round(n.tokensBefore).toLocaleString()} \u2192 ${Math.round(n.tokensAfter).toLocaleString()} tokens`}if(n.kind==="permission")return n.detail??n.title;const e=x(n.content).split(/\r?\n/u,1)[0]?.trim();if(!e||n.kind==="assistant"||n.kind==="user")return void 0;return e}function uD(n){const e=n.structuredPreview?.blocks.find(i=>i.path)?.path;if(e?.trim())return x(e).trim();const t=x(n.content).trim();try{const i=JSON.parse(t);if(cD(i)){for(const s of["path","filePath","file_path","url"]){const r=i[s];if(typeof r==="string"&&r.trim())return x(r).trim()}}}catch{const i=t.match(/https?:\/\/[^\s)\]}]+/u)?.[0];if(i)return i}return void 0}function lD(n){if(n.status==="failed")return{marker:"\xD7",tone:"error"};if(n.status==="blocked")return{marker:"\u25C6",tone:"warning"};if(n.status==="pending"||n.status==="running")return{marker:"\u25CF",tone:"accent"};if(n.status==="cancelled")return{marker:"\u25CB",tone:"warning"};if(n.kind==="warning")return{marker:"!",tone:"warning"};if(n.kind==="error")return{marker:"\xD7",tone:"error"};if(n.kind==="user")return{marker:"\u25CF",tone:"accent"};if(n.kind==="assistant")return{marker:"\u25CF",tone:"neutral"};if(n.kind==="thinking")return{marker:"\u25C6",tone:"neutral"};if(n.kind==="assistant-preamble")return{marker:"\xB7",tone:"neutral"};if(n.kind==="review")return{marker:"\u2713",tone:"success"};if(n.kind==="turn-duration"||n.kind==="usage"||n.kind==="compaction"){return{marker:"\xB7",tone:"neutral"}}if(n.kind==="diff")return{marker:"\xB1",tone:"success"};if(n.kind==="final-summary")return{marker:"\u25C6",tone:"success"};return{marker:"\u2713",tone:"success"}}function Gw(n){return n.split(/[_-]/u).filter(Boolean).map(e=>`${e[0]?.toLocaleUpperCase()??""}${e.slice(1)}`).join(" ")}function dD(n){const e=Math.max(0,n)/1e3;if(e<60)return`${e.toFixed(1)}s`;const t=Math.floor(e/60);return`${t}m ${Math.round(e-t*60)}s`}function cD(n){return n!==null&&typeof n==="object"&&!Array.isArray(n)}function Qw(n,e={}){const t=Array.from({length:n.length},(o,a)=>n.cellAt(a)).filter(o=>Boolean(o&&!o.ephemeral));const i=t.filter(o=>o.kind==="user"||o.kind==="assistant");const s=Zw(Qt(e.title?.trim()||"MCode Transcript"));const r=[`# ${s}`,""];if(e.sessionId){r.push(`Session: ${Ws(Qt(e.sessionId))}`,"")}if(e.exportedAtMs!==void 0){r.push(`Exported: ${new Date(e.exportedAtMs).toISOString()}`,"")}for(const o of i){const a=Xw(o);if(!a)continue;r.push(o.kind==="user"?"## You":"## Assistant","",a,"")}return`${r.join("\n").trimEnd()}
|
|
72
72
|
`}function Yw(n,e){const t=n.filter(hD);const i=pD(t);const s=Zw(Qt(e.title?.trim()||"MCode Session Export"));const r=["---","schema_version: 1",`session_id: ${zw(Qt(e.sessionId))}`,`title: ${zw(s)}`,`exported_at: ${new Date(e.exportedAtMs).toISOString()}`,"---","",`# ${s}`,"","## Overview","",`- Turns: ${String(i.length)}`,`- Messages: ${String(t.length)}`,"","---",""];i.forEach((o,a)=>{r.push(`## Turn ${String(a+1)}`,"");for(const u of o){const l=mD(u);if(u.role==="user"){r.push("### User","");if(l)r.push(l,"");continue}if(u.role==="assistant"){if(l)r.push("### Assistant","",l,"")}const d=fD(u);if(d.length>0)r.push("### Activity","",...d,"")}});return`${r.join("\n").trimEnd()}
|
|
73
73
|
`}function Wd(n){for(let e=n.length-1;e>=0;e-=1){const t=n.cellAt(e);if(!t||t.ephemeral||t.kind!=="assistant")continue;const i=Xw(t);if(i)return i}return void 0}function Xw(n){const e=n.kind==="assistant"?hm(n.content):n.content;const t=(n.attachments??[]).map(i=>{const s=i.type==="image"?"Image":"File";const r=Ws(Qt(i.fileName))||"attachment";const o=Ws(i.mimeType)||"application/octet-stream";const a=i.sizeBytes===void 0?"":`, ${Jw(i.sizeBytes)}`;return`- ${s}: ${r} (${o}${a})`});return[t.join("\n"),Qt(x(e))].filter(i=>i.trim()).join("\n\n").trim()}function Jw(n){if(n<1024)return`${String(n)} B`;if(n<1024*1024)return`${L1(n/1024)} KB`;if(n<1024*1024*1024){return`${L1(n/(1024*1024))} MB`}return`${L1(n/(1024*1024*1024))} GB`}function L1(n){return n>=10||Number.isInteger(n)?n.toFixed(0):n.toFixed(1)}function Zw(n){return Ws(n).replace(/^#+\s*/u,"")}function Ws(n){return x(n).replace(/\s+/gu," ").trim()}function Qt(n){return Fu(n)}function hD(n){return n.role==="user"||n.role==="assistant"}function pD(n){const e=[];let t;let i;let s=false;for(const r of n){const o=r.turnId?.trim();const a=!t||o!==void 0&&i!==void 0&&o!==i||o===void 0&&r.role==="user"&&s;if(a){t=[];e.push(t);i=o;s=false}if(!t)continue;t.push(r);s||=r.role==="user"}return e}function mD(n){const e=n.parts?.filter(r=>r.type==="text").map(r=>r.content).filter(r=>r.trim());const t=e?.length?e.join("\n\n"):n.content??"";const i=n.role==="assistant"?hm(t):t;const s=(n.attachments??[]).map(r=>{const o=r.type==="image"?"Image":"File";const a=Ws(Qt(r.fileName))||"attachment";const u=Ws(r.mimeType)||"application/octet-stream";const l=r.sizeBytes===void 0?"":`, ${Jw(r.sizeBytes)}`;return`- ${o}: ${a} (${u}${l})`});return[s.join("\n"),Qt(x(i)).trim()].filter(r=>r.trim()).join("\n\n").trim()}function fD(n){const e=[];for(const t of gD(n)){const i=Ws(Qt(t.name))||"tool";const s=yD(t);e.push(`- \`${i}\` ${s}`)}if(n.error?.trim()){e.push(`- Error: ${Qt(x(n.error)).trim()}`)}if(n.kind==="compaction_start")e.push("- Context compaction started");if(n.kind==="compaction")e.push("- Context compacted");if(n.kind==="compaction_failed")e.push("- Context compaction failed");if(n.finishReason==="error")e.push("- Response failed");if(n.finishReason==="aborted"||n.finishReason==="cancelled"){e.push("- Response cancelled")}return e}function gD(n){if(n.toolCalls?.length)return n.toolCalls;return n.parts?.filter(e=>e.type==="tool").map(e=>e.toolCall)??[]}function yD(n){if(n.error)return"failed";const e=String(n.status??"").toLocaleLowerCase();if(e==="3"||e.includes("fail")||e.includes("error")){return"failed"}if(e.includes("cancel"))return"cancelled";if(e==="1"||e.includes("run")||e.includes("pend")||e.includes("progress")){return"in progress"}return"succeeded"}function zw(n){return JSON.stringify(n)}var Xr=class{constructor(e){this.options=e;this.selectedIndex=Math.max(0,e.source.length-1);this.selectedCellId=e.source.cellAt(this.selectedIndex)?.id;const t={render:r=>this.renderHeader(r),invalidate:()=>void 0};const i={render:r=>this.renderFramedBody(r),invalidate:()=>void 0};const s={render:r=>this.renderFooter(r),invalidate:()=>void 0};this.bodyViewport=new Yn(i,{follow:"end",primary:true,overscroll:"contain"});this.layoutRoot=new Ot([{component:t,basis:"auto",shrink:1,minSize:1},{component:this.bodyViewport,basis:0,grow:1,shrink:1,minSize:1},{component:s,basis:"auto",shrink:1,minSize:1}])}options;id="transcript";layoutRoot;_focused=false;selectedIndex=-1;selectedCellId;bodyViewport;expandedIds=new Set;collapsedIds=new Set;rawIds=new Set;allExpanded=false;searchEditing=false;searchInput=new Ke({prompt:""});searchMatches=[];searchMatchIndex=-1;searchRevision;searchEntries=[];ensureSelectionOnNextRender=true;lastSelectedRow=0;notice;forking=false;disposed=false;operationGeneration=0;expandedBlockMeasurements=new Map;get focused(){return this._focused}set focused(e){this._focused=e;this.searchInput.focused=e&&this.searchEditing}dispose(){this.disposed=true;this.operationGeneration+=1;this.searchInput.focused=false}handleInput(e){if(this.forking||this.disposed)return;if(this.searchEditing){this.handleSearchInput(e);return}const t=st(e)??e;if(S(e,"escape")||S(e,"ctrl+c")){this.options.onCancel();return}if(S(e,"up")||t==="k"){this.moveSelection(-1);return}if(S(e,"down")||t==="j"){this.moveSelection(1);return}if(S(e,"enter")||S(e,"space")){this.toggleSelected();return}if(S(e,"ctrl+o")){this.toggleAll();return}if(t==="/"){this.searchEditing=true;this.searchInput.focused=this._focused;this.notice=void 0;this.requestRender();return}if(t==="n"||t==="N"){this.moveSearchMatch(t==="n"?1:-1);return}if(t==="r"){this.toggleRaw();return}if(t==="c"){void this.copySelected();return}if(t==="y"){void this.copyLastReply();return}if(t==="e"){void this.exportTranscript();return}if(t==="w"&&this.options.onForkFromUserMessage){void this.forkSelectedPrompt();return}if(t==="o"){void this.openSelectedTarget()}}invalidate(){this.searchRevision=void 0;this.layoutRoot.invalidate()}render(e){return[...this.renderHeader(e),...this.renderFramedBody(e),...this.renderFooter(e)]}renderViewport(e,t){const i=Math.max(1,Math.floor(e));const s=Math.max(1,Math.floor(t));this.reconcileSelection();if(s<=3)return this.renderCompactViewport(i,s);const r=this.renderHeader(i);const o=this.renderFooter(i);const a=Math.max(1,s-r.length-o.length);const u=this.renderFramedBody(i,a);const l=this.selectedCell();const d=Math.max(0,u.length-a);const h=this.isExpanded(l?.id)?Math.min(this.lastSelectedRow,d):Math.max(0,Math.min(d,this.lastSelectedRow-a+1));const m=u.slice(h,h+a);while(m.length<a)m.push("");return[...r,...m,...o].slice(0,s)}renderHeader(e){const t=this.options.source.length;const i=this.options.source.turnCount;const s=`${t} ${t===1?"block":"blocks"} \xB7 ${i} ${i===1?"turn":"turns"}`;const r=this.searchInput.getValue();const o=r?`/ ${r} \xB7 ${this.searchMatches.length} ${this.searchMatches.length===1?"match":"matches"}`:this.allExpanded?"all details":"focused details";const a=gi("Transcript",s,e);const u=p.hex(r?c.signal:c.dim)(o);if(!this.searchEditing){return[a,Ee(u,e)]}this.searchInput.focused=this._focused;const l=p.hex(c.signal)("/ ");const d=this.searchInput.render(Math.max(1,ft(e)-w(l)))[0]??"";const h=p.hex(c.muted)(`${this.searchMatches.length} ${this.searchMatches.length===1?"match":"matches"}`);return[a,Ee(`${l}${d}`,e),Ee(h,e)]}renderFooter(e){const t=this.selectedCell();const i=t?this.isExpanded(t.id):false;const s=i?"Enter collapse":"Enter expand";const r=`${s}${this.options.onForkFromUserMessage?" \xB7 w fork":""}${eI(t)?.target?" \xB7 o open":""} \xB7 y last reply \xB7 e export \xB7 / find \xB7 c copy \xB7 r raw`;const o=this.notice?`${Y("Esc close")} \xB7 ${p.hex(c.signal)(this.notice)}`:Y(`${r} \xB7 Esc close`);return[Qn(e),...fi(o,ft(e)).map(a=>Ee(a,e)),yi(e)]}renderFramedBody(e,t=this.bodyViewport.viewportHeight||24){const i=this.renderBody(ft(e),t);while(i.length<this.bodyViewport.viewportHeight)i.push("");return i.map(s=>Ee(s,e))}renderBody(e,t=this.bodyViewport.viewportHeight||24){this.reconcileSelection();if(this.options.source.length===0){if(this.ensureSelectionOnNextRender)this.bodyViewport.setActiveRow(0,true);else this.bodyViewport.setActiveRowPreservingScroll(0);this.ensureSelectionOnNextRender=false;return[p.hex(c.muted)(" No conversation yet. Send a message to begin.")]}let i=this.createExpandedBlockLayout(e);let s=this.resolveBodyWindow(i,t);let r=new Map;for(let u=0;u<3;u+=1){const l=this.measureExpandedBlocks(e,i,s.renderTop,s.renderBottom);r=l.blocks;if(!l.layoutChanged)break;i=this.createExpandedBlockLayout(e);s=this.resolveBodyWindow(i,t)}const o=Array.from({length:s.totalRows},()=>"");this.lastSelectedRow=s.selectedRow;let a=this.indexForRow(s.renderTop,i);while(a<this.options.source.length){const u=this.rowForIndex(a,i);if(u>=s.renderBottom)break;const l=this.options.source.cellAt(a);if(l){const d=r.get(a)??this.renderMeasuredBlock(l,e,a===this.selectedIndex);for(let h=0;h<d.length;h+=1){const m=u+h;if(m>=s.renderTop&&m<s.renderBottom){o[m]=d[h]??""}}}a+=1}if(this.ensureSelectionOnNextRender){this.bodyViewport.setActiveRow(s.selectedRow,true)}else{this.bodyViewport.setActiveRowPreservingScroll(s.selectedRow)}this.ensureSelectionOnNextRender=false;return o}resolveBodyWindow(e,t){const i=e.reduce((l,d)=>l+d.extraRows,0);const s=this.options.source.length+i;const r=this.rowForIndex(this.selectedIndex,e);const o=Math.max(1,Math.floor(t));const a=this.bodyViewport.viewportHeight>0?this.bodyViewport.scrollTop:r;let u=this.bodyViewport.isFollowingEnd?Math.max(0,s-o):a;if(this.ensureSelectionOnNextRender){if(r<a)u=r;else if(r>=a+o){u=Math.max(0,r-o+1)}}return{selectedRow:r,totalRows:s,renderTop:Math.max(0,u-o),renderBottom:Math.min(s,u+o*2)}}measureExpandedBlocks(e,t,i,s){const r=new Map;let o=false;let a=this.indexForRow(i,t);while(a<this.options.source.length){const u=this.rowForIndex(a,t);if(u>=s)break;const l=this.options.source.cellAt(a);if(l&&this.isExpanded(l.id)){const d=this.expandedBlockHeight(l,e);const h=this.renderMeasuredBlock(l,e,a===this.selectedIndex);r.set(a,h);if(h.length!==d)o=true}a+=1}return{blocks:r,layoutChanged:o}}createExpandedBlockLayout(e){const t=this.allExpanded?Array.from({length:this.options.source.length},(r,o)=>o).filter(r=>{const o=this.options.source.cellAt(r);return Boolean(o&&!this.collapsedIds.has(o.id))}):[...this.expandedIds].map(r=>this.options.source.locateCell(r)?.index).filter(r=>r!==void 0).sort((r,o)=>r-o);const i=[];let s=0;for(const r of t){const o=this.options.source.cellAt(r);if(!o)continue;const a=Math.max(0,this.expandedBlockHeight(o,e)-1);i.push({index:r,row:r+s,extraRows:a});s+=a}return i}rowForIndex(e,t){const i=Math.max(0,e);let s=0;let r=t.length-1;let o=-1;while(s<=r){const u=Math.floor((s+r)/2);if((t[u]?.index??Number.POSITIVE_INFINITY)<i){o=u;s=u+1}else{r=u-1}}if(o<0)return i;const a=t[o];if(!a)return i;return i+(a.row-a.index)+a.extraRows}expandedBlockHeight(e,t){const i=this.expandedBlockMeasurements.get(e.id);return i?.cell===e&&i.width===t&&i.raw===this.rawIds.has(e.id)?i.height:1}renderMeasuredBlock(e,t,i){const s=this.renderBlock(e,t,i);if(this.isExpanded(e.id)){this.expandedBlockMeasurements.set(e.id,{cell:e,width:t,raw:this.rawIds.has(e.id),height:s.length})}return s}indexForRow(e,t){let i=0;let s=Math.max(0,this.options.source.length-1);let r=0;while(i<=s){const o=Math.floor((i+s)/2);if(this.rowForIndex(o,t)<=e){r=o;i=o+1}else{s=o-1}}return r}renderBlock(e,t,i){const s=Yr(e);const r=TD(s.marker,s.tone);const o=i?p.bold.hex(c.signal)("\u203A"):" ";const a=i?p.bold.hex(c.signal)(s.title):p.hex(c.text)(s.title);const u=s.summary?` ${p.hex(c.muted)(s.summary)}`:"";const l=E(`${o} ${r} ${a}${u}`,t,"\u2026");if(!this.isExpanded(e.id))return[l];return[l,...this.renderDetail(e,s,t)]}renderDetail(e,t,i){const s=Math.max(1,i-4);if(this.rawIds.has(e.id)){return this.renderTextSection("raw",t.rawText||"No raw content",s)}if(e.kind==="user"){return Wa(e.content,s).map(a=>this.detailLine(a,i))}if(e.kind==="assistant"||e.kind==="assistant-preamble"){const a=Ho(e.content);const u=new Wt(a.text,0,0,jt,{color:h=>p.hex(c.text)(h)}).render(s);const l=Ka(a.assets,s,this.options.workspaceDir);const d=u.length>0&&l.length>0?[...u,"",...l]:[...u,...l];return d.map(h=>this.detailLine(h,i))}const r=[];const o=e.kind==="tool"?Va(e,Ti(e.title),{width:i,prefix:" \u2502 ",displayMode:"expanded"}):void 0;if(e.kind==="tool"&&o?.lines.length){r.push(...o.lines)}else if(e.kind==="tool"&&e.content.trim()){r.push(...this.renderTextSection("input",e.content,s))}else if(e.content.trim()){r.push(...this.renderTextSection(void 0,e.content,s))}if(e.structuredPreview){r.push(...Qr(e.structuredPreview,i,{prefix:" \u2502 ",maxBodyLines:Number.MAX_SAFE_INTEGER}))}if(e.detail?.trim()&&!o?.handlesDetail){r.push(...this.renderTextSection(e.kind==="tool"?"output":"detail",e.detail,s))}if(r.length===0)r.push(this.detailLine(p.hex(c.dim)("No additional detail"),i));return r}renderTextSection(e,t,i){const s=[];if(e)s.push(this.detailLine(p.bold.hex(c.dim)(e),i+4));const r=new we(p.hex(c.muted)(x(t)),0,0).render(i);s.push(...r.map(o=>this.detailLine(o,i+4)));return s}detailLine(e,t){const i=p.hex(c.line)(" \u2502 ");return E(`${i}${e}`,t,"")}renderCompactViewport(e,t){const i=this.selectedCell();const s=i?Yr(i).title:"No conversation";return[E(p.bold.hex(c.signal)("Transcript"),e,"\u2026"),E(s,e,"\u2026"),E(Y("Esc close"),e,"\u2026")].slice(0,t)}handleSearchInput(e){if(S(e,"escape")){this.searchEditing=false;this.searchInput.focused=false;this.requestRender();return}if(S(e,"enter")){this.searchEditing=false;this.searchInput.focused=false;this.selectCurrentSearchMatch();this.requestRender();return}const t=this.searchInput.getValue();this.searchInput.handleInput(e);if(this.searchInput.getValue()!==t)this.refreshSearchMatches()}refreshSearchMatches(){this.ensureSearchEntries();const e=this.searchInput.getValue().trim().toLocaleLowerCase();this.searchMatches=e?this.searchEntries.flatMap((t,i)=>t.text.includes(e)?[i]:[]):[];this.searchMatchIndex=this.searchMatches.length>0?0:-1;this.selectCurrentSearchMatch();this.notice=void 0;this.requestRender()}ensureSearchEntries(){const e=this.options.source.revision;if(e!==void 0&&this.searchEntries.length===this.options.source.length&&this.searchRevision===e){return}this.searchEntries=Array.from({length:this.options.source.length},(t,i)=>{const s=this.options.source.cellAt(i);return s?{id:s.id,text:Yr(s).searchText}:{id:`missing:${i}`,text:""}});this.searchRevision=e}moveSearchMatch(e){if(this.searchMatches.length===0)return;this.searchMatchIndex=(this.searchMatchIndex+e+this.searchMatches.length)%this.searchMatches.length;this.selectCurrentSearchMatch();this.requestRender()}selectCurrentSearchMatch(){const e=this.searchMatches[this.searchMatchIndex];if(e!==void 0)this.selectIndex(e)}moveSelection(e){this.selectIndex(this.selectedIndex+e)}selectIndex(e){if(this.options.source.length===0){this.selectedIndex=-1;return}this.selectedIndex=Math.max(0,Math.min(this.options.source.length-1,e));this.selectedCellId=this.options.source.cellAt(this.selectedIndex)?.id;this.ensureSelectionOnNextRender=true;this.notice=void 0;this.requestRender()}toggleSelected(){const e=this.selectedCell();if(!e)return;const t=this.isExpanded(e.id);if(this.allExpanded){if(t)this.collapsedIds.add(e.id);else this.collapsedIds.delete(e.id)}else if(t){this.expandedIds.delete(e.id)}else{this.expandedIds.add(e.id)}this.notice=void 0;this.requestRender()}toggleAll(){this.allExpanded=!this.allExpanded;this.expandedIds.clear();this.collapsedIds.clear();this.notice=this.allExpanded?"All details shown":"Semantic folding restored";this.requestRender()}toggleRaw(){const e=this.selectedCell();if(!e)return;if(this.rawIds.has(e.id))this.rawIds.delete(e.id);else this.rawIds.add(e.id);if(!this.isExpanded(e.id)){if(this.allExpanded)this.collapsedIds.delete(e.id);else this.expandedIds.add(e.id)}this.notice=this.rawIds.has(e.id)?"Raw content":"Rendered content";this.requestRender()}async copySelected(){const e=this.selectedCell();const t=this.options.writeClipboardText;if(!e||!t){this.notice="Copy is unavailable";this.requestRender();return}const i=this.beginOperation();try{await t(Yr(e).rawText);if(!this.isCurrentOperation(i))return;this.notice="Copied selected block"}catch(s){if(!this.isCurrentOperation(i))return;this.notice=N(s,{summary:"Couldn't copy.",nextStep:"Select the text and copy it manually."})}this.requestRender()}async copyLastReply(){const e=this.options.writeClipboardText;const t=Wd(this.options.source);if(!e||!t){this.notice=t?"Copy is unavailable":"No Assistant reply to copy";this.requestRender();return}const i=this.beginOperation();try{await e(t);if(!this.isCurrentOperation(i))return;this.notice="Copied last Assistant reply"}catch(s){if(!this.isCurrentOperation(i))return;this.notice=N(s,{summary:"Couldn't copy.",nextStep:"Select the text and copy it manually."})}this.requestRender()}async exportTranscript(){if(!this.options.exportTranscript){this.notice="Transcript export is unavailable";this.requestRender();return}const e=typeof this.options.exportMetadata==="function"?this.options.exportMetadata():this.options.exportMetadata??{};const t=this.beginOperation();try{const i=await this.options.exportTranscript(Qw(this.options.source,e));if(!this.isCurrentOperation(t))return;this.notice=`Exported to ${i}`}catch(i){if(!this.isCurrentOperation(t))return;this.notice=N(i,{summary:"Couldn't export.",nextStep:"Check folder permissions and retry."})}this.requestRender()}async openSelectedTarget(){const e=eI(this.selectedCell())?.target;if(!e||!this.options.openExternalTarget){this.notice="No openable target in this block";this.requestRender();return}const t=this.beginOperation();try{await this.options.openExternalTarget(e);if(!this.isCurrentOperation(t))return;this.notice="Opened target"}catch(i){if(!this.isCurrentOperation(t))return;this.notice=N(i,{summary:"Couldn't open target.",nextStep:"Copy it and open it manually."})}this.requestRender()}async forkSelectedPrompt(){if(this.forking||!this.options.onForkFromUserMessage)return;const e=this.selectedCell();if(e?.kind!=="user"||!e.sourceMessageId){this.notice="Select a persisted user prompt to fork";this.requestRender();return}this.forking=true;this.notice="Forking Session\u2026";this.requestRender();const t=this.beginOperation();try{await this.options.onForkFromUserMessage(e.sourceMessageId);if(!this.isCurrentOperation(t))return;this.notice="Fork created"}catch(i){if(!this.isCurrentOperation(t))return;this.notice=N(i,{summary:"Couldn't fork this prompt.",nextStep:"Select another persisted user prompt and retry."})}finally{if(this.isCurrentOperation(t)){this.forking=false;this.requestRender()}}}isExpanded(e){if(!e)return false;return this.allExpanded?!this.collapsedIds.has(e):this.expandedIds.has(e)}selectedCell(){if(this.selectedIndex<0)return void 0;const e=this.options.source.cellAt(this.selectedIndex);if(e?.id===this.selectedCellId)return e;this.reconcileSelection();return this.selectedIndex<0?void 0:this.options.source.cellAt(this.selectedIndex)}reconcileSelection(){if(this.options.source.length===0){this.selectedIndex=-1;this.selectedCellId=void 0;return}if(this.selectedCellId){const e=this.options.source.locateCell(this.selectedCellId);if(e){this.selectedIndex=e.index;return}}this.selectedIndex=Math.max(0,Math.min(this.selectedIndex,this.options.source.length-1));this.selectedCellId=this.options.source.cellAt(this.selectedIndex)?.id}requestRender(){if(!this.disposed)this.options.requestRender()}beginOperation(){this.operationGeneration+=1;return this.operationGeneration}isCurrentOperation(e){return!this.disposed&&e===this.operationGeneration}};function TD(n,e){if(e==="success")return p.hex(c.success)(n);if(e==="error")return p.hex(c.error)(n);if(e==="warning")return p.hex(c.warning)(n);if(e==="accent")return p.hex(c.accent)(n);return p.hex(c.muted)(n)}function eI(n){return n?Yr(n):void 0}var Jr=class{orderedIds=[];cells=new Map;indexById=new Map;turnStarts=[];pendingTextDeltas=new Map;revisionValue=0;cellRevisions=new Map;constructor(e=[]){for(const t of e){this.upsert(t)}}get(e){const t=this.cells.get(e);return t?{...t}:void 0}get length(){return this.orderedIds.length}get revision(){return this.revisionValue}cellRevision(e){return this.cells.get(e.id)===e?this.cellRevisions.get(e.id):void 0}get turnCount(){return this.turnStarts.length}cellAt(e){const t=this.orderedIds[e];return t===void 0?void 0:this.cells.get(t)}locateCell(e){const t=this.indexById.get(e);if(t===void 0)return void 0;return{index:t,turnIndex:this.findTurnIndex(t)}}turnRange(e){const t=this.turnStarts[e];if(t===void 0)return void 0;return{start:t,end:this.turnStarts[e+1]??this.orderedIds.length}}snapshot(){return this.orderedIds.flatMap(e=>{const t=this.cells.get(e);return t?[{...t}]:[]})}findVisibleError(e){for(let t=this.orderedIds.length-1;t>=0;t-=1){const i=this.cellAt(t);if(i?.kind!=="error"||i.content.trim()!==e)continue;return i.turnId?{turnId:i.turnId}:{}}return void 0}latestSettledFailure(){for(let e=this.orderedIds.length-1;e>=0;e-=1){const t=this.cellAt(e);if(!t?.turnId)continue;if(t.status==="pending"||t.status==="running")return void 0;if(t.kind==="error"&&t.status==="failed")return{turnId:t.turnId};return void 0}return void 0}hasConcreteTurnActivity(e){for(let t=this.orderedIds.length-1;t>=0;t-=1){const i=this.cellAt(t);if(!i||i.turnId!==e)continue;if(i.status!=="pending"&&i.status!=="running")continue;if(i.kind==="tool")return true;if((i.kind==="thinking"||i.kind==="assistant"||i.kind==="assistant-preamble")&&i.content.trim()){return true}}return false}upsert(e){const t=this.cells.get(e.id);const i=t?vD(t,e):SD(e);if(!t){const s=this.orderedIds.length;const r=this.cellAt(s-1);this.orderedIds.push(i.id);this.indexById.set(i.id,s);if(!r||za(r)!==za(i))this.turnStarts.push(s)}this.cells.set(i.id,i);if(t&&za(t)!==za(i))this.rebuildIndexes();this.revisionValue+=1;this.cellRevisions.set(i.id,this.revisionValue);return{...i}}remove(e){if(!this.cells.delete(e))return false;this.cellRevisions.delete(e);const t=this.orderedIds.indexOf(e);if(t>=0)this.orderedIds.splice(t,1);this.pendingTextDeltas.delete(e);this.rebuildIndexes();this.revisionValue+=1;return true}moveBefore(e,t){const i=this.indexById.get(e);const s=this.indexById.get(t);if(i===void 0||s===void 0||i===s||i+1===s){return false}this.orderedIds.splice(i,1);const r=this.orderedIds.indexOf(t);this.orderedIds.splice(r,0,e);this.rebuildIndexes();this.revisionValue+=1;return true}moveToEnd(e){const t=this.indexById.get(e);if(t===void 0||t===this.orderedIds.length-1)return false;this.orderedIds.splice(t,1);this.orderedIds.push(e);this.rebuildIndexes();this.revisionValue+=1;return true}queueTextDelta(e,t){if(!t)return;if(!this.cells.has(e)){throw new Error(`Cannot queue transcript delta for unknown cell: ${e}`)}this.pendingTextDeltas.set(e,`${this.pendingTextDeltas.get(e)??""}${t}`)}flushTextDeltas(e){const t=[];for(const[i,s]of this.pendingTextDeltas){const r=this.cells.get(i);if(!r)continue;this.cells.set(i,{...r,content:`${r.content}${s}`,updatedAtMs:e});t.push(i);this.cellRevisions.set(i,this.revisionValue+1)}this.pendingTextDeltas.clear();if(t.length>0)this.revisionValue+=1;return t}clear(){const e=this.orderedIds.length>0;this.orderedIds.length=0;this.cells.clear();this.cellRevisions.clear();this.indexById.clear();this.turnStarts.length=0;this.pendingTextDeltas.clear();if(e)this.revisionValue+=1}replaceDurableProjection(e){const t=this.snapshot();let i=0;const s=t.flatMap((o,a)=>{if(!o.ephemeral){i+=1;return[]}return[{cell:o,previousDurableId:tI(t,a,-1),nextDurableId:tI(t,a,1),durableBefore:i}]});const r=new Set(t.flatMap(o=>!o.ephemeral&&o.turnId?[o.turnId]:[]));this.clear();try{e()}finally{const o=this.orderedIds.filter(f=>!this.cells.get(f)?.ephemeral);const a=new Set(o.flatMap(f=>{const y=this.cells.get(f)?.turnId;return y?[y]:[]}));const u=[...r].some(f=>a.has(f));const l=f=>u&&bD(f)&&r.has(f.turnId??"")&&!a.has(f.turnId??"");let d;const h=()=>{if(d)return d;d=new Map;this.orderedIds.forEach((f,y)=>{const T=this.cells.get(f)?.turnId;if(T)d?.set(T,y)});return d};const m=s.map(({cell:f,previousDurableId:y,nextDurableId:T,durableBefore:b})=>{if(T&&this.cells.has(T))return T;if(y){const C=this.indexById.get(y);if(C!==void 0)return this.orderedIds[C+1]}const v=f.turnId?h().get(f.turnId):void 0;if(v!==void 0)return this.orderedIds[v+1];return o[b]});s.forEach(({cell:f},y)=>{if(this.cells.has(f.id)||l(f))return;this.upsert(f);const T=m[y];if(T)this.moveBefore(f.id,T)})}}findTurnIndex(e){let t=0;let i=this.turnStarts.length;while(t<i){const s=Math.floor((t+i)/2);if((this.turnStarts[s]??0)<=e)t=s+1;else i=s}return Math.max(0,t-1)}rebuildIndexes(){this.indexById.clear();this.turnStarts.length=0;let e;this.orderedIds.forEach((t,i)=>{this.indexById.set(t,i);const s=this.cells.get(t);if(!s)return;const r=za(s);if(r!==e)this.turnStarts.push(i);e=r})}};function tI(n,e,t){for(let i=e+t;i>=0&&i<n.length;i+=t){const s=n[i];if(s&&!s.ephemeral)return s.id}return void 0}function bD(n){return n.kind==="turn-duration"||n.ephemeral===true&&(n.kind==="error"||n.kind==="shell")}function za(n){return n.turnId?.trim()||`cell:${n.id}`}function vD(n,e){return{...n,...e,id:n.id,createdAtMs:n.createdAtMs}}function SD(n){if(n.kind===void 0||n.status===void 0||n.content===void 0||n.createdAtMs===void 0){throw new Error(`New transcript cell ${n.id} is missing required fields`)}return{...n,kind:n.kind,status:n.status,content:n.content,createdAtMs:n.createdAtMs,updatedAtMs:n.updatedAtMs??n.createdAtMs}}var nI=64*1024;function O1(n,e){const t=Buffer.byteLength(n);return{text:n,originalBytes:e??t,truncated:e!==void 0&&e>t}}function iI(n,e,t){if(!e)return n;if(t==="succeeded"||t==="failed")return Zr(e);if(!n.text)return Zr(e);const i=n.truncated?xD(n.text):n.text;const s=n.truncated?CD(n.text):n.text;if(e.startsWith(s)){return Buffer.byteLength(e)>=n.originalBytes?Zr(e):n}if(s.startsWith(e))return n;const r=i.endsWith("\n")||e.startsWith("\n")?"":"\n";return Zr(`${i}${r}${e}`,n.originalBytes+Buffer.byteLength(r)+Buffer.byteLength(e))}function Zr(n,e=Buffer.byteLength(n)){if(e<=nI){return{text:n,originalBytes:e,truncated:false}}const t=`
|
|
@@ -119,7 +119,7 @@ It is available to @ path completion and future Runs in this CLI process.`:`Work
|
|
|
119
119
|
${r}
|
|
120
120
|
Code: ${s.userCode}`);this.options.setHint("Waiting for authorization\u2026");this.options.onChanged();void this.openExternalTarget(r).catch(()=>{this.options.append("Couldn't open the default browser. Open the authorization URL above manually.","warning");this.options.onChanged()})},t):await this.options.auth.logout();this.options.append(i.message);if(e==="login"){if(i.restartRequired){const s=this.pendingLoginContinuation==="checkin"?"/checkin":void 0;this.pendingLoginContinuation=void 0;if(s)this.options.requestRestart?.(t,s);else this.options.requestRestart?.(t);await this.options.leaveUi();return}if(i.state==="authenticated"||i.state==="already-authenticated"){await this.notifyAuthContextChanged("authenticated")}try{await this.options.controller.requireLoginForAgentAction()}catch(s){if(!(s instanceof $i))throw s;this.options.controller.refreshAccountStatusNow()}if(this.pendingLoginContinuation==="checkin"){this.pendingLoginContinuation=void 0;await this.options.featureFlow.runDailyCheckin()}}else{if(i.logoutUrl)void this.openLogoutPage(i.logoutUrl);if(i.state==="signed-out"||i.state==="already-signed-out"){await this.notifyAuthContextChanged("logged_out")}this.options.controller.refreshAccountStatusNow()}}catch(i){if(e==="login")this.pendingLoginContinuation=void 0;this.options.append(N(i,{summary:e==="login"?"Sign-in wasn't completed.":"Couldn't sign out.",nextStep:e==="login"?"Resolve the reported connection or service error before retrying sign-in.":"Check the connection, then retry /logout."}),"error")}finally{this.options.setHint(void 0);this.options.onChanged()}}async openLogoutPage(e){this.options.append(`Finish signing out in your browser:
|
|
121
121
|
${e}`);this.options.onChanged();try{await this.openExternalTarget(e)}catch{this.options.append("Couldn't open the default browser. Open the sign-out URL above manually.","warning");this.options.onChanged()}}async notifyAuthContextChanged(e){try{await this.options.notifyAuthContextChanged?.(e)}catch{}}async runLoginProtectedAction(e){try{await this.options.controller.requireLoginForAgentAction();return await e()}catch(t){this.appendProtectedActionError(t);return void 0}}appendProtectedActionError(e,t){this.options.append(e instanceof $i?e.message:t??N(e,{summary:"Couldn't complete this action.",nextStep:"Retry."}),e instanceof $i?"warning":"error")}};function ZK(n,e){return n.captureDraft?.()??{schemaVersion:1,text:e,cursor:e.length,pastes:[],pasteCounter:0}}function eW(n){return n.flatMap(e=>{const t={type:e.type,fileName:e.fileName,mimeType:e.mimeType,...e.sizeBytes!==void 0?{sizeBytes:e.sizeBytes}:{}};if(e.filePath){return[{...t,filePath:e.filePath,assetId:e.assetId}]}if(e.assetId)return[{...t,assetId:e.assetId}];return[]})}function tW(n,e){const t=new Set(n.attachments.map(o=>o.filePath));const i=new Set(e.map(o=>o.filePath));const s=(n.transportAttachments??[]).filter(o=>!o.filePath||!t.has(o.filePath)||i.has(o.filePath));const r=new Set(s.flatMap(o=>o.filePath?[o.filePath]:[]));return[...s,...e.filter(o=>!r.has(o.filePath))]}function nW(n){if(n instanceof $i)return n.message;return N(n,{summary:"Couldn't prepare this message.",nextStep:"Remove unavailable attachments, then retry.",preservation:"Your draft is preserved."})}function iW(n){if(n instanceof $i)return n.message;if(n instanceof MT&&n.category==="config"){return"Couldn't send this message with the current configuration. Run /doctor, then retry. Your draft is preserved."}return N(n,{summary:"Couldn't send this message.",nextStep:"Retry.",preservation:"Your draft is preserved."})}function yk(n){return N(n,{summary:"Couldn't add this message to the Queue.",nextStep:"Retry after the current response finishes.",preservation:"Your draft is preserved."})}function Tk(n){return Boolean(n&&n.resources.attachments.length>0)}function bk(n,e){return nu(n,e.inputCommands)!==void 0}function sW(n){const e=n.trim();return/^\d+$/u.test(e)||/^(?:mvs_|ses_|session[-_:]|[0-9a-f]{8}-)/iu.test(e)}function rW(n){const e=n.trim();return Boolean(e&&!/\s/u.test(e)&&e.startsWith("/")&&!e.slice(1).includes("/"))}function vk(n){const e=n.trim().split(/\s+/u,1)[0]??"";return e.startsWith("/")&&e.length>1&&!e.slice(1).includes("/")}function Sk(n){const e=n.trim().split(/\s+/u,1)[0]??n.trim();return`${e} is not a recognized MCode command \u2014 it was not queued. Check the spelling in /help; send it as a plain message (without the slash) if it is meant as text.`}function oW(n,e){const t=e.resolve(n)?.name;return t==="help"||t==="quit"||t==="stop"}function Ck(n){if(n===void 0)return"Delete guard is managed by host.";const e=Ni(n);const t=n?"Deletes move to trash and can be restored.":"Deletes are permanent and cannot be undone.";return`Delete guard: ${e}. ${t}`}function xk(n){if(n===void 0)return"Sandbox is managed by host.";return`Sandbox: ${Bi(n)}. ${Hu(n)}`}var _me=`Set MCODE_EDITOR, VISUAL, or EDITOR to use ${Te("composer.external-editor")}; GUI editors need --wait.`;var Fp=class{constructor(e){this.options=e}options;opening=false;async open(){if(this.opening||this.options.isAppStopped())return;const e=eE({configuredCommand:this.options.configuredCommand,env:this.options.env,platform:this.options.platform});if(!e){this.options.setHint(`Set MCODE_EDITOR, VISUAL, or EDITOR to use ${Te("composer.external-editor",this.options.keybindings)}; GUI editors need --wait.`);this.options.onChanged();return}const t=wk(this.options.editor.getExpandedText());const i=!this.options.isAppStopped();this.opening=true;try{if(i){this.options.setHint("External editor open \xB7 save and close to return.");this.options.onChanged();await this.options.tui.stop()}if(this.options.isAppStopped())return;const s=await(this.options.editDraft??tE)({command:e,draft:t,cwd:this.options.workspaceDir});if(this.options.isAppStopped())return;const r=wk(s);if(r!==t){if(this.options.editor.replaceTextUndoable){this.options.editor.replaceTextUndoable(r)}else{this.options.editor.setText(r)}this.options.editor.pruneMissingAttachmentPlaceholders?.();this.options.setHint("External edit applied.")}else{this.options.setHint("External editor closed \xB7 draft unchanged.")}this.options.onChanged()}catch(s){if(!this.options.isAppStopped()){this.options.setHint(void 0);this.options.append(N(s,{summary:"Couldn't open the external editor.",nextStep:"Check $VISUAL or $EDITOR and retry.",preservation:"Your draft is preserved."}),"error");this.options.onChanged()}}finally{this.opening=false;if(i&&!this.options.isAppStopped()){this.options.tui.start();this.options.tui.requestRender(true)}}}};function wk(n){return n.replace(/^\uFEFF/u,"").replace(/\r\n?/gu,"\n")}var Bp=class{constructor(e){this.options=e;this.searchInput.setValue(e.initialQuery??"");this.searchInput.moveCursorToEnd()}options;focused=false;searchInput=new Ke({prompt:""});selectedIndex=0;handleInput(e){if(S(e,"escape")||S(e,"ctrl+c")||S(e,"ctrl+r")){this.options.onCancel();return}if(S(e,"up")){this.move(-1);return}if(S(e,"down")){this.move(1);return}if(S(e,"enter")){const i=this.matches()[this.selectedIndex];if(i)this.options.onSelect(i);return}const t=this.searchInput.getValue();this.searchInput.handleInput(e);if(this.searchInput.getValue()===t)return;this.selectedIndex=0;this.options.requestRender()}invalidate(){}render(e){const t=Math.max(1,Math.floor(e));const i=this.matches();this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,i.length-1));this.searchInput.focused=this.focused;const s=p.bold.hex(c.signal)("Search prompt history");const r=Math.max(1,t-w(s)-2);const o=this.searchInput.render(r)[0]??"";const a=i.slice(0,6);const u=a.length?a.map((l,d)=>{const h=d===this.selectedIndex;const m=h?p.bold.hex(c.signal)("\u203A "):" ";const f=h?p.bold.hex(c.text)(x(Xt(l).text)):p.hex(c.muted)(x(Xt(l).text));return $p(`${m}${f}`,t)}):[$p(p.hex(c.muted)(" No matching prompts"),t)];return[$p(`${s} ${o}`,t),...u,$p(Y("\u2191\u2193 select \xB7 Enter restore \xB7 Esc keep draft"),t)]}matches(){const e=this.searchInput.getValue().trim().toLocaleLowerCase();if(!e)return[...this.options.entries];return this.options.entries.filter(t=>Xt(t).text.toLocaleLowerCase().includes(e))}move(e){const t=this.matches().length;if(t===0)return;this.selectedIndex=(this.selectedIndex+e+t)%t;this.options.requestRender()}};function $p(n,e){return E(n,e,p.hex(c.dim)("\u2026"))}var aW=500;var qp=class{constructor(e){this.options=e;this.externalEditorFlow=new Fp({editor:e.editor,tui:e.renderLifecycle??e.tui,workspaceDir:e.workspaceDir,configuredCommand:e.externalEditorCommand,editDraft:e.editDraftInExternalEditor,isAppStopped:e.isStopped,append:e.append,setHint:e.setHint,onChanged:e.onChanged,keybindings:e.keybindings})}options;externalEditorFlow;clearedEditorDraft;ctrlCExitArmed=false;lastEscapeAtMs=0;nextBusySubmission;attach(){const e=this.options.editor.onAutocompleteSelect;const t=(s,r)=>{e?.(s,r);if("pluginId"in r)return;const o=lW(r.value,s.prefix);if(!o)return;void this.options.composerDraft.queueAttachment(o).catch(a=>this.options.append(N(a,{summary:"Couldn't attach that image.",nextStep:"Check the path and try again."}),"error"))};this.options.editor.onAutocompleteSelect=t;this.options.editor.onPaste=s=>{const r=C1(s);if(!r)return false;for(const o of r){void this.options.composerDraft.queueAttachment(o,{source:"terminal-paste"}).catch(a=>this.options.append(N(a,{summary:"Couldn't attach that file.",nextStep:"Check the path and try again."}),"error"))}return true};this.options.editor.onAttachmentPlaceholderDeleted=s=>{void this.options.composerDraft.removeAttachmentById(s).then(r=>{if(!r)this.options.composerDraft.ensureAttachmentPlaceholders()}).catch(r=>this.options.append(N(r,{summary:"Couldn't remove that attachment.",nextStep:"Retry."}),"error"))};this.options.editor.onAttachmentPlaceholderRestored=s=>{if(!this.options.composerDraft.restoreAttachmentById(s)){this.options.composerDraft.ensureAttachmentPlaceholders()}};this.options.editor.onSubmit=(s,r)=>{const o=this.nextBusySubmission;this.nextBusySubmission=void 0;let a;try{a=this.options.commandFlow.captureSubmissionSeed(r)}catch(d){this.options.editor.restoreDraft(r);this.options.append(N(d,{summary:"Couldn't prepare this message.",nextStep:"Review attachments and retry.",preservation:"Your draft is preserved."}),"error");this.options.onChanged();return}const u=Boolean(a.transportContent);const l=!u&&(this.options.commandFlow.catalog.resolve(s.trim())||Ao(s))?void 0:this.options.onSubmissionStarted?.(s,a);if(s.trim())this.options.editor.addToHistory(s);this.options.editor.setText("");void this.options.commandFlow.submit(s,a,{...o??{busyAction:"steer"},onRuntimeAccepted:()=>this.options.onSubmissionAdmitted?.(l),onSubmissionPrepared:d=>this.options.onSubmissionPrepared?.(l,d)}).then(d=>{if(d==="consumed"){this.options.onSubmissionSettled?.(l)}this.options.onChanged()},async d=>{const h=N(d,{summary:"Couldn't send this message.",nextStep:"Retry.",preservation:"Your draft is preserved."});await this.options.commandFlow.restoreFailedSeed(s,a);this.options.append(h,"error");this.options.onChanged()}).catch(d=>this.options.append(N(d,{summary:"Couldn't preserve this failed message.",nextStep:"Copy it before exiting."}),"error"))};const i=(this.options.addInputListener??this.options.tui.addInputListener)(s=>this.handle(s));return()=>{i();this.options.editor.onPaste=void 0;this.options.editor.onAttachmentPlaceholderDeleted=void 0;this.options.editor.onAttachmentPlaceholderRestored=void 0;if(this.options.editor.onAutocompleteSelect===t){this.options.editor.onAutocompleteSelect=e}}}handle(e){if(un(e))return void 0;const t=this.options.interaction.isActive();if((S(e,"escape")||S(e,"ctrl+c"))&&this.options.cancelBash?.()){return{consume:true}}const i=this.options.keybindings??ri();const s=i.resolve(e,{interactionActive:t,hasLiveRun:Boolean(this.options.liveRunId()),hasWaitingMessage:this.options.hasWaitingMessage(),hasRestorableDraft:Boolean(this.clearedEditorDraft)});if(s!=="resume-codex")this.options.dismissRecentCodexSession?.();if(s!=="clear")this.ctrlCExitArmed=false;if(s!=="interrupt")this.lastEscapeAtMs=0;if(s==="suspend"&&this.options.requestProcessSuspend){this.options.requestProcessSuspend();return{consume:true}}if(s==="toggle-side-session"){void this.options.toggleSideConversation?.().then(l=>{if(!l){this.options.setHint("No side conversation is open. Run /btw first; this shortcut only switches conversations.","warning")}this.options.onChanged()});return{consume:true}}if(this.options.featureFlow.isFeatureScreenActive()){this.ctrlCExitArmed=false;this.lastEscapeAtMs=0;return void 0}if(t){this.lastEscapeAtMs=0;if(s!=="scroll-up"&&s!=="scroll-down")return void 0;const l=s==="scroll-up"?-1:1;const d=this.options.interaction.scrollByPage(l);if(d===void 0)return void 0;this.options.tui.requestRender();return{consume:true}}const r=this.options.editor.getAttachmentPreview();const o=r&&(this.options.isEditImageAttachment?.(r.id)||this.options.composerDraft.snapshot().attachments.some(l=>l.filePath===r.id&&l.type==="image"));if(o&&S(e,"escape")){this.options.editor.dismissAttachmentPreview();this.lastEscapeAtMs=0;return{consume:true}}if(this.options.acceptPromptSuggestion&&S(e,"tab")&&this.options.editor.getText().length===0&&!this.options.composerDraft.hasContent()&&this.options.acceptPromptSuggestion()){return{consume:true}}if(this.clearedEditorDraft&&s==="restore-draft"){const l=this.clearedEditorDraft;this.clearedEditorDraft=void 0;this.ctrlCExitArmed=false;this.options.composerDraft.restoreClearedDraft();this.options.editor.restoreDraft(l);this.options.setHint("Draft restored");this.options.onChanged();return{consume:true}}if(this.clearedEditorDraft){this.clearedEditorDraft=void 0;void this.options.composerDraft.discardClearedDraft().catch(l=>this.options.append(N(l,{summary:"Couldn't discard the saved draft.",nextStep:"Retry."}),"error"))}if(s==="resume-codex"){if(this.options.editor.getText().length>0||this.options.composerDraft.hasContent()){return void 0}const l=this.options.takeRecentCodexSession?.();if(!l)return void 0;const d=`/resume-codex ${l.sessionId}`;const h=this.options.onSubmissionStarted?.(d);void this.options.commandFlow.submit(d).then(m=>{if(m==="retained")this.options.restoreRecentCodexSession?.(l);this.options.onChanged()}).catch(m=>{this.options.restoreRecentCodexSession?.(l);this.options.append(N(m,{summary:"Couldn't resume that Codex session.",nextStep:"Press Ctrl+U to retry or run /resume-codex with the session id."}),"error");this.options.onChanged()}).finally(()=>this.options.onSubmissionSettled?.(h));return{consume:true}}if(s==="paste-image"){void this.options.composerDraft.pasteClipboard();return{consume:true}}if(s==="open-external-editor"){void this.externalEditorFlow.open().catch(l=>this.options.append(N(l,{summary:"Couldn't open the external editor.",nextStep:"Check $VISUAL or $EDITOR and retry.",preservation:"Your draft is preserved."}),"error"));return{consume:true}}if(s==="search-history"){this.openHistorySearch();return{consume:true}}if(s==="submit-guidance"||s==="queue-draft"){if(this.options.editor.getText().length===0&&!this.options.composerDraft.hasContent()){return{consume:true}}this.nextBusySubmission={busyAction:s==="submit-guidance"?"steer":"queue"};if(!this.options.editor.submit())this.nextBusySubmission=void 0;return{consume:true}}if(s==="restore-waiting"){void this.options.restoreWaitingMessage().catch(l=>this.options.append(N(l,{summary:"Couldn't restore the latest queued message.",nextStep:"Retry."}),"error"));return{consume:true}}if(s==="manage-waiting"){this.options.openQueueManager();return{consume:true}}if(s==="toggle-tasks"){this.options.toggleTasks();this.options.onChanged();return{consume:true}}if(s==="toggle-details"){this.options.featureFlow.toggleTranscriptDetails();this.options.tui.requestRender();return{consume:true,render:false}}if(s==="cycle-permission"){void this.options.permissionModeFlow.cycle();return{consume:true}}if(s==="toggle-plan"){if(this.options.interactionFlow.hasPending()){this.options.setHint("Resolve the pending Agent interaction before changing Plan Mode.");this.options.interactionFlow.showPending();this.options.onChanged();return{consume:true}}this.options.planModeFlow?.toggle();return{consume:true}}if(s==="exit"){if(this.options.isSideModeActive?.()){if(this.options.editor.getText().length>0||this.options.composerDraft.hasContent()){return void 0}void this.options.closeSideConversation?.("ctrl_d");return{consume:true}}void this.options.leaveUi();return{consume:true}}const a=s==="clear";const u=s==="interrupt";if(!a&&!u){this.options.setHint(void 0);return void 0}if(a&&this.options.composerDraft.abortClipboardRead()){return{consume:true}}if(u){if(this.options.cancelSessionEdit?.()){this.lastEscapeAtMs=0;this.options.tui.requestRender();return{consume:true}}if(this.options.liveRunId()){this.lastEscapeAtMs=0;void this.options.abortLiveTurn();this.options.tui.requestRender();return{consume:true}}if(this.options.editor.getText().length>0||this.options.composerDraft.hasContent()){this.lastEscapeAtMs=0;return void 0}if(this.options.isSideModeActive?.()){this.lastEscapeAtMs=0;this.options.setHint(void 0);return void 0}const l=Date.now();if(this.lastEscapeAtMs>0&&l-this.lastEscapeAtMs<aW){this.lastEscapeAtMs=0;this.options.setHint(void 0);void this.options.commandFlow.submit("/edit").then(()=>this.options.onChanged(),d=>{this.options.append(N(d,{summary:"Couldn't edit the latest message.",nextStep:"Run /edit to retry."}),"error");this.options.onChanged()});return{consume:true}}this.lastEscapeAtMs=l;this.options.setHint("Press Esc again to edit the latest message");this.options.onChanged();return void 0}if(this.options.isSideModeActive?.()&&this.options.editor.getText().length===0&&!this.options.composerDraft.hasContent()){this.ctrlCExitArmed=false;this.options.setHint(void 0);void this.options.closeSideConversation?.("ctrl_c").then(()=>this.options.onChanged(),()=>this.options.onChanged());this.options.tui.requestRender();return{consume:true}}if(a&&this.options.liveRunId()){if(this.ctrlCExitArmed){this.ctrlCExitArmed=false;void this.options.leaveUi();return{consume:true}}this.ctrlCExitArmed=true;void this.options.abortLiveTurn();this.options.tui.requestRender();return{consume:true}}if(this.ctrlCExitArmed){this.ctrlCExitArmed=false;void this.options.leaveUi()}else if(this.options.editor.getText().length>0||this.options.composerDraft.hasContent()){this.ctrlCExitArmed=true;this.options.editor.addToHistory(this.options.editor.getText());this.clearedEditorDraft=this.options.editor.captureDraft();this.options.composerDraft.stashForClear();this.options.editor.restoreDraft({...this.clearedEditorDraft,text:"",pluginMentions:[],cursor:0,pastes:[],attachmentPlaceholders:[]});const l=this.options.keybindings??ri();this.options.setHint(`Draft cleared \xB7 ${Te("composer.restore-draft",l)} restore \xB7 ${Te("app.clear",l)} exit`);this.options.onChanged()}else{this.ctrlCExitArmed=true;const l=this.options.keybindings??ri();this.options.setHint(`Press ${Te("app.clear",l)} again to exit`);this.options.onChanged()}this.options.tui.requestRender();return{consume:true}}openHistorySearch(){const e=this.options.editor.getHistoryEntries();if(e.length===0){this.options.setHint("No prompt history yet.");this.options.onChanged();return}const t=this.options.editor.getText();const i=new Bp({entries:e,initialQuery:t,onSelect:s=>{this.options.editor.setText(s);this.options.interactionSurface.close(i);this.options.onChanged()},onCancel:()=>{this.options.interactionSurface.close(i);this.options.onChanged()},requestRender:this.options.requestInteractionRender});this.options.interactionSurface.show(i)}};var uW=/\.(?:avif|bmp|gif|jpe?g|png|svg|webp)$/iu;function lW(n,e){if(!e.startsWith("@")||!n.startsWith("@"))return void 0;const t=n.slice(1);const i=t.length>=2&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t;if(!uW.test(i))return void 0;return t}var Hp=class{constructor(e){this.options=e}options;modeValue;deleteGuardEnabledValue;updatingValue=false;refreshSequence=0;mutationSequence=0;stopped=false;snapshot(){return{mode:this.modeValue,updating:this.updatingValue,deleteGuardEnabled:this.deleteGuardEnabledValue}}async refresh(){const e=++this.refreshSequence;const t=this.mutationSequence;const[i,s]=await Promise.all([this.options.runtime.getPermissionMode(),dW(this.options.runtime)]);if(this.isStopped()||e!==this.refreshSequence||t!==this.mutationSequence||this.updatingValue){return}this.modeValue=i;this.deleteGuardEnabledValue=s;this.options.onChanged()}async cycle(){if(this.isStopped()||this.updatingValue)return;if(!this.modeValue){this.options.setHint("Permission mode is managed by Desktop");this.options.onChanged();return}await this.set(GT(this.modeValue))}async set(e){if(this.isStopped()||this.updatingValue)return;if(!this.modeValue){this.options.setHint("Permission mode is managed by Desktop");this.options.onChanged();return}if(e===this.modeValue){this.options.setHint(`Permission mode \xB7 ${Bn(e)}`);this.options.onChanged();return}this.updatingValue=true;const t=++this.mutationSequence;this.refreshSequence+=1;this.options.setHint(`Switching to ${Bn(e)}\u2026`);this.options.onChanged();try{const i=await this.options.runtime.setPermissionMode(e);if(this.isStopped()||t!==this.mutationSequence)return;this.modeValue=i;this.options.setHint(void 0)}catch(i){if(this.isStopped()||t!==this.mutationSequence)return;this.options.append(N(i,{summary:"Permission mode was not changed.",nextStep:"Retry /permission or Alt+M."}),"warning");this.options.setHint("Permission mode unchanged")}finally{if(!this.isStopped()&&t===this.mutationSequence){this.updatingValue=false;this.options.onChanged()}}}async setDeleteGuardEnabled(e){if(this.isStopped()||this.updatingValue)return;const t=this.options.runtime;if(this.deleteGuardEnabledValue===void 0||typeof t.setDangerousCommandGateEnabled!=="function"){this.options.setHint("Delete guard is managed by host");this.options.onChanged();return}if(this.deleteGuardEnabledValue===e){this.options.setHint(`Delete guard \xB7 ${Ni(e)}`);this.options.onChanged();return}this.updatingValue=true;const i=++this.mutationSequence;this.refreshSequence+=1;this.options.setHint(`Delete guard \xB7 ${Ni(e)}\u2026`);this.options.onChanged();try{const s=await t.setDangerousCommandGateEnabled(e);if(this.isStopped()||i!==this.mutationSequence)return;this.deleteGuardEnabledValue=s;this.options.setHint(`Delete guard \xB7 ${Ni(s)}`)}catch(s){if(this.isStopped()||i!==this.mutationSequence)return;this.options.append(N(s,{summary:"Delete guard was not changed.",nextStep:"Retry /delete-guard."}),"warning");this.options.setHint("Delete guard unchanged")}finally{if(!this.isStopped()&&i===this.mutationSequence){this.updatingValue=false;this.options.onChanged()}}}showStatus(){this.options.append(this.modeValue?`Permission mode: ${Bn(this.modeValue)}.`:"Permission mode is managed by Desktop.")}stop(){this.stopped=true;this.refreshSequence+=1;this.mutationSequence+=1;this.updatingValue=false}isStopped(){return this.stopped||Boolean(this.options.isStopped?.())}};async function dW(n){if(typeof n.getDangerousCommandGateEnabled!=="function")return void 0;return n.getDangerousCommandGateEnabled().catch(()=>void 0)}var Up=class{constructor(e){this.options=e}options;modeValue;updatingValue=false;refreshSequence=0;mutationSequence=0;stopped=false;snapshot(){return{mode:this.modeValue,updating:this.updatingValue}}async refresh(){const e=++this.refreshSequence;const t=this.mutationSequence;const i=await cW(this.options.runtime);if(this.isStopped()||e!==this.refreshSequence||t!==this.mutationSequence||this.updatingValue){return}this.modeValue=i;this.options.onChanged()}async set(e){if(this.isStopped()||this.updatingValue)return;const t=this.options.runtime;if(this.modeValue===void 0||typeof t.setSandboxFilesystemMode!=="function"){this.options.setHint("Sandbox is managed by host");this.options.onChanged();return}if(this.modeValue===e){this.options.setHint(`Sandbox \xB7 ${Bi(e)}`);this.options.onChanged();return}this.updatingValue=true;const i=++this.mutationSequence;this.refreshSequence+=1;this.options.setHint(`Sandbox \xB7 ${Bi(e)}\u2026`);this.options.onChanged();try{const s=await t.setSandboxFilesystemMode(e);if(this.isStopped()||i!==this.mutationSequence)return;this.modeValue=s;this.options.setHint(`Sandbox \xB7 ${Bi(s)}`)}catch(s){if(this.isStopped()||i!==this.mutationSequence)return;this.options.append(N(s,{summary:"Sandbox was not changed.",nextStep:"Retry /sandbox."}),"warning");this.options.setHint("Sandbox unchanged")}finally{if(!this.isStopped()&&i===this.mutationSequence){this.updatingValue=false;this.options.onChanged()}}}stop(){this.stopped=true;this.refreshSequence+=1;this.mutationSequence+=1;this.updatingValue=false}isStopped(){return this.stopped||Boolean(this.options.isStopped?.())}};async function cW(n){if(typeof n.getSandboxFilesystemMode!=="function")return void 0;return n.getSandboxFilesystemMode().catch(()=>void 0)}var jp=class{constructor(e){this.options=e;this.entryEnabled=e.loadEntryEnabled===void 0}options;armed;submitting;acceptedExitDraftKey;entryEnabled;stopped=false;async refreshCapabilities(){if(!this.options.loadEntryEnabled||this.isStopped())return;this.entryEnabled=false;this.clearDisabledEntryIntent();this.options.onChanged();const e=await this.options.loadEntryEnabled();if(this.isStopped())return;this.entryEnabled=e;if(!e)this.clearDisabledEntryIntent();this.options.onChanged()}snapshot(){const e=this.options.currentSession();this.dropLocalStateForOtherSession(e);const t=Mu(e);if(this.acceptedExitDraftKey&&t==="default"){this.acceptedExitDraftKey=void 0}if(this.submitting&&t===Wp(this.submitting.intent)){this.submitting=void 0;this.options.setHint(void 0)}if(this.acceptedExitDraftKey)return{displayMode:"default"};const i=this.armed??this.submitting;return{displayMode:i?Wp(i.intent):t,...this.armed?{transition:"next-message"}:this.submitting?{transition:"submitting"}:{}}}captureClientIntent(){this.dropLocalStateForOtherSession(this.options.currentSession());return this.armed?.intent}reserveClientIntent(e){const t=this.options.currentSession();this.dropLocalStateForOtherSession(t);if(!this.armed||this.submitting)return void 0;const i=this.armed.intent;this.submitting={...this.armed,submissionId:e};this.armed=void 0;this.options.setHint(`${Yy(Wp(i))} Mode change submitting\u2026`);this.options.onChanged();return i}bindSubmissionToSession(e,t){const i=this.submitting;if(!i||i.submissionId!==e||i.draftKey!==Ik){return}this.submitting={...i,draftKey:t}}acceptDirect(e,t,i){if(!e||this.isStopped())return;const s=this.takeSubmitting(e,i);if(!s||this.options.currentSession()?.sessionId!==t)return;if(e==="plan-exit"&&Mu(this.options.currentSession())==="plan"){this.acceptedExitDraftKey=t}this.options.setHint(void 0);this.options.onChanged()}rejectSubmission(e){const t=this.submitting;if(!t||t.submissionId!==e)return;this.submitting=void 0;const i=this.options.currentSession();if(t.draftKey!==Kp(i))return;if(Mu(i)===Wp(t.intent)){this.options.setHint(void 0);this.options.onChanged();return}this.arm(t.intent,i)}acceptQueued(e,t,i,s){if(!e||this.isStopped())return;const r=this.takeSubmitting(e,s);if(!r||this.options.currentSession()?.sessionId!==t)return;if(e==="plan-exit"&&Mu(this.options.currentSession())==="plan"){this.acceptedExitDraftKey=t}this.options.setHint(void 0);this.options.onChanged()}restoreQueued(e,t){if(this.isStopped()||this.options.currentSession()?.sessionId!==t)return;this.acceptedExitDraftKey=void 0;this.armed={intent:e,draftKey:Kp(this.options.currentSession())};this.options.setHint(e==="plan-entry"?"Plan Mode \xB7 restored message will enter Plan":"Default Mode \xB7 restored message will exit Plan");this.options.onChanged()}toggle(){if(this.isStopped())return;const e=this.options.currentSession();this.dropLocalStateForOtherSession(e);if(this.acceptedExitDraftKey)return;if(this.submitting){this.options.setHint("Plan mode change is already being submitted.");this.options.onChanged();return}if(this.armed){this.armed=void 0;this.options.setHint(void 0);this.options.onChanged();return}const t=Mu(e)==="plan"?"plan-exit":"plan-entry";if(t==="plan-entry"&&!this.entryEnabled){this.options.append("Plan Mode entry is disabled by the Runtime configuration.","warning");this.options.setHint(void 0);this.options.onChanged();return}this.acceptedExitDraftKey=void 0;this.arm(t,e)}set(e){if(this.isStopped())return;const t=this.snapshot();if(t.displayMode===e){this.options.setHint(`${Yy(e)} Mode is selected`);this.options.onChanged();return}this.toggle()}showStatus(){const e=this.snapshot();const t=e.transition==="next-message"?" on the next message":e.transition==="submitting"?" while the current message is admitted":"";this.options.append(`${Yy(e.displayMode)} Mode${t}.`)}stop(){this.stopped=true;this.armed=void 0;this.submitting=void 0;this.acceptedExitDraftKey=void 0}arm(e,t){this.armed={intent:e,draftKey:Kp(t)};this.options.setHint(e==="plan-entry"?"Plan Mode \xB7 next message enters Plan":"Default Mode \xB7 next message exits Plan");this.options.onChanged()}takeSubmitting(e,t){const i=this.submitting;if(!i||i.intent!==e||t!==void 0&&i.submissionId!==t){return void 0}this.submitting=void 0;return i}dropLocalStateForOtherSession(e){const t=Kp(e);const i=Boolean(this.armed&&this.armed.draftKey!==t);const s=Boolean(this.submitting&&this.submitting.draftKey!==t);const r=Boolean(this.acceptedExitDraftKey&&this.acceptedExitDraftKey!==t);if(i)this.armed=void 0;if(s)this.submitting=void 0;if(r)this.acceptedExitDraftKey=void 0;if(i||s||r)this.options.setHint(void 0)}isStopped(){return this.stopped||Boolean(this.options.isStopped?.())}clearDisabledEntryIntent(){if(this.armed?.intent!=="plan-entry")return;this.armed=void 0;this.options.setHint(void 0)}};var Ik="new-session-draft";function Kp(n){return n?.sessionId??Ik}function Mu(n){return n?.interactionMode==="plan"?"plan":"default"}function Wp(n){return n==="plan-entry"?"plan":"default"}function Yy(n){return n==="plan"?"Plan":"Default"}function Ek(n){return async()=>{const e=n.controller.snapshot();const t=e.session;const i=async()=>{if(!t||$n(t))return false;let o;try{o=await n.stopDelegation(t.sessionId)}catch(a){n.append(N(a,{summary:"Couldn't stop delegated agents.",nextStep:"Retry Esc.",preservation:"They may still be running."}),"error");return false}if(o.failedSessionIds.length>0||o.activeSessionIds.length>0){n.append(`Some delegated agents did not stop cleanly: ${[...o.failedSessionIds,...o.activeSessionIds].join(", ")}`,"warning")}return o.rootStopped||o.stoppedSessionIds.length>0};if(e.activeTurnId){const o=e.activeTurnId;let a=false;let u=false;try{const h=i();a=await n.controller.abort();u=await h;if(!a&&!u){n.append("Runtime did not confirm that the active response stopped.","warning")}}finally{n.setTransientHint(void 0);n.updateChrome();n.requestRender()}let l;const d=a?await Promise.race([n.controller.whenIdle().then(()=>true),new Promise(h=>{l=setTimeout(()=>h(false),eb)})]):false;if(l!==void 0)clearTimeout(l);if(a&&d&&n.onLiveTurnAborted){Mk(n,{turnId:o,sessionId:t?.sessionId})}return u||a}const s=n.latestRuntimeTurnId();if(!s||!e.session?.sessionId)return false;const r=e.session.sessionId;n.setTransientHint("Stopping the current response. Your draft is preserved.");n.runProjection.markRuntimeTurnStopping(s);n.updateChrome();n.requestRender();try{const o=i();const a=await n.abortSession({id:r,turnId:s,reason:"user_stop"});const u=await o;if(!a&&!u){n.append("Runtime did not confirm that the active response stopped.","warning")}const l=await n.getActiveRun(r).catch(()=>void 0);const d=!!l&&(l.state==="idle"||l.state==="terminal"||l.turnId&&l.turnId!==s);if(d){n.runProjection.clearRuntimeTurn(s);n.setTransientHint(void 0)}n.updateChrome();n.requestRender();if(a&&d&&n.onLiveTurnAborted){Mk(n,{turnId:s,sessionId:r})}return a||u}catch(o){n.runProjection.clearRuntimeTurnStopping(s);n.setTransientHint(void 0);n.append(N(o,{summary:"Couldn't stop the current response.",nextStep:"Retry Esc.",preservation:"It may still be running."}),"error");n.updateChrome();n.requestRender();return false}}}function Mk(n,e){if(!n.onLiveTurnAborted)return;try{n.onLiveTurnAborted(e)}catch(t){n.append(N(t,{summary:"Couldn't return the aborted prompt to the composer.",nextStep:"Retry Esc, or recall the prompt with Up.",preservation:"The session transcript is unchanged."}),"warning")}}var hW=80;var Xy=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];var pW=4;var Vp=class{constructor(e){this.options=e}options;state={status:"review"};selectedAction=0;detailsExpanded=false;frameIndex=0;recentOutput=[];animationTimer;restarting=false;disposed=false;applyController;focused=false;handleInput(e){if(this.state.status==="applying"||this.restarting){if(S(e,"d"))this.toggleDetails();if(this.state.status==="applying"&&this.state.cancellable&&!this.state.cancelRequested&&(S(e,z.escape)||S(e,z.ctrl("c")))){this.applyController?.abort();this.setState({...this.state,cancelRequested:true})}return}if(S(e,z.escape)||S(e,z.ctrl("c"))){this.options.onClose();return}if(S(e,"d")){this.toggleDetails();return}if(this.state.status==="review"){if(S(e,z.up)||S(e,z.down)){this.selectedAction=this.selectedAction===0?1:0;this.options.requestRender();return}if(S(e,z.enter)){if(this.selectedAction===0){if(this.options.onApplyConfirmed)this.options.onApplyConfirmed();else void this.apply()}else this.options.onClose()}return}if((this.state.status==="failed"||this.state.status==="paused"||this.state.status==="cancelled")&&S(e,z.enter)){void this.apply();return}if(this.state.status==="succeeded"&&S(e,z.enter)){void this.restart()}}invalidate(){}render(e){const t=yu(e);if(t===0)return us([""],e,this.tone());const i=this.state.status==="review"?this.renderReview(t):this.state.status==="applying"?this.renderApplying(t):this.state.status==="paused"?this.renderPaused(t):this.state.status==="cancelled"?this.renderCancelled(t):this.state.status==="failed"?this.renderFailure(t):this.renderSuccess(t);return us(fW(i,this.options.maxRows),e,this.tone())}dispose(){this.disposed=true;if(this.state.status==="applying"&&this.state.cancellable){this.applyController?.abort()}this.stopAnimation()}async apply(){this.recentOutput=[];this.frameIndex=0;const e=new AbortController;this.applyController=e;this.setState({status:"applying",startedAtMs:this.now(),phase:this.options.plan.kind==="package-manager"?"installing":"checking",cancellable:this.options.plan.kind!=="package-manager",cancelRequested:false});try{const t=await this.options.apply(this.options.plan,{onOutput:i=>this.acceptOutput(i),signal:e.signal,onPhase:i=>this.acceptPhase(i.phase,i.cancellable)});if(this.disposed)return;this.setState({status:"succeeded",outcome:t})}catch(t){if(this.disposed)return;if(pb(t))this.setState({status:"cancelled"});else if(mb(t)){this.setState({status:"paused",reason:x(t.message)})}else{const i=qo(t,{summary:"The update couldn't be installed.",nextStep:"Retry, or close this panel and try again later.",preservation:"The previous MCode version is still active."});this.detailsExpanded=false;this.setState({status:"failed",message:i.message,...i.diagnostic?{diagnostic:i.diagnostic}:{}})}}finally{if(this.applyController===e)this.applyController=void 0}}async restart(){if(this.restarting)return;this.restarting=true;this.options.requestRender();try{await this.options.onRestart()}catch(e){if(this.disposed)return;this.restarting=false;const t=qo(e,{summary:"MCode couldn't restart automatically.",nextStep:"Close this terminal and start MCode again.",preservation:"The update is already installed."});this.detailsExpanded=false;this.setState({status:"failed",message:t.message,...t.diagnostic?{diagnostic:t.diagnostic}:{}})}}renderReview(e){const{currentVersion:t,latestVersion:i}=this.options.plan;return[$t("MCode update available",Eu(this.options.plan),e,"signal"),p.bold.hex(c.text)(Ln(`${t} \u2192 ${i}`,e)),"",Ak("Update now",this.selectedAction===0,e),Ak("Not now",this.selectedAction===1,e),...this.renderDetails(e),"",Y(Ln("\u2191\u2193 choose \xB7 Enter confirm \xB7 d details \xB7 Esc close",e))]}renderApplying(e){const t=Xy[this.frameIndex]??Xy[0];const i=Math.max(0,Math.floor((this.now()-this.stateStartedAtMs())/1e3));const s=this.detailsExpanded?this.recentOutput:this.recentOutput.slice(-Math.min(2,this.recentOutput.length));return[$t(`${t} Updating MCode`,i>0?`${i}s`:void 0,e,"signal"),p.hex(c.muted)(Ln(`${mW(this.state.status==="applying"?this.state.phase:"installing")} ${this.options.plan.latestVersion} with ${Eu(this.options.plan)}`,e)),...s.length>0?["",p.hex(c.dim)("Latest output"),...s.flatMap(r=>er(r,e,c.muted))]:[],...this.renderDetails(e),"",Y(Ln(this.state.status==="applying"&&this.state.cancellable?this.state.cancelRequested?"Cancelling safely\u2026 \xB7 d details":"Esc cancel safely \xB7 d details":"Finishing safely \xB7 cancellation is locked \xB7 d details",e))]}renderPaused(e){const t=this.state.status==="paused"?this.state.reason:"MCode is busy.";return[$t("Update paused",Eu(this.options.plan),e,"signal"),...er(t,e,c.warning),"",p.bold.hex(c.signal)("\u203A Check again"),Y(Ln("Enter retry \xB7 Esc close",e))]}renderCancelled(e){return[$t("Update cancelled safely",Eu(this.options.plan),e,"success"),...er("The previous MCode installation remains active.",e,c.muted),"",p.bold.hex(c.signal)("\u203A Try again"),Y(Ln("Enter retry \xB7 Esc close",e))]}renderFailure(e){const t=this.state.status==="failed"?this.state.message:"The update couldn't be installed.";const i=this.state.status==="failed"&&this.state.diagnostic?Qt(x(this.state.diagnostic)):void 0;return[$t("\xD7 Update failed",Eu(this.options.plan),e,"error"),...er(t,e,c.error),...i?er(i,e,c.muted):[],...this.renderDetails(e),"",p.bold.hex(c.signal)("\u203A Retry"),Y(Ln("Enter retry \xB7 d details \xB7 Esc close",e))]}renderSuccess(e){const t=this.state.status==="succeeded"?this.state.outcome:void 0;return[$t(`\u2713 MCode updated to ${this.options.plan.latestVersion}`,void 0,e,"success"),...t?er(t.message,e,c.muted):[],"",p.bold.hex(c.signal)(this.restarting?"\u280B Restarting MCode\u2026":"\u203A Restart MCode now"),Y(Ln("Enter restart \xB7 Esc restart later",e))]}renderDetails(e){if(!this.detailsExpanded)return[];const t=this.options.plan.kind==="package-manager"?this.options.plan.command.display:"Signature + checksum + staging + atomic activation";return["",p.hex(c.dim)("Details"),...er(t,e,c.muted)]}acceptOutput(e){if(this.disposed)return;const t=oe(e).split(/[\r\n]+/u).map(i=>Qt(x(i.trim()))).filter(Boolean);if(t.length===0)return;this.recentOutput=[...this.recentOutput,...t].slice(-pW);this.options.requestRender()}acceptPhase(e,t){if(this.disposed||this.state.status!=="applying")return;this.setState({...this.state,phase:e,cancellable:t})}setState(e){this.state=e;if(e.status==="applying")this.startAnimation();else this.stopAnimation();this.options.requestRender()}startAnimation(){if(this.animationTimer)return;this.animationTimer=setInterval(()=>{this.frameIndex=(this.frameIndex+1)%Xy.length;this.options.requestRender()},hW);this.animationTimer.unref?.()}stopAnimation(){if(!this.animationTimer)return;clearInterval(this.animationTimer);this.animationTimer=void 0}toggleDetails(){this.detailsExpanded=!this.detailsExpanded;this.options.requestRender()}tone(){if(this.state.status==="failed")return"error";if(this.state.status==="succeeded"||this.state.status==="cancelled")return"success";return"signal"}stateStartedAtMs(){return this.state.status==="applying"?this.state.startedAtMs:this.now()}now(){return this.options.now?.()??Date.now()}};function mW(n){if(n==="checking")return"Checking";if(n==="downloading")return"Downloading";if(n==="staging")return"Staging";if(n==="validating")return"Validating";if(n==="activating")return"Activating";if(n==="completed")return"Completed";return"Installing"}function Eu(n){return n.source==="managed-installer"?"Official installer":n.source.replace("-global","")}function Ak(n,e,t){const i=`${e?"\u203A":" "} ${n}`;return e?p.bold.hex(c.signal)(Ln(i,t)):p.hex(c.muted)(Ln(i,t))}function er(n,e,t){return J(p.hex(t)(n),Math.max(1,e)).map(i=>Ln(i,e))}function Ln(n,e){return E(n,Math.max(0,e),"\u2026")}function fW(n,e){const t=Math.max(4,Math.floor(typeof e==="function"?e():e));if(n.length<=t)return n;return[...n.slice(0,t-2),p.hex(c.dim)("\u2026"),n.at(-1)??""]}function Rk(n,e,t,i,s,r,o){return new Jy({inspect:n.inspectUpdate??(async()=>({kind:"manual",source:"unsupported",currentVersion:n.version,command:"mcode update"})),apply:n.applyUpdate??(async()=>{throw new Error("In-process update is unavailable in this TUI build.")}),append:e,showPanel:a=>t.show(a),closePanel:a=>t.close(a),requestRender:i,maxRows:s,restart:r,...o?{admit:o}:{}})}var Jy=class{constructor(e){this.options=e}options;panel;requestSequence=0;stopped=false;updateTask;async show(){if(this.stopped)return;if(this.updateTask){this.options.append("An MCode update is already running. Please wait for it to finish.","warning");return}const e=++this.requestSequence;let t;try{t=await this.options.inspect()}catch(s){if(this.stopped||e!==this.requestSequence)return;this.options.append(N(s,{summary:"Couldn't check for updates.",nextStep:"Retry /update."}),"error");return}if(this.stopped||e!==this.requestSequence)return;if(t.kind==="current"){this.options.append(t.source==="managed-installer"?`MCode ${t.currentVersion} is current on ${t.channel}.`:`MCode ${t.currentVersion} is current on @${t.packageTag}.`);return}if(t.kind==="ahead"){this.options.append(`MCode ${t.currentVersion} is newer than ${t.source==="managed-installer"?t.channel:`@${t.packageTag}`} ${t.latestVersion}.`);return}if(t.kind==="source-build"){this.options.append(fb);return}if(t.kind==="manual"){this.options.append(`Automatic update is unavailable for this installation. Update manually with: ${t.command}`,"warning");return}const i=new Vp({plan:t,maxRows:this.options.maxRows,apply:async(s,r)=>{await this.requireAdmission();return this.options.apply(s,r)},requestRender:this.options.requestRender,onClose:()=>this.close(i),onRestart:async()=>{await this.requireAdmission();await this.options.restart()},onApplyConfirmed:()=>this.startBackgroundUpdate(t,i)});if(this.panel){this.options.closePanel(this.panel);kt(this.panel)}this.panel=i;this.options.showPanel(i)}startBackgroundUpdate(e,t){if(this.updateTask){this.options.append("An MCode update is already running. Please wait for it to finish.","warning");return}this.close(t);this.options.append(`MCode update started in the background (${e.currentVersion} \u2192 ${e.latestVersion}).`);const i=this.requireAdmission().then(()=>this.options.apply(e,{onOutput:s=>{const r=s.split(/[\r\n]+/u).map(o=>o.trim()).filter(Boolean);if(r.length>0&&!this.stopped){this.options.append(`Update: ${r.at(-1)}`)}}})).then(s=>{if(!this.stopped){this.options.append(`MCode update completed: ${s.message}`);if(s.restartRequired){void this.options.restart()}}},s=>{if(!this.stopped){this.options.append(`MCode update failed: ${s instanceof Error?s.message:String(s)}`,"error")}}).finally(()=>{this.updateTask=void 0});this.updateTask=i}stop(){this.stopped=true;this.requestSequence+=1;if(this.panel){this.options.closePanel(this.panel);kt(this.panel)}this.panel=void 0}close(e){if(!this.options.closePanel(e))return;kt(e);if(this.panel===e)this.panel=void 0}async requireAdmission(){const e=await this.options.admit?.();if(e&&!e.allowed){throw new hb(e.reason??"Finish active MCode work before updating.")}}};function kk(n){return async()=>{const e=n.snapshot();const t=e.session;if(!t)return{allowed:true};if(e.activeTurnId||e.cancelling||e.retiringTurnId){return{allowed:false,reason:"Finish or stop the active response before updating."}}const[i,s,r,o]=await Promise.allSettled([n.runtime.getActiveRun(t.sessionId),n.queueEnabled?n.runtime.listQueuedMessages(t.sessionId):Promise.resolve([]),n.runtime.getPendingQuestionnaire(t.agentName??n.defaultAgentName,t.sessionId),n.runtime.listPendingPermissions()]);if([i,s,r,o].some(a=>a.status==="rejected")){return{allowed:false,reason:"Unable to verify that this Session is idle. Retry when Runtime is reachable."}}if(i.status==="fulfilled"&&(i.value.state==="running"||i.value.state==="decision-blocked")){return{allowed:false,reason:"Finish or stop the active response before updating."}}if(s.status==="fulfilled"&&s.value.some(a=>a.status==="queued")){return{allowed:false,reason:"Send or remove waiting messages before updating."}}if(r.status==="fulfilled"&&r.value){return{allowed:false,reason:"Answer or dismiss the pending question before updating."}}if(o.status==="fulfilled"&&o.value.some(a=>a.sessionId===t.sessionId)){return{allowed:false,reason:"Resolve the pending permission before updating."}}return{allowed:true}}}var gW=Object.freeze({queue:true});function Pk(n){return{...gW,...n}}import{mkdir as yW,writeFile as TW}from"node:fs/promises";import Ai from"node:path";function _k(n){return async e=>{const t=e.outputPath?.trim();const i=t?Ai.dirname(Ai.isAbsolute(t)?t:Ai.resolve(e.workspaceDirectory??n,t)):Ai.resolve(n,"transcript-exports");const s=Ai.resolve(i);await yW(s,{recursive:true});const r=vW(e.sessionId).slice(0,48)||"session";const o=new Date(e.exportedAtMs).toISOString().replaceAll(/[:.]/gu,"-");for(let a=0;a<100;a+=1){const u=a===0?"":`-${String(a)}`;const l=t?bW(t,e.workspaceDirectory??n,u):Ai.join(s,`${r}-${o}${u}.md`);try{await TW(l,e.markdown,{encoding:"utf8",flag:"wx",mode:384});return l}catch(d){if(!SW(d))throw d}}throw new Error("Unable to allocate a unique Transcript export file.")}}function bW(n,e,t){const i=Ai.isAbsolute(n)?n:Ai.resolve(e,n);const s=Ai.extname(i);const r=s?i.slice(0,-s.length):i;return`${r}${t}${s||".md"}`}function vW(n){return n.replace(/[^a-zA-Z0-9._-]+/gu,"-").replace(/^[.-]+|[.-]+$/gu,"")}function SW(n){return n instanceof Error&&"code"in n&&n.code==="EEXIST"}var Ok="/goal: show the current Goal and its latest status.\n/goal <objective>: set a persistent objective the agent will pursue across turns.\n/goal <objective> budget=50K: set objective and token budget in one shot.\n/goal budget=50K: set/change the token budget on the current goal.\n/goal budget=clear: remove the token budget (uncapped).\n/goal clear: remove the current goal.\n/goal edit: edit the objective inline.\n/goal pause: pause auto-continuation.\n/goal resume: resume a paused or blocked goal.";var Dk="[\\s\\u2026\\u3000-\\u30FF\\u4E00-\\u9FFF\\uFF00-\\uFFEF]";var Lk=new RegExp(`^budget=([A-Za-z0-9.]+)(?=$|${Dk})`,"iu");var CW=new RegExp(`(^|${Dk})budget=([A-Za-z0-9.]+)$`,"iu");var xW=/[\s…、。!,:;?]+$/u;var wW=/^[\s…、。!,:;?]+/u;function IW(n){const e=n.trimEnd();const t=e.search(/\s\S*$/);const i=t===-1?e:e.slice(t+1);if(!/^budget=[A-Za-z0-9.]*$/i.test(i))return null;const s=i.slice("budget=".length);const r=t===-1?"":e.slice(0,t).trimEnd();return{value:Au(s),head:r}}function MW(n){const e=n.trim();const t=IW(e);if(t?.value==="invalid")return{kind:"invalid"};let i;let s;if(t){i=t.value;s=t.head}else{const o=CW.exec(e);if(o){const a=Au(o[2]??"");if(a!=="invalid"){i=a;s=e.slice(0,o.index+(o[1]??"").length)}}}if(s!==void 0&&i!==void 0){const o=s.replace(xW,"").trim();const a=Lk.exec(o);if(a&&Au(a[1]??"")!=="invalid"){return{kind:"double"}}return{kind:"value",value:i,objective:o}}const r=Lk.exec(e);if(r){const o=Au(r[1]??"");if(o!=="invalid"){const a=e.slice(r[0].length).replace(wW,"").trim();return{kind:"value",value:o,objective:a}}}return{kind:"none"}}function Au(n){const e=n.trim();if(!e)return"invalid";const t=e.toLowerCase();if(t==="clear"||t==="null"||t==="none"||t==="off"||e==="0"){return null}const i=t.match(/^([0-9]+(?:\.[0-9]+)?)([km])?$/);if(!i)return"invalid";const[,s,r]=i;const o=Number(s);if(!Number.isFinite(o)||o<=0)return"invalid";const a=r==="k"?1e3:r==="m"?1e6:1;const u=Math.round(o*a);return u>0?u:"invalid"}function Nk(n){const e=n.trim();if(!e)return{kind:"view"};const t=e.search(/\s/);const i=t===-1?e:e.slice(0,t);const s=i.toLowerCase();if(s==="budget"){return{kind:"error",message:"/goal budget needs a value: `/goal budget=50K` or `/goal budget=clear`."}}if(/^budget=[A-Za-z0-9.]*$/i.test(i)&&e.length===i.length){const r=i.slice("budget=".length);const o=Au(r);if(o==="invalid"){return{kind:"error",message:`Bad budget value: use a positive integer, K/M suffix, or 'clear' (got "${r}").`}}return{kind:"budget",tokenBudget:o}}switch(s){case"clear":case"cancel":case"delete":return e.length>i.length?{kind:"error",message:"/goal clear takes no arguments."}:{kind:"clear"};case"edit":return e.length>i.length?{kind:"error",message:"/goal edit takes no arguments."}:{kind:"edit"};case"pause":return e.length>i.length?{kind:"error",message:"/goal pause takes no arguments."}:{kind:"pause"};case"resume":return e.length>i.length?{kind:"error",message:"/goal resume takes no arguments."}:{kind:"resume"};case"help":return{kind:"help"};default:{const r=MW(e);if(r.kind==="invalid"){return{kind:"error",message:"Bad budget value: use a positive integer, K/M suffix, or `clear`/`null` to remove the cap."}}if(r.kind==="double"){return{kind:"error",message:"budget= is specified more than once: keep a single budget=<value>."}}if(r.kind==="value"){return r.objective?{kind:"create",objective:r.objective,tokenBudget:r.value}:{kind:"budget",tokenBudget:r.value}}return{kind:"create",objective:e}}}}var EW="The current response keeps running; press Esc to interrupt it.";var Gp=class{constructor(e){this.options=e}options;refreshSequence=0;announcedCompletedGoalIds=new Set;async execute(e){const t=Nk(e);if(t.kind==="help"){this.options.append(Ok);return"consumed"}if(t.kind==="error"){this.options.append(t.message,"warning");return"retained"}const i=this.options.composerDraft.capture();try{let s=this.options.currentSessionId();if(!s&&t.kind==="create"){s=await this.options.ensureSessionId?.()}if(!s){this.options.append(t.kind==="create"?"Couldn't create a Session for this Goal. Retry after the Runtime recovers.":"Start or resume a Session before managing its Goal.","warning");return"retained"}const r=++this.refreshSequence;if(!this.options.runtime.isGoalEnabled()){this.options.append("Thread Goal is disabled in the current Runtime.","warning");return"retained"}const o=await this.options.runtime.getGoal(s);if(!this.canProjectOperation(s,r))return"consumed";if(t.kind==="create"){return await this.setObjective(s,t.objective,t.tokenBudget,o,r,i)}if(!o){this.options.append("No Goal exists for the active Session.","warning");return"consumed"}if(t.kind==="view"){this.options.append($E(o));return"consumed"}if(t.kind==="budget"){const l=await this.options.runtime.patchGoal(s,{tokenBudget:t.tokenBudget});if(this.canProjectOperation(s,r)){this.options.banner.setGoal(l);this.options.setHint(t.tokenBudget===null?"Goal budget cleared.":"Goal budget updated.");this.options.onChanged()}return"consumed"}if(t.kind==="edit"){this.options.editor.setText(`/goal ${o.objective}`);this.options.surfaceHost.setChatFocus(this.options.editor);this.options.setHint("Edit the Goal objective, then press Enter.");this.options.onChanged();return"consumed"}if(t.kind==="clear"){await this.options.runtime.clearGoal(s);if(this.canProjectOperation(s,r)){this.options.banner.setGoal(void 0);this.options.setHint(this.withLiveRunNotice("Goal cleared."));this.options.onChanged()}return"consumed"}if(t.kind==="resume"&&o.status==="budget_limited"){this.options.append("This Goal exhausted its execution budget. Clear it, then start a new Goal.","warning");return"consumed"}const a=t.kind==="pause"?"paused":"active";const u=await this.options.runtime.patchGoal(s,{status:a});if(this.canProjectOperation(s,r)){this.options.banner.setGoal(u);this.options.setHint(a==="paused"?this.withLiveRunNotice("Goal paused."):"Goal resumed.");this.options.onChanged()}return"consumed"}catch(s){this.appendFailure(s);return"retained"}}withLiveRunNotice(e){return this.options.hasLiveRun?.()?`${e} ${EW}`:e}async resumeBlocked(){const e=this.options.banner.getGoal();const t=this.options.currentSessionId();if(!e||e.status!=="blocked"||!t||e.sessionId!==t){return"not-blocked"}try{const i=await this.options.runtime.patchGoal(t,{status:"active"});if(this.options.currentSessionId()===t){this.options.banner.setGoal(i);this.options.setHint("Goal resumed.");this.options.onChanged()}return"resumed"}catch(i){this.appendFailure(i);return"failed"}}async refresh(e=this.options.currentSessionId()){const t=++this.refreshSequence;if(!e){this.options.banner.setGoal(void 0);return}try{if(!this.options.runtime.isGoalEnabled()){if(t===this.refreshSequence)this.options.banner.setGoal(void 0);return}const i=await this.options.runtime.getGoal(e);if(t===this.refreshSequence&&this.options.currentSessionId()===e){this.options.banner.setGoal(i?.status==="complete"?void 0:i);this.options.onChanged()}}catch{if(t===this.refreshSequence&&this.options.currentSessionId()===e){this.options.banner.setGoal(void 0)}}}reset(){this.refreshSequence+=1;this.options.banner.setGoal(void 0)}project(e){if(e.sessionId!==this.options.currentSessionId())return;this.refreshSequence+=1;if(e.type==="thread_goal.updated"){if(e.goal.status==="complete"){this.options.banner.setGoal(void 0);if(!this.announcedCompletedGoalIds.has(e.goal.goalId)){this.announcedCompletedGoalIds.add(e.goal.goalId);this.options.append(FE(e.goal))}}else{this.options.banner.setGoal(e.goal)}}else if(!this.options.banner.getGoal()||this.options.banner.getGoal()?.goalId===e.goalId){this.options.banner.setGoal(void 0)}this.options.onChanged()}async setObjective(e,t,i,s,r,o){if(s&&s.status!=="complete"){if(o.attachments.length>0){this.options.append("Goal kickoff attachments are immutable. Remove the attachments to edit this Goal, or clear it and start a new Goal.","warning");return"retained"}const u=await this.options.runtime.patchGoal(e,{objective:t,...i!==void 0?{tokenBudget:i}:{}});if(this.canProjectOperation(e,r)){this.options.banner.setGoal(u);this.options.setHint("Goal objective updated.");this.options.onChanged()}return"consumed"}let a;try{a=o;this.options.composerDraft.reserveSubmission(o);const u=await this.options.runtime.createGoal({sessionId:e,objective:t,...i!==void 0?{tokenBudget:i}:{},...o.attachments.length>0?{attachments:o.attachments}:{}});if(this.canProjectOperation(e,r)){this.options.banner.setGoal(u);this.options.setHint("Goal started.");this.options.onChanged()}await this.options.composerDraft.completeSubmission(a).catch(l=>{this.options.append(N(l,{summary:"Couldn't clean up the submitted Goal attachments.",nextStep:"The Goal was still created."}),"warning")});return"consumed"}catch(u){if(a)this.options.composerDraft.restoreSubmission(a);throw u}}canProjectOperation(e,t){return t===this.refreshSequence&&this.options.currentSessionId()===e}appendFailure(e){this.options.append(N(e,{summary:"Couldn't update the Goal.",nextStep:"Retry /goal after the Runtime recovers.",preservation:"Your draft is preserved."}),"error")}};import{tmpdir as AW}from"node:os";import{isAbsolute as Fk,relative as $k,resolve as zp}from"node:path";var Qp=class{constructor(e,t,i,s){this.readClipboardImage=e;this.readClipboardText=t;this.prepareQueueLease=i;this.draftRecoveryDataDir=s}readClipboardImage;readClipboardText;prepareQueueLease;draftRecoveryDataDir;pendingDisposals=new Map;queuedDisposals=new Map;activeRead;async paste(e){if(!this.readClipboardImage&&!this.readClipboardText){e.onWarning("Clipboard paste is unavailable in this host. Save media and reference it in the prompt with @.");return}if(this.activeRead)return;const t=new AbortController;this.activeRead=t;e.onHint("Reading clipboard\u2026");try{let i;if(this.readClipboardImage){try{const r=await this.readClipboardImage(t.signal);if(e.isStopped()||t.signal.aborted){await r.dispose().catch(()=>void 0);return}if(e.onPasted(r.attachment)){this.pendingDisposals.set(r.attachment.filePath,r.dispose)}else{await r.dispose().catch(()=>void 0)}return}catch(r){i=r}}const s=await this.readClipboardText?.().catch(()=>null);if(e.isStopped()||t.signal.aborted)return;if(s){e.onTextPasted(s);return}if(i&&RW(i)){e.onWarning(N(i,{summary:"Couldn't paste media from the clipboard.",nextStep:"Copy the image or video file again, or attach the saved file with @."}))}}finally{if(this.activeRead===t)this.activeRead=void 0;e.onHint(void 0);e.onRender()}}abortRead(){if(!this.activeRead)return false;this.activeRead.abort();return true}transferToQueue(e,t){const i=this.take(t);if(i.length>0)this.append(this.queuedDisposals,e,i)}async prepareAttachmentsForQueue(e){const t=this.prepareQueueLease??(this.draftRecoveryDataDir?kW(this.draftRecoveryDataDir):void 0);if(!t)return e.map(r=>({...r}));const i=[];const s=[];try{for(const r of e){if(this.pendingDisposals.has(r.filePath)){i.push({...r});continue}const o=await t(r);if(!o){i.push({...r});continue}s.push(o);this.pendingDisposals.set(o.attachment.filePath,o.dispose);i.push({...o.attachment})}return i}catch(r){for(const o of s)this.pendingDisposals.delete(o.attachment.filePath);await Zy(s.map(o=>o.dispose));throw r}}async releasePreparedQueueAttachments(e,t){const i=new Set(e.map(s=>s.filePath));await this.releaseAttachments(t.filter(s=>!i.has(s.filePath)))}async releaseAttachments(e){await Zy(this.take(e))}async releaseQueueItem(e){const t=this.queuedDisposals.get(e);if(!t)return;this.queuedDisposals.delete(e);await Zy(t)}restoreQueueItem(e,t){const i=this.queuedDisposals.get(e);if(!i)return;this.queuedDisposals.delete(e);for(const[s,r]of t.entries()){const o=i[s];if(o)this.pendingDisposals.set(r.filePath,o)}}take(e){const t=[];for(const i of e){const s=this.pendingDisposals.get(i.filePath);if(!s)continue;this.pendingDisposals.delete(i.filePath);t.push(s)}return t}append(e,t,i){e.set(t,[...e.get(t)??[],...i])}};function RW(n){return!(n instanceof Tb&&n.code==="no-image")}function kW(n){return async e=>PW(n,e.filePath)||_W(e)?bb(e):void 0}function PW(n,e){const t=zp(n,"v2","mcode","drafts");const i=$k(t,zp(e));if(!i||i.startsWith("..")||Fk(i))return false;return i.split(/[\\/]/u).some(s=>s.endsWith(".assets"))}function _W(n){const e=$k(zp(AW()),zp(n.filePath));if(!e||e.startsWith("..")||Fk(e)){return false}return e.split(/[\\/]/u)[0]?.startsWith("minimax-code-clipboard-")===true}async function Zy(n){await Promise.allSettled(n.map(e=>e()))}var Yp=class{constructor(e){this.options=e;this.clipboard=e.clipboard??new Qp(e.readClipboardImage,e.readClipboardText,e.prepareQueueAttachmentLease,e.draftRecoveryDataDir)}options;attachments=[];detachedAttachments=new Map;clearedDraft;clipboard;draftGeneration=0;snapshot(){return{attachments:[...this.attachments]}}capture(){return this.snapshot()}reserveSubmission(e=this.capture()){void this.releaseDetachedAttachments();void this.discardClearedDraft();this.removeCaptured(e);this.notifyChanged();return e}restoreSubmission(e){const t=new Set(this.attachments.map(i=>i.filePath));this.attachments=[...e.attachments.filter(i=>!t.has(i.filePath)),...this.attachments];this.notifyChanged()}hasContent(){return this.attachments.length>0}restoreAttachments(e){const t=new Set(this.attachments.map(s=>s.filePath));const i=[];for(const s of e){if(t.has(s.filePath))continue;if(!this.canAddAttachment(s,false,[...this.attachments,...i]))break;t.add(s.filePath);i.push(s)}if(i.length>0)this.attachments=[...this.attachments,...i];this.notifyChanged()}ensureAttachmentPlaceholders(){this.syncAttachmentPlaceholders()}async queueAttachment(e,t={}){if(!e.trim()){this.options.append("Cannot add an empty attachment path.","warning");return}const i=this.draftGeneration;const s=await this.options.resolveAttachment(e,{...t,workspaceDir:this.options.workspaceDir,...this.options.homeDir?{homeDir:this.options.homeDir}:{}});if(i!==this.draftGeneration||this.options.isStopped?.())return;if(this.attachments.some(r=>r.filePath===s.filePath)){this.options.append(`Already attached for the next message: ${s.fileName}`,"warning");return}if(!this.canAddAttachment(s))return;this.attachments=[...this.attachments,s];this.notifyChanged()}async pasteClipboard(){await this.clipboard.paste({isStopped:()=>this.options.isStopped?.()??false,onHint:e=>this.options.onHint?.(e),onPasted:e=>{if(!this.canAddAttachment(e))return false;this.attachments=[...this.attachments,e];this.notifyChanged();return true},onTextPasted:e=>{this.options.insertTextAtCursor?.(e);this.notifyChanged()},onWarning:e=>this.options.append(e,"warning"),onRender:()=>this.options.onRender?.()})}async removeLastAttachment(){return this.removeAttachmentAt(this.attachments.length-1)}async removeAttachmentById(e){const t=this.attachments.findIndex(s=>s.filePath===e);const i=this.attachments[t];if(!i)return false;this.detachedAttachments.set(e,{attachment:i,index:t});this.attachments=this.attachments.filter((s,r)=>r!==t);this.notifyChanged();return true}restoreAttachmentById(e){const t=this.detachedAttachments.get(e);if(!t||this.attachments.some(s=>s.filePath===e))return false;this.detachedAttachments.delete(e);const i=Math.max(0,Math.min(t.index,this.attachments.length));this.attachments=[...this.attachments.slice(0,i),t.attachment,...this.attachments.slice(i)];this.notifyChanged();return true}stashForClear(){if(this.clearedDraft||!this.hasContent())return false;void this.releaseDetachedAttachments();this.clearedDraft=this.capture();this.attachments=[];this.notifyChanged();return true}restoreClearedDraft(){const e=this.clearedDraft;if(!e)return false;this.clearedDraft=void 0;this.restoreSubmission(e);return true}async discardClearedDraft(){const e=this.clearedDraft;if(!e)return;this.clearedDraft=void 0;await this.clipboard.releaseAttachments(e.attachments)}async completeSubmission(e){this.removeCaptured(e);this.notifyChanged();await Promise.all([this.clipboard.releaseAttachments(e.attachments),this.releaseDetachedAttachments(),this.discardClearedDraft()])}async prepareQueueSubmission(e){return{attachments:this.clipboard.prepareAttachmentsForQueue?await this.clipboard.prepareAttachmentsForQueue(e.attachments):e.attachments.map(t=>({...t}))}}releasePreparedQueueSubmission(e,t){return this.clipboard.releasePreparedQueueAttachments?.(e.attachments,t.attachments)??Promise.resolve()}completeQueuedSubmission(e,t,i=e){this.removeCaptured(e);this.clipboard.transferToQueue(t,i.attachments);void this.releaseDetachedAttachments();void this.discardClearedDraft();this.notifyChanged()}restoreQueuedSubmission(e,t){this.clipboard.restoreQueueItem?.(e,t.attachments);this.restoreSubmission(t)}releaseQueueItem(e){return this.clipboard.releaseQueueItem(e)}abortClipboardRead(){return this.clipboard.abortRead()}async discard(){this.draftGeneration+=1;const e=[...this.attachments,...[...this.detachedAttachments.values()].map(({attachment:t})=>t),...this.clearedDraft?.attachments??[]];this.attachments=[];this.detachedAttachments.clear();this.clearedDraft=void 0;this.notifyChanged();await this.clipboard.releaseAttachments(e)}removeCaptured(e){const t=new Set(e.attachments.map(i=>i.filePath));this.attachments=this.attachments.filter(i=>!t.has(i.filePath))}async removeAttachmentAt(e){const t=this.attachments[e];if(!t)return false;this.attachments=this.attachments.filter((i,s)=>s!==e);this.notifyChanged();await this.clipboard.releaseAttachments([t]);return true}async releaseDetachedAttachments(){const e=[...this.detachedAttachments.values()].map(({attachment:t})=>t);if(e.length===0)return;this.detachedAttachments.clear();await this.clipboard.releaseAttachments(e)}notifyChanged(){this.syncAttachmentPlaceholders();this.options.onChanged()}canAddAttachment(e,t=true,i=this.attachments){if(i.length>=gb){if(t){this.options.append("You can attach up to 10 files. Remove one before adding another.","warning")}return false}const s=i.reduce((r,o)=>r+o.sizeBytes,0);if(s+e.sizeBytes>yb){if(t){this.options.append("Attachments can total up to 100 MB. Remove an attachment or choose a smaller file.","warning")}return false}return true}syncAttachmentPlaceholders(){this.options.onAttachmentPlaceholdersChanged?.(this.attachments.map((e,t)=>({id:e.filePath,label:$a(e,t+(this.options.attachmentPlaceholderOffset?.()??0))})))}};function Bk(n){const e=n.app.resolveAttachment??Cw;const t=new Yp({workspaceDir:n.app.workspaceDir,...n.app.homeDir?{homeDir:n.app.homeDir}:{},resolveAttachment:e,...n.app.readClipboardImage?{readClipboardImage:n.app.readClipboardImage}:{},readClipboardText:n.app.readClipboardText??Nd,insertTextAtCursor:s=>n.editor.insertTextAtCursor(s),...n.app.dataDir?{draftRecoveryDataDir:n.app.dataDir}:{},append:n.append,onAttachmentPlaceholdersChanged:s=>n.editor.syncAttachmentPlaceholders([...n.editAttachmentPlaceholders?.()??[],...s]),attachmentPlaceholderOffset:n.editAttachmentCount,onChanged:()=>{n.scheduleDraft();n.updateChrome()},isStopped:n.isStopped,onHint:s=>{n.chrome()?.setHint(s);n.updateChrome()},onRender:()=>{if(!n.isStopped())n.requestRender()}});n.editor.onChange=()=>{n.onEditorChanged?.();n.scheduleDraft();n.updateChrome()};const i=new Gp({runtime:n.app.runtime,currentSessionId:()=>n.controller.snapshot().session?.sessionId,ensureSessionId:async()=>(await n.controller.ensureSession()).sessionId,banner:n.banner,composerDraft:t,editor:n.editor,surfaceHost:n.surfaceHost,append:n.append,setHint:s=>n.chrome()?.setHint(s),...n.hasLiveRun?{hasLiveRun:n.hasLiveRun}:{},onChanged:()=>{n.updateChrome();n.requestRender()}});return{composerDraft:t,goalFlow:i}}function qk(n){let e=false;return{onSessionLifecycle(t){if(!t){e=true;return}if(!e)return;e=false;PT(t,"clear")},async preparePluginHookSessionSwitch(t,i){await LT(t,async s=>{await n.abortSession({id:s,reason:"session_leave"})});await _T(t,i)},adoptForegroundRun(t,i,s){if(t&&i?.sessionId===t&&(i.state==="running"||i.state==="decision-blocked")&&i.turnId){s.adoptRuntimeTurn(t,i.turnId,Date.now())}}}}var LW={title:"Status Line",search:"Search",preview:"Preview",defaults:"Defaults",unavailable:"No current data; hidden until available.",empty:"Status line hidden",noMatches:"No matching items",saving:"Saving\u2026",failed:"Could not save. Check config.yaml syntax and permissions; previous settings kept.",locked:"build-mode is startup-only. Edit config.yaml and restart to change it.",help:"Space toggle \xB7 \u2190/\u2192 reorder \xB7 Enter save \xB7 Esc cancel",compactHelp:"Space \xB7 \u2190\u2192 \xB7 Enter \xB7 Esc",reset:"Ctrl+R restores defaults; type to search",filtered:"Clear search before reordering",custom:"Uses the saved command. Starts only after saving; preview never runs it.",close:"Enter / Esc close"};var OW={title:"\u72B6\u6001\u680F",search:"\u641C\u7D22",preview:"\u9884\u89C8",defaults:"\u9ED8\u8BA4\u914D\u7F6E",unavailable:"\u5F53\u524D\u65E0\u6570\u636E\uFF0C\u6709\u6570\u636E\u65F6\u624D\u663E\u793A\u3002",empty:"\u72B6\u6001\u680F\u5DF2\u9690\u85CF",noMatches:"\u6CA1\u6709\u5339\u914D\u9879",saving:"\u6B63\u5728\u4FDD\u5B58\u2026",failed:"\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 config.yaml \u8BED\u6CD5\u548C\u6743\u9650\uFF1B\u539F\u8BBE\u7F6E\u5DF2\u4FDD\u7559\u3002",locked:"build-mode \u4EC5\u5728\u542F\u52A8\u65F6\u751F\u6548\uFF0C\u8BF7\u4FEE\u6539 config.yaml \u540E\u91CD\u542F\u3002",help:"Space \u52FE\u9009 \xB7 \u2190/\u2192 \u6392\u5E8F \xB7 Enter \u4FDD\u5B58 \xB7 Esc \u53D6\u6D88",compactHelp:"Space \xB7 \u2190\u2192 \xB7 Enter \xB7 Esc",reset:"Ctrl+R \u6062\u590D\u9ED8\u8BA4\uFF1B\u8F93\u5165\u6587\u5B57\u641C\u7D22",filtered:"\u6E05\u7A7A\u641C\u7D22\u540E\u624D\u80FD\u6392\u5E8F",custom:"\u4F7F\u7528\u5DF2\u914D\u7F6E\u7684\u547D\u4EE4\uFF0C\u4FDD\u5B58\u540E\u624D\u542F\u52A8\uFF1B\u9884\u89C8\u4E0D\u4F1A\u6267\u884C\u547D\u4EE4\u3002",close:"Enter / Esc \u5173\u95ED"};var DW={"current-dir":["Current working directory","\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55"],"session-title":["Current session title","\u5F53\u524D\u4F1A\u8BDD\u6807\u9898"],"git-branch":["Current Git branch","\u5F53\u524D Git \u5206\u652F"],"review-link":["Current branch PR / MR link","\u5F53\u524D\u5206\u652F\u7684 PR / MR \u94FE\u63A5"],"plan-mode":["Plan mode","\u8BA1\u5212\u6A21\u5F0F"],"approval-mode":["Current permission mode","\u5F53\u524D\u6743\u9650\u6A21\u5F0F"],"model-with-reasoning":["Model and reasoning","\u6A21\u578B\u548C\u63A8\u7406\u914D\u7F6E"],model:["Model name","\u6A21\u578B\u540D\u79F0"],"context-window":["Context window capacity","\u4E0A\u4E0B\u6587\u603B\u5BB9\u91CF"],subagent:["Subagent identity","\u5B50 Agent \u8EAB\u4EFD"],"token-quota":["Account token quota","\u8D26\u6237\u989D\u5EA6"],"cache-read-ratio":["Session cache read ratio","\u4F1A\u8BDD\u7F13\u5B58\u8BFB\u53D6\u6BD4\u4F8B"],"context-remaining":["Remaining context window","\u5269\u4F59\u4E0A\u4E0B\u6587\u7A97\u53E3"],"context-meter":["Remaining context gauge","\u5269\u4F59\u4E0A\u4E0B\u6587\u523B\u5EA6\u6761"],"custom-command":["Configured custom command output","\u5DF2\u914D\u7F6E\u7684\u81EA\u5B9A\u4E49\u547D\u4EE4\u8F93\u51FA"]};function Hk(n){return Fn(n??Intl.DateTimeFormat().resolvedOptions().locale)==="zh"}function Uk(n,e){return Hk(e)?OW[n]:LW[n]}function eT(n,e){return DW[n][Hk(e)?1:0]}var Xp=class{constructor(e){this.options=e;this.locked=e.items?.includes("build-mode")??false;this.useDefaults=e.items===void 0;this.resetItems(e.items??os)}options;fullscreenViewport=true;handlesViewportKeys=true;items=[];enabled=new Set;useDefaults;selected=0;searchInput=new et;busy=false;error=false;disposed=false;locked;get focused(){return this.searchInput.focused}set focused(e){this.searchInput.focused=e&&!this.locked}get query(){return this.searchInput.getValue()}handleInput(e){if(this.busy||this.disposed)return;const t=te();if(t.matches(e,"tui.select.cancel")||S(e,"ctrl+c")){this.options.onClose();return}if(t.matches(e,"tui.select.confirm")){if(this.locked)this.options.onClose();else void this.save();return}if(this.locked)return;const i=this.visibleItems();if(t.matches(e,"tui.select.up")){this.selected=(this.selected-1+i.length)%Math.max(1,i.length)}else if(t.matches(e,"tui.select.down")){this.selected=(this.selected+1)%Math.max(1,i.length)}else if(S(e,"space")){const s=i[this.selected];if(s){if(this.enabled.has(s))this.enabled.delete(s);else this.enabled.add(s);this.useDefaults=false}}else if(S(e,"left")||S(e,"right")){if(!this.query)this.moveItem(S(e,"left")?-1:1);else this.searchInput.handleInput(e)}else if(S(e,"ctrl+r")){this.resetItems(os);this.useDefaults=true;this.searchInput.setValue("")}else{const s=this.query;this.searchInput.handleInput(e);if(this.query.length>100)this.searchInput.setValue(this.query.slice(0,100));if(this.query!==s)this.selected=0}this.options.requestRender()}dispose(){this.disposed=true}invalidate(){this.searchInput.invalidate()}render(e){return this.renderViewport(e,20)}renderViewport(e,t){const i=Math.max(0,Math.floor(t));if(e<=0||i===0)return[];const s=R=>Uk(R,this.options.locale);if(this.locked){return zn({title:s("title"),body:J(s("locked"),Math.max(1,Qe(e))),footer:s("close")},e,i)}const r=this.busy?s("saving"):s(e>=64?"help":"compactHelp");const o=ae(e,i,r);const a=o.contentWidth;const u=`${s("search")}: `;const l=u+(this.searchInput.render(Math.max(1,a-w(u)))[0]??"");const d=this.visibleItems();const h=d[this.selected];const m=this.options.preview(this.selection(),a,3);const f=m.lines.filter(R=>R.length>0).slice(0,i>=15?3:1);if(f.length===0)f.push(s("empty"));const y=R=>(R===h?p.bold.hex(c.signal):p.hex(c.text))(`${R===h?"\u203A":" "} [${this.enabled.has(R)?"x":" "}] ${R}`);if(i<9){return o.render({title:s("title"),body:[...o.bodyHeight>=2?[l]:[],h?y(h):s("noMatches"),...this.error?[s("failed")]:f]})}const T=h?`${eT(h,this.options.locale)}${m.unavailable.includes(h)?` \xB7 ${s("unavailable")}`:""}`:s("noMatches");const b=i>=15?[h==="custom-command"?s("custom"):s(this.query?"filtered":"reset")]:[];const v=this.error?[p.hex(c.warning)(s("failed"))]:[];const C=Math.max(1,Math.min(8,o.bodyHeight-3-f.length-b.length-v.length));const I=Math.max(0,Math.min(this.selected-C+1,d.length-C));return o.render({title:s("title"),meta:this.useDefaults?s("defaults"):`${this.enabled.size} / ${this.items.length}`,body:[l,...d.length?d.slice(I,I+C).map(y):[s("noMatches")],p.hex(c.muted)(T),...b.map(R=>p.hex(c.muted)(R)),p.bold.hex(c.text)(s("preview")),...f,...v]})}selection(){return this.useDefaults?void 0:this.items.filter(e=>this.enabled.has(e))}resetItems(e){this.items=[...new Set([...e,...Lg])].filter(t=>t!=="build-mode");this.enabled=new Set(e.filter(t=>t!=="build-mode"));this.selected=0}visibleItems(){const e=this.query.toLocaleLowerCase();return this.items.filter(t=>`${t} ${eT(t,this.options.locale)}`.toLocaleLowerCase().includes(e))}moveItem(e){const t=this.selected+e;const i=this.items[this.selected];if(!i||t<0||t>=this.items.length)return;this.items.splice(this.selected,1);this.items.splice(t,0,i);this.selected=t;this.useDefaults=false}async save(){const e=this.selection();if(JSON.stringify(e)===JSON.stringify(this.options.items)){this.options.onClose();return}this.busy=true;this.error=false;this.options.requestRender();try{await this.options.save(e);if(!this.disposed)this.options.onClose()}catch{this.error=true}finally{this.busy=false;if(!this.disposed)this.options.requestRender()}}};function Kk(n){const e=new Xp({items:n.statusLine.getConfiguredItems(),preview:(t,i,s)=>n.statusLine.preview(t,i,s),save:async t=>{if(!n.persist)throw new Error("Status line persistence is unavailable");await n.persist(t);n.statusLine.setConfiguredItems(t)},onClose:()=>{n.surface.close(e)},requestRender:()=>n.surface.request()});n.surface.show(e)}var tT=["light","auto","dark"];var Jp=class{constructor(e){this.options=e;this.originalThemeId=e.currentThemeId;this.originalAppearance=e.appearanceOverride??"auto";this.appearance=this.originalAppearance;const t=e.themes.findIndex(i=>i.id===e.currentThemeId);this.selectedIndex=t>=0?t:0}options;selectedIndex;originalThemeId;originalAppearance;appearance;busy=false;error=false;disposed=false;handleInput(e){if(this.busy||this.disposed)return;const t=te();if(t.matches(e,"tui.select.cancel")||S(e,"ctrl+c")){this.restore();this.options.onClose();return}if(t.matches(e,"tui.select.confirm")){this.commit();return}const i=this.options.themes;if(i.length===0)return;if(t.matches(e,"tui.select.up")){this.selectedIndex=(this.selectedIndex-1+i.length)%i.length}else if(t.matches(e,"tui.select.down")){this.selectedIndex=(this.selectedIndex+1)%i.length}else if(S(e,"left")){this.shiftAppearance(-1)}else if(S(e,"right")){this.shiftAppearance(1)}else{return}const s=i[this.selectedIndex];if(s)this.options.preview(s.id);this.options.requestRender()}dispose(){this.disposed=true}invalidate(){}render(e){return this.renderViewport(e,20)}renderViewport(e,t){const i=Math.max(0,Math.floor(t));if(e<=0||i===0)return[];const s=this.options.themes;const r=ae(e,i,Vk(e,this.busy));if(s.length===0){return zn({title:"Theme",body:["No themes available."],footer:Vk(e,false)},e,i)}const o=s[Math.min(this.selectedIndex,s.length-1)];if(!o)return[];const a=o.id===this.originalThemeId;const u=Math.max(...s.map(f=>w(f.label)),w("Appearance"));const l=Gk(o,this.resolvedAppearance());const d=[`${p.hex(c.muted)("Appearance")} ${NW(this.appearance,this.options.currentAppearance)}`,`${p.hex(c.muted)("Source")} ${o.source==="custom"?"custom file":"built-in"}`,...o.description?[`${p.hex(c.muted)("About")} ${o.description}`]:[],`${p.hex(c.muted)("Palette")} ${l}`];if(this.error)d.push(p.hex(c.error)("Could not save the theme selection."));if(i<10){return r.render({title:"Theme",body:[Wk(o.label,a,this.options.currentThemeId===o.id,u,this.resolvedAppearance(),o),...r.bodyHeight>=4?d.slice(0,2):[]]})}const h=Math.max(1,Math.min(s.length,r.bodyHeight-d.length-1));const m=Math.max(0,Math.min(this.selectedIndex-h+1,s.length-h));return r.render({title:"Theme",meta:`${s.length} available`,body:[...s.slice(m,m+h).map(f=>Wk(f.label,f.id===this.originalThemeId,f.id===o.id,u,this.resolvedAppearance(),f)),...d]})}resolvedAppearance(){return this.appearance==="auto"?this.options.currentAppearance:this.appearance}shiftAppearance(e){const t=tT.indexOf(this.appearance);const i=tT[Math.max(0,Math.min(t+e,tT.length-1))];if(i===this.appearance)return;this.appearance=i;this.options.setAppearance(i)}restore(){const e=this.options.themes.find(t=>t.id===this.originalThemeId);if(e)this.options.preview(this.originalThemeId);this.appearance=this.originalAppearance;this.options.setAppearance(this.originalAppearance)}async commit(){const e=this.options.themes[this.selectedIndex];if(!e)return;if(e.id===this.originalThemeId&&this.appearance===this.originalAppearance){this.options.onClose();return}this.busy=true;this.error=false;this.options.requestRender();try{await this.options.save(e.id,this.appearance);this.originalThemeId=e.id;this.originalAppearance=this.appearance;if(!this.disposed)this.options.onClose()}catch{this.error=true}finally{this.busy=false;if(!this.disposed)this.options.requestRender()}}};function NW(n,e){if(n==="auto")return`auto (${e})`;return n==="light"?"light (pinned)":"dark (pinned)"}function Gk(n,e){const t=e==="light"?n.light:n.dark;const i=["brand","accent","markdownHeading","markdownCode","success","warning","error"];return i.map(s=>p.bgHex(t.colors[s])(" ")).join("")}function Wk(n,e,t,i,s,r){const o=t?"\u203A":" ";const a=t?p.bold.hex(c.signal)(n):p.hex(c.text)(n);const u=" ".repeat(Math.max(0,i-w(n)));const l=e?p.hex(c.success)(jk.trim()):"";const d=" ".repeat(Math.max(0,w(jk)-w(l)));return`${o} ${a}${u} ${l}${d} ${Gk(r,s)}`}var jk=" current ";function Vk(n,e){if(e)return"Saving\u2026";return n>=64?"\u2191\u2193 theme \xB7 \u2190\u2192 appearance \xB7 Enter save \xB7 Esc cancel":"\u2191\u2193 \u2190\u2192 \xB7 Enter \xB7 Esc"}function FW(n,e){return e==="auto"?n:`${n}/${e}`}function zk(n){const{controller:e,surface:t}=n;const i=new Jp({themes:e.listThemes(),currentThemeId:e.selectedThemeId(),currentAppearance:e.snapshot().appearance,appearanceOverride:e.appearanceOverrideValue(),preview:s=>{e.previewTheme(s)},setAppearance:s=>{e.setAppearanceOverride(s==="auto"?void 0:s)},save:(s,r)=>{if(!e.setTheme(s)){throw new Error(`Theme "${s}" is no longer available`)}n.persist?.(FW(s,r))},onClose:()=>{t.close(i)},requestRender:()=>t.request()});t.show(i)}import{lstat as $W,open as BW,readdir as qW,realpath as Zp}from"node:fs/promises";import{createRequire as HW}from"node:module";import{homedir as UW}from"node:os";import ls from"node:path";var KW=10*60*1e3;var WW=256;var Qk=64*1024;var jW=256*1024;var VW=5*60*1e3;var Jk=async n=>{const e=n.nowMs??Date.now();const t=n.recentWindowMs??KW;const i=e-t;const s=ls.resolve(n.codexHome??process.env.CODEX_HOME??ls.join(n.homeDir??UW(),".codex"));const r=ls.join(s,"sessions");let o;let a;try{[o,a]=await Promise.all([Zp(n.workspaceDir),Zp(r)])}catch{return void 0}const u=await GW(a,i,e);if(!u)return void 0;for(const l of u){const d=await QW(l.filePath);if(!d||d.source!=="cli"&&d.source!=="vscode")continue;const h=await XW(d.cwd);if(h!==o)continue;return{sessionId:d.sessionId,updatedAtMs:l.updatedAtMs,source:d.source}}return void 0};async function GW(n,e,t){const i=zW(e,t);const s=[];for(const r of i){const o=ls.join(n,...r);let a;try{a=await qW(o,{withFileTypes:true})}catch{continue}for(const u of a){if(!u.isFile()||!/^rollout-.+\.jsonl(?:\.zst)?$/u.test(u.name))continue;const l=ls.join(o,u.name);try{const d=await $W(l);if(!d.isFile()||d.isSymbolicLink())continue;if(d.mtimeMs<e||d.mtimeMs>t+VW){continue}const h=await Zp(l);if(!JW(n,h))continue;s.push({filePath:h,updatedAtMs:Math.min(d.mtimeMs,t)});if(s.length>WW)return void 0}catch{continue}}}return s.sort((r,o)=>o.updatedAtMs-r.updatedAtMs||r.filePath.localeCompare(o.filePath))}function zW(n,e){const t=new Map;for(const i of[n,e]){const s=new Date(i);const r=[[s.getFullYear(),s.getMonth()+1,s.getDate()],[s.getUTCFullYear(),s.getUTCMonth()+1,s.getUTCDate()]];for(const[o,a,u]of r){const l=[String(o),Xk(a),Xk(u)];t.set(l.join("/"),l)}}return[...t.values()]}async function QW(n){let e;try{e=await YW(n)}catch{return void 0}for(const t of e.split("\n").slice(0,20)){if(!t.trim())continue;let i;try{i=JSON.parse(t)}catch{continue}if(!Yk(i)||i.type!=="session_meta"||!Yk(i.payload))continue;const{id:s,cwd:r,source:o}=i.payload;if(typeof s!=="string"||!s.trim()||typeof r!=="string")return void 0;if(typeof o!=="string")return void 0;if(!ls.basename(n).includes(s))return void 0;return{sessionId:s,cwd:r,source:o}}return void 0}async function YW(n){const e=n.endsWith(".zst");const t=e?jW:Qk;const i=await BW(n,"r");try{const s=Buffer.alloc(t);const{bytesRead:r}=await i.read(s,0,s.length,0);const o=s.subarray(0,r);if(!e)return o.toString("utf8");const a=HW(__mavis_tuiPackageEntryUrl);const u=a("node:zlib");if(!u.zstdDecompressSync)throw new Error("Zstandard is unavailable.");return u.zstdDecompressSync(o,{maxOutputLength:Qk}).toString("utf8")}finally{await i.close()}}async function XW(n){try{return await Zp(n)}catch{return void 0}}function Yk(n){return typeof n==="object"&&n!==null&&!Array.isArray(n)}function JW(n,e){const t=ls.relative(n,e);return t!==""&&!t.startsWith("..")&&!ls.isAbsolute(t)}function Xk(n){return String(n).padStart(2,"0")}var em=class{constructor(e){this.options=e}options;pristine=true;recentSession;take(){if(!this.isEligible())return void 0;const e=this.recentSession;if(!e)return void 0;this.recentSession=void 0;this.pristine=false;this.options.chrome()?.setWelcomeTip(void 0);return e}restore(e){if(!this.isEligible(true))return;this.recentSession=e;this.pristine=true;this.showTip()}dismiss(){if(!this.pristine&&!this.recentSession)return;this.pristine=false;this.recentSession=void 0;this.options.chrome()?.setWelcomeTip(void 0)}async detect(){await this.options.skills.refreshSkillCommands();if(!this.options.skills.skillCommands().some(t=>t.name==="resume-codex")){return}const e=await(this.options.app.findRecentCodexSession??Jk)({workspaceDir:this.options.app.workspaceDir,...this.options.app.homeDir?{homeDir:this.options.app.homeDir}:{}});if(!e||!this.isEligible())return;this.recentSession=e;this.showTip()}isEligible(e=false){return(e||this.pristine)&&!this.options.isStopped()&&!this.options.controller.snapshot().session&&!this.options.liveRunId()&&this.options.transcript.snapshot().length===0&&this.options.editor.getExpandedText().length===0&&!this.options.composerDraft.hasContent()}showTip(){const e=Te("welcome.resume-codex",this.options.app.keybindings);this.options.chrome()?.setWelcomeTip({id:"codex-handoff",command:"resume-codex",text:`Tip: ${e} resumes your recent Codex session`,shortText:`Tip: ${e} resumes Codex`});this.options.onChanged()}};function t9(n){const e=qk(n.runtime);const t=go(n.statusLineItems??[]).includes("build-mode");const{terminal:i,renderer:s,tui:r,terminalNotifications:o,terminalTitle:a,terminalProgramStatus:u,themeController:l,openExternalTarget:d,writeClipboardText:h}=lA(n);const m=new Uh(rR());const f=Pk(n.productFeatures);const y=n.exportTranscript??(n.dataDir?_k(n.dataDir):void 0);const{defaultAgentName:T,workspaceRoots:b,...v}=uA(n);const C=new Jr;const I=new Vh(C);const R=new Eh(I,{displayModes:new Io,workspaceDir:n.workspaceDir,appendOnly:()=>s.mode==="regular"});s.setTranscriptPerformanceProvider(()=>R.getPerformanceSnapshot());const L=dA(r,b,n.runtime);let _;let D;let k;const K=P=>k?.update(P);let j;let B;let V;let ve;let Me;let nt;let Tt=()=>void 0;let Ne=false;let $=false;let Q=false;const re=pA({app:n,tui:r,terminal:i,editor:L,requestRender:()=>Ne&&!$?r.requestRender():void 0});const{welcome:ee,updateNotice:de,status:Ae,activity:it,composer:nn,interaction:It,followUp:Ri,goal:ki,tasks:ds}=re;const Ye=hR({transcript:C,isStopped:()=>$,onChanged:()=>r.requestRender()});const Pi=new Gh({transcript:C,onChanged:()=>{Tt();if(!$){K(q.snapshot());r.requestRender()}}});const q=new Fh({runtime:n.runtime,transcript:C,workspaceDir:n.workspaceDir,version:n.version,defaultAgentName:T,...v,onAutomationResultPublished:P=>Jn.handleAutomationResultPublished(P),onTodoChange:P=>ds.setItems(P),onUserSubmissionProjected:()=>{ve?.dismiss();if(Ne&&!$)r.renderNow()},onSessionLifecycle:P=>{if(!P)Pi.clearUnboundContext();e.onSessionLifecycle(P)},onChange:P=>{if($)return;const ie=P.session?.sessionId;if(ie)_?.adoptCreatedSession(ie);if(m.snapshot().activeSessionId!==ie){m.dispatch({type:"session/activate",sessionId:ie});Li?.reconcileSession();void nt?.refresh(ie)}K(P);j?.schedule(P);if(Ne)r.requestRender()}});const qe=()=>{K(q.snapshot());if(Ne&&!$)r.requestRender()};const $e=new qh;const{latestRuntimeTurnId:Lo,liveRunId:_t}=yA(q,$e);const _i=()=>Boolean(_t()||q.hasInProcessRun());const tm=()=>Ne&&!$&&!Q;let cs=()=>false;const{layout:at,surfaceHost:bt,fullscreenLayout:hs,themeRendering:pe,interactionSurface:ge}=fA({terminal:i,tui:r,editor:L,controller:q,transcript:C,transcriptView:R,widgets:re,themeController:l,liveRunId:_t,shouldResumeDraftAfterLogin:()=>cs(),isActive:tm,requestInteractionRender:Lu,mode:()=>s.mode,switchMode:P=>s.switchMode(P),chatMode:n.tuiMode??"regular"});Tt=()=>at.followBottom();s.setFullscreenLayoutRoot(hs);let Oo;const Do=new Promise(P=>{Oo=P});let ut;const{sessionMutationFlow:Li,delegationFlow:Jn}=TA({app:n,controller:q,transcript:C,surfaceHost:bt,editor:L,sessionFlow:()=>ut,setHint:P=>k?.setHint(P),append:Ye,setEditTranscriptBoundary:I.hideFromSourceMessage,onAgentTeamChanged:P=>ds.setAgentTeam(P),onBackgroundTasksChanged:P=>ds.setBackgroundTasks(P),onChanged:qe,hasLiveRun:_i});const iT=Bk({editAttachmentPlaceholders:()=>Li.retainedEditAttachments(),editAttachmentCount:()=>Li.editAttachmentCount(),app:n,controller:q,banner:ki,editor:L,surfaceHost:bt,append:Ye,scheduleDraft:()=>_?.schedule(),chrome:()=>k,isStopped:()=>$,hasLiveRun:_i,updateChrome:()=>K(q.snapshot()),onEditorChanged:()=>j?.onEditorChanged(),requestRender:()=>Ne&&!$?r.requestRender():void 0});const Dn=iT.composerDraft;re.imagePreview.setAttachmentSource(()=>[...Li.retainedEditAttachments(),...Dn.snapshot().attachments]);cs=()=>n.resumeDraftAfterLogin===true&&(L.getExpandedText().length>0||Dn.snapshot().attachments.length>0);nt=iT.goalFlow;const sT=new zh({runtime:n.runtime,stateStore:m,defaultAgentName:T,resolveSessionAgentName:P=>{const ie=q.snapshot();if(ie.session?.sessionId===P)return ie.session.agentName;return ie.sessions.find(dt=>dt.sessionId===P)?.agentName},permissionSessionScope:P=>Jn.permissionSessionScope(P),queueEnabled:f.queue});const f9=new Kh(P=>sT.reconcile(P),P=>m.dispatch(P));const Oi=new np({runtime:n.runtime,controller:q,stateStore:m,transcript:C,surface:ge,defaultAgentName:T,append:Ye,deliverPermissionFeedback:async P=>{const ie=await V.submit(P);if(ie==="retained")throw new Error("MCode kept the guidance in the composer instead of sending it.")},onChanged:()=>{K(q.snapshot());if(Ne&&!$)r.requestImmediateRender()},isStopped:()=>$,notify:(P,ie)=>{o.notifyOnce(P,ie,Sh({...q.snapshot().session,workspace:n.workspaceDir}))},...Jn.permissionResolvers(_t),stopTurn:()=>{void Me()}});const lt=new vp({dataDir:n.dataDir,runtime:n.runtime,version:n.version,planMode:()=>Di.snapshot(),controller:q,surface:ge,surfaceHost:bt,editor:L,transcript:C,transcriptView:R,writeClipboardText:h,openExternalTarget:d,exportTranscript:y,workspaceDir:n.workspaceDir,defaultAgentName:T,terminalRows:()=>i.rows,append:Ye,setCompacting:P=>{k?.setCompacting(P);K(q.snapshot());if(Ne&&!$)r.requestRender()},setHint:P=>{k?.setHint(P)},onChanged:qe,onNewSession:()=>ut.startNew(),onOpenSession:P=>ut.activateSessionById(P),onArchivedCurrentSession:P=>ut.archiveCurrentProjection(P),refreshAutocomplete:()=>j?.refreshAutocomplete(),onStartMiniMaxLogin:()=>V.startMiniMaxLogin(),isStopped:()=>$,hasLiveRun:_i});const No=gA({telemetry:n.businessTelemetry,workspaceDir:n.workspaceDir,controller:q,featureFlow:lt,stateStore:m,transcript:C});const Fo=new Ep;let _u;L.onAutocompleteView=P=>No?.trackAutocompleteView(P);L.onAutocompleteSelect=(P,ie)=>No?.trackAutocompleteSelection(P,ie);const rT=new jh(n.runtime,q,Ye,P=>ge.show(P),P=>ge.close(P),Lu,()=>my(i.rows));const g9=kk({runtime:n.runtime,snapshot:()=>q.snapshot(),defaultAgentName:T,queueEnabled:f.queue});const oT=Rk(n,Ye,ge,Lu,()=>my(i.rows),async()=>{n.requestRestart?.();await Ou()},g9);j=new qc({runtime:n.runtime,controller:q,editor:L,terminal:i,workspaceDir:n.workspaceDir,workspaceRoots:()=>b.list(),liveRunId:_t,skillCommands:()=>[...lt.skillCommands()],requireSession:()=>lt.requireActiveSession(),append:Ye,stage:P=>lt.stageCommand(P),showInteraction:P=>ge.show(P),closeInteraction:P=>ge.close(P),onChanged:qe,adoptRuntimeTurn:(P,ie,dt)=>B.adoptRuntimeTurn(P,ie,dt),drainQueueBeforeSteer:()=>Tn.drainIntoActiveTurn(),queueEnabled:f.queue,keybindings:n.keybindings,isStopped:()=>$});const nm=new Set;Me=Ek({controller:q,runProjection:$e,stopDelegation:P=>n.runtime.stopDelegation(P),abortSession:P=>n.runtime.abortSession(P),getActiveRun:P=>n.runtime.getActiveRun(P),latestRuntimeTurnId:Lo,setTransientHint:P=>k?.setHint(P),updateChrome:()=>K(q.snapshot()),requestRender:()=>{if(!$)r.requestRender()},append:Ye,onLiveTurnAborted:({turnId:P})=>{if(ut.isSideModeActive())return;const ie=C.snapshot().filter(Ie=>Ie.turnId===P);const dt=C.get(`user:${P}`);if(!dt)return;if(nm.has(P))return;const bn=ie.some(Ie=>{if(Ie.id===`user:${P}`)return false;if(Ie.kind==="thinking"||Ie.kind==="turn-duration")return false;if((Ie.kind==="assistant"||Ie.kind==="assistant-preamble")&&!Ie.content){return false}return true});if(bn)return;const Du=V.getRetainedSubmission(P);const rm=Du?ej(Du):void 0;if(Du&&rm){V.restoreSubmission(rm);V.markAbortSubmissionRestored(Du.submissionId);V.dropRetainedSubmission(P);nm.add(P);e9(C,P);_?.recordRestoredSubmission(rm);k?.setHint("Stopped \xB7 message restored to the Composer.");K(q.snapshot());r.requestRender();return}const Nu=dt.content;const lT=(dt.attachments??[]).flatMap(Ie=>Ie.filePath&&typeof Ie.sizeBytes==="number"?[{type:Ie.type,fileName:Ie.fileName,mimeType:Ie.mimeType,sizeBytes:Ie.sizeBytes,filePath:Ie.filePath}]:[]);const om=(dt.attachments??[]).flatMap(Ie=>Ie.assetId?[{type:Ie.type,fileName:Ie.fileName,mimeType:Ie.mimeType,...Ie.filePath?{filePath:Ie.filePath}:{},assetId:Ie.assetId}]:Ie.filePath&&typeof Ie.sizeBytes==="number"?[{type:Ie.type,fileName:Ie.fileName,mimeType:Ie.mimeType,filePath:Ie.filePath}]:[]);if(!Nu.trim()&&lT.length===0&&om.length===0){return}const dT={submissionId:`abort-restore:${P}`,sessionId:q.snapshot().session?.sessionId,content:Nu,attachments:lT,...om.length>0?{transportAttachments:om}:{},createdAtMs:Date.now(),editor:{schemaVersion:1,text:Nu,cursor:Nu.length,pastes:[],pasteCounter:0}};V.restoreSubmission(dT);nm.add(P);e9(C,P);_?.recordRestoredSubmission(dT);k?.setHint("Stopped \xB7 message restored to the Composer.");K(q.snapshot());r.requestRender()}});const Di=new jp({currentSession:()=>q.snapshot().session,loadEntryEnabled:async()=>(await n.runtime.getPlanModeCapabilities()).entryEnabled,append:Ye,setHint:P=>k?.setHint(P),onChanged:qe,isStopped:()=>$});const Tn=new Ip({runtime:n.runtime,controller:q,composerDraft:Dn,runProjection:$e,transcript:C,followUp:Ri,surface:ge,enabled:f.queue,setHint:P=>k?.setHint(P),onChanged:()=>K(q.snapshot()),requestRender:()=>r.requestRender(),selectedModel:()=>{const P=lt.selectedModel();if(!P)return void 0;const ie=Nn(P,lt.selectedEffort())?.trim();return{providerId:P.providerId,modelId:P.modelId,...P.contextLimit!==void 0?{contextLimit:P.contextLimit}:{},...P.variant!==void 0?{variant:P.variant}:{},...ie?{thinking:{effort:ie}}:{}}},adoptRuntimeTurn:(P,ie,dt)=>B.adoptRuntimeTurn(P,ie,dt),isStopped:()=>$,onSubmissionQueued:(P,ie,dt,bn)=>Di.acceptQueued(dt,ie,P,bn),onSubmissionRestored:(P,ie)=>Di.restoreQueued(ie,P),restoreSubmission:P=>V.restoreSubmission(P)});_=cA({app:n,editor:L,composerDraft:Dn,setHint:P=>k?.setHint(P),updateChrome:()=>K(q.snapshot()),append:Ye,onRetryRestored:P=>V?.restoreRecoverableSubmission(P)});ut=new Ap({observability:n.observability,runtime:n.runtime,controller:q,stateStore:m,composerDraft:Dn,interactionFlow:Oi,featureFlow:lt,queueFlow:Tn,delegationFlow:Jn,activeRunFlow:{refresh:P=>j.refresh(P),currentSnapshot:()=>j.currentSnapshot()},goalFlow:nt,runProjection:$e,append:Ye,onChanged:()=>{K(q.snapshot());r.requestRender()},followBottom:()=>at.forceFollowBottom(),requestWelcomeRebuild:()=>r.requestImmediateRender(),switchComposerDraft:P=>{V.clearRetainedSubmissions();return _?.switchSession(P)??Promise.resolve()},detachForegroundObserver:()=>B?.detachForegroundObserver(),adoptForegroundRun:()=>e.adoptForegroundRun(q.snapshot().session?.sessionId,j.currentSnapshot(),B),preparePluginHookSessionSwitch:e.preparePluginHookSessionSwitch,hasLiveRun:()=>_i()||Pi.isRunning(),abortForegroundRun:()=>Me(),abortSessionRun:P=>n.runtime.abortSession({id:P,reason:"user_stop"}),currentRunId:_t,onSideSessionOpened:P=>No?.trackBtwSessionOpened(P),onSideSessionClosed:P=>No?.trackBtwSessionClosed(P),onSideConversationChanged:()=>{K(q.snapshot());r.requestRender()}});const $o=new Hp({runtime:n.runtime,append:Ye,setHint:P=>k?.setHint(P),onChanged:()=>{K(q.snapshot());r.requestRender()},isStopped:()=>$});const im=new Up({runtime:n.runtime,append:Ye,setHint:P=>k?.setHint(P),onChanged:()=>{K(q.snapshot());r.requestRender()},isStopped:()=>$});V=new Np({bashFlow:Pi,workspaceDir:n.workspaceDir,...n.commandContributions?{contributions:n.commandContributions}:{},controller:q,activeRunFlow:j,featureFlow:lt,feedbackFlow:rT,sessionMutationFlow:Li,updateFlow:oT,goalFlow:nt,planModeFlow:Di,permissionModeFlow:$o,sandboxPolicyFlow:im,...n.auth?{auth:n.auth}:{},openExternalTarget:n.openExternalTarget,interactionFlow:Oi,sessionFlow:ut,queueFlow:Tn,composerDraft:Dn,workspaceRoots:b,runProjection:$e,editor:L,surface:ge,surfaceHost:bt,showTasks:()=>Jn.showTasks(),persistTuiMode:n.persistTuiMode,showStatusLine:()=>Kk({statusLine:Ae,surface:ge,persist:n.persistStatusLineItems}),showTheme:()=>zk({controller:l,surface:ge,persist:n.persistTheme}),keybindings:n.keybindings,getTuiKeybindingOverrides:n.getTuiKeybindingOverrides,saveTuiKeybindingOverrides:n.saveTuiKeybindingOverrides,reloadTui:n.reloadTui,queueEnabled:f.queue,liveRunId:_t,runtimeStopping:()=>Boolean($e.snapshot().stoppingRuntimeTurnId),isLlmRetrying:()=>k?.isLlmRetrying()??false,abortLiveTurn:Me,leaveUi:Ou,requestRestart:n.requestRestart,notifyAuthContextChanged:n.notifyAuthContextChanged,whenControllerReady:()=>aT,whenReady:()=>sm,whenStopping:()=>D??Promise.resolve(),isStopped:()=>$,append:Ye,setHint:P=>k?.setHint(P),onChanged:()=>{K(q.snapshot());r.requestRender()},userMessageCount:()=>C.snapshot().filter(P=>P.kind==="user").length,onMessageAdmitted:P=>{No?.trackChatSend(P);at.forceFollowBottom()}});j.setCommandCatalog(V.catalog);B=new Cp({runtime:n.runtime,controller:q,stateStore:m,effectRunner:f9,stateCoordinator:sT,sessionFlow:ut,delegationFlow:Jn,promptSuggestions:Fo,activeRunFlow:j,interactionFlow:Oi,runProjection:$e,releaseQueueItem:P=>Tn.releaseQueuedSubmission(P),transcript:C,refreshQueue:P=>Tn.refresh(P),projectQueueItem:P=>Tn.project(P),resumeQueueAfterTurnTerminal:()=>Tn.resumeAfterTurnTerminal(),restoreFailedQueueItem:P=>{const ie=Tn.takeOverFailedQueueItem(P);if(ie)V.restoreSubmission(ie)},onLlmRetryChanged:P=>{k?.setLlmRetry(P);K(q.snapshot())},onRetryAvailabilityChanged:(P,ie)=>V.setSessionRetryable(P,ie),goalFlow:nt,updateFollowUpPanel:()=>Tn.updatePanel(),onChanged:qe,append:Ye,isStopped:()=>$,queueEnabled:f.queue,observability:n.observability,incidentReporter:n.incidentReporter,notify:(P,ie)=>{o.notifyOnce(P,ie,Sh({...q.snapshot().session,workspace:n.workspaceDir}))}});ve=new em({app:n,skills:lt,controller:q,liveRunId:_t,transcript:C,editor:L,composerDraft:Dn,isStopped:()=>$,chrome:()=>k,onChanged:qe});const y9=new qp({cancelBash:()=>Pi.cancel(),tui:r,addInputListener:P=>s.addInputListener(P),renderLifecycle:{start:()=>s.start(),stop:async()=>{s.stop();await i.drainOutput?.()},requestRender:P=>r.requestRender(P)},editor:L,workspaceDir:n.workspaceDir,externalEditorCommand:n.externalEditorCommand,editDraftInExternalEditor:n.editDraftInExternalEditor,interaction:It,interactionSurface:ge,interactionFlow:Oi,featureFlow:lt,commandFlow:V,permissionModeFlow:$o,planModeFlow:Di,composerDraft:Dn,liveRunId:_t,hasWaitingMessage:()=>$e.snapshot().queuedCount>0,restoreWaitingMessage:async()=>{const P=await Tn.restoreLatest();if(!P)return false;L.restoreSubmittedDraft(P.editor);bt.setChatFocus(L);return true},openQueueManager:()=>Tn.openManager(),toggleTasks:()=>ds.toggleExpanded(),isStopped:()=>$,abortLiveTurn:Me,cancelSessionEdit:()=>Li.cancelActiveEdit(),isEditImageAttachment:P=>Li.retainedEditAttachments().some(ie=>ie.id===P&&ie.type==="image"),takeRecentCodexSession:()=>ve?.take(),restoreRecentCodexSession:P=>ve?.restore(P),dismissRecentCodexSession:()=>ve?.dismiss(),leaveUi:Ou,isSideModeActive:()=>ut.isSideModeActive(),toggleSideConversation:()=>ut.toggleSideConversation(),closeSideConversation:P=>ut.closeSideConversation(P),requestProcessSuspend:n.requestProcessSuspend,keybindings:n.keybindings,append:Ye,setHint:(P,ie)=>k?.setHint(P,ie),onChanged:()=>{K(q.snapshot());r.requestRender()},onSubmissionStarted:(P,ie)=>{const dt=Fo.submitted(q.snapshot().session?.sessionId,P??"");const bn=_?.suspendForSubmission(P,ie);_u=dt&&bn?{submissionToken:bn,reportSent:dt}:void 0;return bn},onSubmissionPrepared:(P,ie)=>_?.updatePendingSubmission(P,ie),onSubmissionAdmitted:P=>{if(P&&_u?.submissionToken===P){_u.reportSent();_u=void 0}_?.settleSubmission(P)},onSubmissionSettled:P=>_?.settleSubmission(P),acceptPromptSuggestion:()=>{const P=nn.visiblePromptSuggestion();const ie=Fo.candidate(q.snapshot().session?.sessionId);if(!P||!ie||ie.text!==P)return false;L.setText(P);Fo.accept(ie);return true},requestInteractionRender:Lu});const T9=y9.attach();k=new Bh({keybindings:n.keybindings,promptSuggestion:Fo,version:n.version,workspace:n.workspaceDir,...n.homeDir?{homeDir:n.homeDir}:{},queueEnabled:f.queue,isStarted:()=>Ne,isStopped:()=>$,setTerminalTitle:P=>a.update(P),setProgramStatus:P=>u.update(P),terminalTitle:n.terminalTitle,connection:()=>m.snapshot().connection,liveRunId:_t,runProjection:()=>$e.snapshot(),transcript:C,shouldResumeDraftAfterLogin:()=>cs(),activePermission:()=>Boolean(Oi.permission()),activeQuestionnaire:()=>Boolean(Oi.questionnaire()),agentInteraction:()=>Oi.agentReadback(),...t?{agentCounts:()=>Jn.agentCounts(),backgroundTaskCount:()=>Jn.backgroundTaskCount()}:{},attachmentCount:()=>Dn.snapshot().attachments.length+Li.retainedEditAttachments().length,expandedDraft:()=>L.getExpandedText(),inputCommands:()=>[...V.catalog.inputCommands,...lt.skillCommands()],selectedModel:()=>lt.selectedModel(),selectedEffort:()=>lt.selectedEffort(),permissionMode:()=>$o.snapshot(),planMode:()=>Di.snapshot(),...n.daemonConnection?{daemonConnection:()=>n.daemonConnection?.getState()}:{},sideConversation:()=>ut.sideConversationSnapshot(),sessionState:()=>m.snapshot(),turnStartedAtMs:P=>q.turnStartedAtMs(P),welcome:ee,status:Ae,activity:it,composer:nn});const b9=n.daemonConnection?.subscribe(()=>{if(!Ne||$)return;K(q.snapshot());r.requestRender()});function Lu(){if(!Ne||$)return;r.requestImmediateRender()}const aT=q.initialize();const sm=aT.then(async()=>{await lt.refreshSelectedModel();await Promise.all([$o.refresh().catch(()=>void 0),im.refresh().catch(()=>void 0),Di.refreshCapabilities().catch(()=>void 0)]);await nt?.refresh()});const{openSession:v9,continueLatestSession:S9}=hA({ready:sm,sessionFlow:ut,workspaceDir:n.workspaceDir,append:Ye});async function uT(P={}){if($)return Do;const ie=$e.snapshot().queuedCount;if(ie>0){Ye(`Exiting with ${ie} unsent message${ie===1?"":"s"} still in the Queue \u2014 nothing was delivered.`,"warning");r.requestRender()}m.dispatch({type:"lifecycle/leaveUi"});$=true;o.dispose();a.dispose();u.dispose();const dt=Pi.stop();T9();Dn.abortClipboardRead();B.stop();ut.stop();Oi.deactivate();lt.stop();Jn.stop();j.stop();$o.stop();im.stop();Di.stop();rT.stop();oT.stop();l.dispose();b9?.();n.daemonConnection?.dispose();it.dispose();re.imagePreview.dispose();s.prepareTranscriptExit();D??=_?.stop()??Promise.resolve();kt(bt,L,R,Ae,ki);if(P.abortActiveTurn!==false){const bn=q.snapshot();if(bn.activeTurnId)void q.abort().catch(()=>void 0);else if(Lo()&&bn.session?.sessionId){void n.runtime.abortSession({id:bn.session.sessionId,turnId:Lo(),reason:"user_stop"}).catch(()=>void 0)}}await i.drainInput(1e3).catch(()=>void 0);s.dispose();await i.drainOutput?.().catch(()=>void 0);await D;await dt;m.dispatch({type:"lifecycle/stopped"});Oo?.();return Do}async function Ou(){await Me().catch(()=>false);return uT({abortActiveTurn:false})}async function C9(){if(!Ne||$||Q)return;Q=true;o.setActive(false);a.setActive(false);u.setActive(false);s.stop();await i.drainOutput?.();await _?.suspend()}async function x9(){if(!Ne||$||!Q)return;Q=false;s.start();o.setActive(true);a.setActive(true);u.setActive(true);K(q.snapshot());B.restart();r.requestRender(true);_?.resume()}return{tui:r,surfaceHost:bt,editor:L,interaction:It,controller:q,state:m,transcript:C,ready:sm,firstFrame:s.firstFrame,stopped:Do,getSurface:()=>at.getSurface(),start(){if(Ne||$)return;Ne=true;o.setActive(true);a.setActive(true);u.setActive(true);K(q.snapshot());bt.setChatFocus(L);B.start();s.start();pe.start();void ve.detect().catch(()=>void 0);void lt.refreshSelectedModel(q.snapshot().session?.sessionId).catch(()=>void 0);void j.refresh().catch(()=>void 0);void nt?.refresh().catch(()=>void 0);mA(n,de,()=>$,r)},suspend:C9,resume:x9,openSession:v9,continueLatestSession:S9,async runStartupCheckin(){if($||!n.dataDir||!DR(n.dataDir))return;if(q.snapshot().account?.managedTokenPresent===false)return;await lt.runDailyCheckin()},setStartupStatus(P){k?.setStartupHint(P);qe()},submit:P=>V.submit(P).then(()=>void 0),commandFlow:V,abortTurn:Me,leaveUi:Ou,stop:uT}}function Zk(n){try{return ZW(n).isFile()}catch{return false}}function ej(n){const e=n.attachments.filter(i=>Zk(i.filePath));const t=(n.transportAttachments??[]).filter(i=>i.assetId?true:i.filePath?Zk(i.filePath):false);if(!n.content.trim()&&e.length===0&&t.length===0){return void 0}return{...n,submissionId:`abort-restore:${n.submissionId}`,attachments:e,...n.transportAttachments?{transportAttachments:t}:{},editor:ph(n.editor.text.trim()?n.editor:{...n.editor,text:n.content,cursor:n.content.length},e)}}function e9(n,e){const t=n.get(`user:${e}`);if(!t)return;n.upsert({id:`user:${e}`,kind:"user",status:"cancelled",...t.content?{content:t.content}:{},updatedAtMs:Date.now(),...t.attachments?{attachments:t.attachments}:{}})}function n9(n){let e;let t;const i=[];const s=()=>{for(const r of[...i])r()};void n.then(r=>{const o=r.connection;if(!o)return;e=o.state();t=o.onChange(a=>{e=a;s()});s()}).catch(()=>void 0);return{getState:()=>e,subscribe:r=>{i.push(r);return()=>{const o=i.indexOf(r);if(o>=0)i.splice(o,1)}},dispose:()=>{t?.();i.length=0}}}var tj=new Set(["sendMessage","watchEvents","watchSessionTurn","watchSessionUsageCommits"]);function i9(n){let e;void n.then(t=>{e=t},()=>void 0);return new Proxy({},{get(t,i){if(i==="then")return void 0;if(i==="isGoalEnabled"){return()=>e?.isGoalEnabled()??false}if(typeof i!=="string")return void 0;if(tj.has(i)){return(...s)=>nj(n,i,s)}return async(...s)=>{const r=await n;const o=Reflect.get(r,i);if(typeof o!=="function")return o;return Reflect.apply(o,r,s)}}})}async function*nj(n,e,t){const i=await n;const s=Reflect.get(i,e);if(typeof s!=="function")return;const r=Reflect.apply(s,i,t);yield*r}function s9(n){if(n.kind!=="available"&&n.kind!=="package-manager")return void 0;const e=n.latestVersion.trim();return e?{latestVersion:e}:void 0}import{mkdirSync as ij,readFileSync as sj,renameSync as rj,writeFileSync as oj}from"node:fs";import Ru from"node:path";var r9=Ru.join("tui","tui-settings.json");var aj="tui-settings.json";var o9=/^[a-z0-9][a-z0-9._-]{0,63}$/iu;function uj(n){return Ru.join(n,r9)}function nT(n){for(const e of[r9,aj]){try{const t=sj(Ru.join(n,e),"utf8").replace(/^\uFEFF/u,"");const i=JSON.parse(t);if(i&&typeof i==="object"&&!Array.isArray(i)){return i}}catch{}}return{}}function a9(n,e){const t=uj(n);const i=Ru.dirname(t);ij(i,{recursive:true,mode:448});const s={...nT(n),...e};if(s.tuiMode===void 0)delete s.tuiMode;if(s.theme===void 0)delete s.theme;const r=Ru.join(i,`.tui-settings.json.${process.pid}.${Date.now()}.tmp`);oj(r,`${JSON.stringify(s,null,2)}
|
|
122
|
-
`,{encoding:"utf8",mode:384});rj(r,t)}function u9(n){return nT(n).tuiMode==="fullscreen"?"fullscreen":"regular"}function l9(n,e){a9(n,{tuiMode:e})}function d9(n){const e=nT(n).theme;if(typeof e!=="string")return void 0;const t=e.trim();if(!t)return void 0;const i=/^([a-z0-9][a-z0-9._-]{0,63})\/(light|dark)$/iu.exec(t);const s=i?.[1];const r=i?.[2];if(s&&r){return`${s}/${r.toLowerCase()}`}return o9.test(t)?t:void 0}function c9(n,e){const t=e.trim();if(!o9.test(t)&&!/^[a-z0-9][a-z0-9._-]{0,63}\/(light|dark)$/iu.test(t)){throw new Error(`"${e}" is not a valid theme id`)}a9(n,{theme:t})}var h9=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];var lj=80;function p9(n){let e=0;let t=false;const i=o=>{try{n(o)}catch{}};const s=()=>{if(t)return;i(`${h9[e]} Starting server...`);e=(e+1)%h9.length};s();const r=setInterval(s,lj);r.unref?.();return{stop(){if(t)return;t=true;clearInterval(r);i(void 0)}}}var fj="Intelligence with everyone, bye~";var ku="--profile";function gj(n){const e=$T({configEnabled:n.configEnabled,environment:n.environment});if(!e.enabled)return void 0;return(n.createTelemetry??BT)(n.telemetryOptions)}async function Jge(n,e={}){if(n.model!==void 0)dm(n.model.trim());if(n.model!==void 0&&n.showSessionPicker){throw new Error("--model requires a Session id with --session; use --session <id> or --continue.")}if(!n.terminal&&(!process.stdin.isTTY||!process.stdout.isTTY)){throw new Error("Minimax Code interactive mode requires a TTY.")}const t=n.homeDir??pj();const i=n.workspaceDir??process.cwd();const s=n.dataDir??await(e.prepareDataDir??CT)();const r=(e.captureStderr??x0)(s);const o=n.terminal??new As;const a=n.tuiMode??(e.readTuiMode??u9)(s);const u=n.theme??(e.readTuiTheme??d9)(s);const l=Er();const d=TT();const h=vT(n.lane,d.buildEnv);const m=h?{bedrockLane:h}:void 0;const f=(e.createSharedAuthSession??vb)({dataDir:s,...d,oauthEndpoints:yT(process.env,d)});let y;const T=new OT({authContextGetter:()=>y,...m?{routingContextGetter:()=>m}:{},...d});const b=async()=>{try{const q=await f.getAccessToken({requiredScopes:[...gT],minValidityMs:3e4});if(y?.accessToken!==q.accessToken){y={accessToken:q.accessToken}}return q}catch{y=void 0;return void 0}};const v=vj(async()=>{const q=y?.accessToken;if(!q)return void 0;const qe=await T.getRealUserID();if(qe&&y?.accessToken===q){y={...y,realUserID:qe}}return qe});const C={dataDir:s,appVersion:n.version,...d,terminal:l.terminalId,tuiMode:a,resolveAuthContext:async()=>{const q=await b();if(!q)return void 0;const qe=await v(q.accessToken.trim());return qe?{accessToken:q.accessToken,realUserID:qe}:void 0}};const I=e.createIncidentReporter?e.createIncidentReporter(C):m9()?XT:YT(C);const R=(q,qe)=>{const $e=qe==="unhandledRejection"?"unhandledRejection":"uncaughtException";qn(I,{eventType:"cli_process_error",error:q,component:"process",operation:$e,codeLocation:"src/tui/launcher.ts#uncaughtExceptionMonitor",severity:"fatal",impact:"exit",handled:false})};const L=gj({configEnabled:(e.readTelemetryEnabled??(()=>pT().telemetry.enabled))(),environment:process.env,telemetryOptions:{...d,version:n.version},...e.createBusinessTelemetry?{createTelemetry:e.createBusinessTelemetry}:m9()?{createTelemetry:()=>({track:()=>void 0,flush:async()=>void 0})}:{}});const _=q=>{try{L?.track("tui_launch",{launch_type:q})}catch{}};const D=(e.createObservability??zT)(s,{surface:"tui"});let k=false;let K=false;const j=q=>{if(q.terminalDead)K=true;if(k)return;k=true;try{D.recordProcessStop(P0(q,{homeDirectory:t,workspaceDir:i}))}catch{}};const B=E0(o,j);D.recordStartup({phase:"cli.process",outcome:"started"});D.recordTerminal({...l,columns:B.columns,rows:B.rows});const V=e.loadUpdateApplication??(async q=>{const{McodeUpdateApplication:qe}=await import("./application-
|
|
122
|
+
`,{encoding:"utf8",mode:384});rj(r,t)}function u9(n){return nT(n).tuiMode==="fullscreen"?"fullscreen":"regular"}function l9(n,e){a9(n,{tuiMode:e})}function d9(n){const e=nT(n).theme;if(typeof e!=="string")return void 0;const t=e.trim();if(!t)return void 0;const i=/^([a-z0-9][a-z0-9._-]{0,63})\/(light|dark)$/iu.exec(t);const s=i?.[1];const r=i?.[2];if(s&&r){return`${s}/${r.toLowerCase()}`}return o9.test(t)?t:void 0}function c9(n,e){const t=e.trim();if(!o9.test(t)&&!/^[a-z0-9][a-z0-9._-]{0,63}\/(light|dark)$/iu.test(t)){throw new Error(`"${e}" is not a valid theme id`)}a9(n,{theme:t})}var h9=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];var lj=80;function p9(n){let e=0;let t=false;const i=o=>{try{n(o)}catch{}};const s=()=>{if(t)return;i(`${h9[e]} Starting server...`);e=(e+1)%h9.length};s();const r=setInterval(s,lj);r.unref?.();return{stop(){if(t)return;t=true;clearInterval(r);i(void 0)}}}var fj="Intelligence with everyone, bye~";var ku="--profile";function gj(n){const e=$T({configEnabled:n.configEnabled,environment:n.environment});if(!e.enabled)return void 0;return(n.createTelemetry??BT)(n.telemetryOptions)}async function Jge(n,e={}){if(n.model!==void 0)dm(n.model.trim());if(n.model!==void 0&&n.showSessionPicker){throw new Error("--model requires a Session id with --session; use --session <id> or --continue.")}if(!n.terminal&&(!process.stdin.isTTY||!process.stdout.isTTY)){throw new Error("Minimax Code interactive mode requires a TTY.")}const t=n.homeDir??pj();const i=n.workspaceDir??process.cwd();const s=n.dataDir??await(e.prepareDataDir??CT)();const r=(e.captureStderr??x0)(s);const o=n.terminal??new As;const a=n.tuiMode??(e.readTuiMode??u9)(s);const u=n.theme??(e.readTuiTheme??d9)(s);const l=Er();const d=TT();const h=vT(n.lane,d.buildEnv);const m=h?{bedrockLane:h}:void 0;const f=(e.createSharedAuthSession??vb)({dataDir:s,...d,oauthEndpoints:yT(process.env,d)});let y;const T=new OT({authContextGetter:()=>y,...m?{routingContextGetter:()=>m}:{},...d});const b=async()=>{try{const q=await f.getAccessToken({requiredScopes:[...gT],minValidityMs:3e4});if(y?.accessToken!==q.accessToken){y={accessToken:q.accessToken}}return q}catch{y=void 0;return void 0}};const v=vj(async()=>{const q=y?.accessToken;if(!q)return void 0;const qe=await T.getRealUserID();if(qe&&y?.accessToken===q){y={...y,realUserID:qe}}return qe});const C={dataDir:s,appVersion:n.version,...d,terminal:l.terminalId,tuiMode:a,resolveAuthContext:async()=>{const q=await b();if(!q)return void 0;const qe=await v(q.accessToken.trim());return qe?{accessToken:q.accessToken,realUserID:qe}:void 0}};const I=e.createIncidentReporter?e.createIncidentReporter(C):m9()?XT:YT(C);const R=(q,qe)=>{const $e=qe==="unhandledRejection"?"unhandledRejection":"uncaughtException";qn(I,{eventType:"cli_process_error",error:q,component:"process",operation:$e,codeLocation:"src/tui/launcher.ts#uncaughtExceptionMonitor",severity:"fatal",impact:"exit",handled:false})};const L=gj({configEnabled:(e.readTelemetryEnabled??(()=>pT().telemetry.enabled))(),environment:process.env,telemetryOptions:{...d,version:n.version},...e.createBusinessTelemetry?{createTelemetry:e.createBusinessTelemetry}:m9()?{createTelemetry:()=>({track:()=>void 0,flush:async()=>void 0})}:{}});const _=q=>{try{L?.track("tui_launch",{launch_type:q})}catch{}};const D=(e.createObservability??zT)(s,{surface:"tui"});let k=false;let K=false;const j=q=>{if(q.terminalDead)K=true;if(k)return;k=true;try{D.recordProcessStop(P0(q,{homeDirectory:t,workspaceDir:i}))}catch{}};const B=E0(o,j);D.recordStartup({phase:"cli.process",outcome:"started"});D.recordTerminal({...l,columns:B.columns,rows:B.rows});const V=e.loadUpdateApplication??(async q=>{const{McodeUpdateApplication:qe}=await import("./application-6B6N6MDM.js");return new qe({currentVersion:q})});let ve;const Me=()=>{ve??=V(n.version);return ve};let nt;const Tt=new Promise(q=>{nt=q});let Ne;let $;let Q;let re;let ee;let de;let Ae;let it;let nn=false;let It=false;let Ri=false;let ki=false;let ds=false;let Ye;let Pi;if(I.runId){process.on("uncaughtExceptionMonitor",R)}try{const q=On.now();I.breadcrumb("cli.runtime.initialize.started");D.recordStartup({phase:"runtime.initialize",outcome:"started"});try{$=await(e.loadRuntimeLifecycle??(()=>import("./lifecycle-56K655PJ.js")))();Q=$.createTuiRuntime({dataDir:s,workspaceDir:i,version:n.version,surface:"tui",observability:D,...n.contextMode?{contextMode:n.contextMode}:{},...h?{lane:h}:{},...n.profile?{profile:n.profile}:{},...n.noDaemon?{noDaemon:true}:{},...n.systemPromptOverrides?{systemPromptOverrides:n.systemPromptOverrides}:{}},{sharedAuthCore:f});void Q.catch(()=>void 0)}catch(at){D.recordStartup({phase:"runtime.initialize",outcome:"failed",durationMs:On.now()-q,errorKind:tr(at)});throw at}const qe=On.now();D.recordStartup({phase:"tui.start",outcome:"started"});const $e=await L0(s);const Lo=mf(s);let _t=Lo.overrides;let _i=true;try{const at=Q;if(!at)throw new Error("Runtime initialization did not start.");const bt=$0({platform:process.platform,suspendSupported:process.platform!=="win32",windowsClipboardInterop:process.platform==="linux"&&Boolean(process.env.WSL_DISTRO_NAME||process.env.WSLENV),userOverrides:_t});Lm(bt.manager);ee=(e.createApp??t9)({runtime:i9(at.then(pe=>pe.adapter)),daemonConnection:n9(at),dataDir:s,version:n.version,workspaceDir:i,terminalCapabilities:l,...$e.terminalTitle!==void 0?{terminalTitle:$e.terminalTitle}:{},...$e.statusLineItems?{statusLineItems:$e.statusLineItems}:{},...$e.customStatusLine?{customStatusLine:$e.customStatusLine}:{},...$e.showTips===void 0?{}:{showTips:$e.showTips},...$e.notifications?{notifications:$e.notifications}:{},...$e.programStatus===void 0?{}:{programStatus:$e.programStatus},...process.env[py]?{automationResultPath:process.env[py]}:{},...n.workspaceRoots?{workspaceRoots:n.workspaceRoots}:{},homeDir:t,terminal:B,tuiMode:a,clearScrollbackOnStart:Boolean(n.sessionId?.trim()||n.continueLatestSession),persistTuiMode:pe=>(e.writeTuiMode??l9)(s,pe),...u?{theme:u}:{},persistTheme:pe=>(e.writeTuiTheme??c9)(s,pe),persistStatusLineItems:pe=>mT(s,pe),externalEditorCommand:n.externalEditorCommand,observability:D,incidentReporter:I,...L?{businessTelemetry:L}:{},auth:(e.createAuthApplication??Sb)({dataDir:s,...d,sharedAuthCore:f,...L?{telemetry:L}:{},telemetrySource:"mcode_tui"}),notifyAuthContextChanged:async pe=>{const ge=await at;await ge.synchronizeAuthContext(pe);await ge.host.notifyAuthContextChanged?.(pe);if(pe==="authenticated")await b();else y=void 0;I.breadcrumb("cli.auth.context.changed",{authState:pe});if(pe==="authenticated")void I.drain()},readClipboardImage:async pe=>{const{readTuiClipboardImage:ge}=await import("./clipboard-image-3IP4JWUK.js");return ge({signal:pe})},keybindings:bt.registry,...process.platform==="win32"?{}:{requestProcessSuspend:()=>process.kill(process.pid,"SIGTSTP")},requestRestart:(pe,ge)=>{ds=true;if(pe)Ye=pe;if(ge)Pi=ge},getTuiKeybindingOverrides:()=>({..._t}),saveTuiKeybindingOverrides:pe=>{const ge={...pe};H0(s,ge);_t=ge;bt.manager.setUserBindings({...bt.hostOverrides,...ge})},reloadTui:async()=>{const pe=await at;const ge=mf(s);if(ge.error)throw new Error(`Couldn't reload ${ge.path}: ${ge.error}`);const Oo=bt.registry.findConflicts(ge.overrides);if(Oo.length>0){const Do=Oo.map(ut=>`${ut.key} (${ut.ids.join(", ")})`).join("; ");throw new Error(`Conflicting TUI keybindings: ${Do}`)}hT();await pe.adapter.refreshPlugins();_t=ge.overrides;bt.manager.setUserBindings({...bt.hostOverrides,...ge.overrides})},...n.resumeDraftAfterLogin?{resumeDraftAfterLogin:true}:{},checkForUpdate:async()=>s9(await(await Me()).inspect()),inspectUpdate:async()=>(await Me()).inspect(),applyUpdate:async(pe,ge)=>(await Me()).apply(pe,ge)});void ee.ready.catch(()=>void 0);if(ee.editor)ee.editor.disableSubmit=true;de=p9(pe=>ee?.setStartupStatus?.(pe));Ne=(e.installProcessGuards??I0)({process,stop:()=>ee?.stop({abortActiveTurn:re?.connection===void 0})??Promise.resolve(),report:pe=>{try{process.stderr.write(`Minimax Code TUI stopped unexpectedly: ${ct(pe)}. Restart MCode; if it keeps happening, report it through an available support channel.
|
|
123
123
|
`)}catch{}},capture:(pe,ge)=>yj(I,pe,ge),onStopCause:j,onStopFailure:()=>nt?.(),isTerminalDead:()=>K,...process.platform==="win32"?{}:{suspend:()=>ee?.suspend?.(),resume:async()=>{await ee?.resume?.();_("hot")},suspendProcess:()=>process.kill(process.pid,"SIGTSTP")}});ee.start();Ae=bj(ee,D,Tt);void Ae.catch(()=>void 0);const hs=await Promise.race([at.then(pe=>({status:"ready",runtime:pe}),pe=>({status:"failed",error:pe})),ee.stopped.then(()=>({status:"stopped"})),Tt.then(()=>({status:"stopped"}))]);if(hs.status==="stopped"){D.recordStartup({phase:"runtime.initialize",outcome:"failed",durationMs:On.now()-q,errorKind:"StoppedDuringInitialization"});return}if(hs.status==="failed"){D.recordStartup({phase:"runtime.initialize",outcome:"failed",durationMs:On.now()-q,errorKind:tr(hs.error)});throw hs.error}re=hs.runtime;It=true;I.breadcrumb("cli.runtime.initialize.succeeded");D.recordStartup({phase:"runtime.initialize",outcome:"succeeded",durationMs:On.now()-q});await ee.ready;_i=await kj(ee,D,n,re.adapter);de.stop();de=void 0;if(ee.editor)ee.editor.disableSubmit=false}catch(at){D.recordStartup({phase:"tui.start",outcome:"failed",durationMs:On.now()-qe,errorKind:tr(at)});throw at}D.recordStartup({phase:"tui.start",outcome:"succeeded",durationMs:On.now()-qe});const tm=await Ae;if(!tm){return}Ri=true;_("cold");I.setPhase("runtime");I.breadcrumb("cli.first-frame.rendered");const cs=_i?n.initialPrompt?.trim():void 0;if(_i&&cs!=="/checkin")void ee.runStartupCheckin?.();if(cs)void Pj(ee,D,cs);nn=await Promise.race([ee.stopped.then(()=>true),Tt.then(()=>false)]);if(nn)it=ee.controller?.snapshot().session?.sessionId}catch(q){qn(I,{eventType:Ri?"cli_process_error":"cli_startup_error",error:q,component:Ri?"tui":"startup",operation:"launch-lifecycle",codeLocation:"src/tui/launcher.ts#launchTui",severity:"fatal",impact:"exit",handled:false});throw q}finally{r.restore();I.setPhase("shutdown");I.breadcrumb("cli.shutdown.started");Sj(de);Ne?.();if(ee){try{await Promise.resolve(ee.stop())}catch(q){Pu(I,"cli-ui",q)}}if(re&&$){try{ki=await $.shutdownTuiRuntime(re,{reportFailure:(q,qe)=>{Pu(I,q,qe);try{process.stderr.write(`[minimax-code] ${q} cleanup failed: ${ct(qe)}
|
|
124
124
|
`)}catch{}}})}catch(q){ki=true;Pu(I,"runtime",q)}if(ki)process.exitCode=1}else if(Q&&$){Tj(Q,$,I)}try{await D.flush()}catch(q){qn(I,{eventType:"cli_persistence_error",error:q,component:"observability",operation:"flush",codeLocation:"src/tui/launcher.ts#observability.flush",severity:"warning",impact:"degraded",handled:true})}try{await L?.flush()}catch{}I.completeRun();await I.flush();if(I.runId){process.off("uncaughtExceptionMonitor",R)}}if(ds&&nn&&It&&!ki){await(e.restartProcess??Cj)(it,Ye,Pi);return}if(nn&&It&&!ki){try{(e.writeExitMessage??(q=>process.stdout.write(q)))(Aj(it))}catch{}}}function yj(n,e,t){const i=t.origin==="stdout"||t.origin==="stderr";const s=t.origin==="shutdown";qn(n,{eventType:i?"cli_terminal_error":s?"cli_shutdown_error":t.origin==="suspend"||t.origin==="resume"?"cli_interaction_error":"cli_process_error",error:e,component:i?"terminal":s?"shutdown":"process",operation:s?"cli-ui":t.origin,codeLocation:"src/tui/platform/process-guards.ts#installTuiProcessGuards",severity:t.terminalDead||s?"error":"fatal",impact:"exit",handled:Boolean(t.terminalDead||s),context:{origin:t.origin,...t.terminalDead===void 0?{}:{terminalDead:t.terminalDead}}})}function Pu(n,e,t){qn(n,{eventType:"cli_shutdown_error",error:t,component:"shutdown",operation:e,codeLocation:"src/tui/launcher.ts#shutdown",severity:"error",impact:"degraded",handled:true})}function Tj(n,e,t){void n.then(async i=>{if(await e.shutdownTuiRuntime(i,{reportFailure:(s,r)=>Pu(t,s,r)})){process.exitCode=1}}).catch(i=>Pu(t,"pending-runtime",i))}async function bj(n,e,t){const i=On.now();e.recordStartup({phase:"tui.first-frame",outcome:"started"});let s;try{s=await Promise.race([n.firstFrame.then(()=>true),n.stopped.then(()=>false),t.then(()=>false)])}catch(r){e.recordStartup({phase:"tui.first-frame",outcome:"failed",durationMs:On.now()-i,errorKind:tr(r)});throw r}e.recordStartup({phase:"tui.first-frame",outcome:s?"succeeded":"failed",durationMs:On.now()-i,...s?{}:{errorKind:"StoppedBeforeFirstFrame"}});return s}function vj(n){let e;let t;let i;let s=0;return async r=>{if(!r)return void 0;if(e!==r){e=r;t=void 0;i=void 0;s=0}if(t)return t;if(Date.now()<s)return void 0;const o=i??n().then(a=>{if(a)t=a;else s=Date.now()+6e4;return a}).catch(()=>{s=Date.now()+6e4;return void 0});i=o;try{return await o}finally{if(i===o)i=void 0}}}function Sj(n){try{n?.stop()}catch{}}async function Cj(n,e,t){const i=wj(process.execPath,process.argv,n,t);const s=xj(process.env,e);if(await ST(process.argv[1],process.execPath,process.pid,i,s)){return}return new Promise((r,o)=>{const a=dj(process.execPath,i,{cwd:process.cwd(),env:s,stdio:"inherit",windowsHide:false});a.once("error",o);a.once("exit",(u,l)=>{if(u!==null&&u!==0)process.exitCode=u;else if(l)process.exitCode=1;r()})})}function xj(n,e){return e?DT({...n,MAVIS_REGION:e}):n}function wj(n,e,t,i){const s=Mj(n);const r=e.slice(s?2:1);const o=bT(r,true);const a=o?["--env",o]:[];const u=Ij(r);const l=t?["--session",t]:[];const d=ET(r);const h=i?[i]:[];if(!s){return[...u,...a,...d,...l,...h]}const m=e[1];if(!m||!Ej(m)){throw new Error("Unable to restart MCode because its Node.js entry file is unavailable.")}return[m,...u,...a,...d,...l,...h]}function Ij(n){let e=false;for(let t=0;t<n.length;t+=1){const i=n[t];if(i===void 0)continue;if(i==="--")break;if(i===ku){const s=n[t+1];return am(s)?[ku,s]:[]}if(i.startsWith(`${ku}=`)){const s=i.slice(ku.length+1);return am(s)?[ku,s]:[]}if(!i.startsWith("-")&&!e)break;e=i.startsWith("-")}return[]}function Mj(n){const e=mj.basename(n).toLocaleLowerCase();return e==="node"||e==="node.exe"}function m9(){return Boolean(import.meta.vitest)||process.env.VITEST==="true"}function Ej(n){try{return cj(n)&&hj(n).isFile()}catch{return false}}function Aj(n){const e=n?Rj(n):void 0;return`${e??"\n"}${e?"\n":""}${fj}
|
|
125
125
|
`}function Rj(n){const e=n.trim();if(!/^[A-Za-z0-9][A-Za-z0-9._:-]{0,255}$/u.test(e))return void 0;return`
|