| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431 |
- (function () {
- const W = document.createElement("link").relList;
- if (W && W.supports && W.supports("modulepreload"))
- return;
- for (const U of document.querySelectorAll('link[rel="modulepreload"]'))
- G(U);
- new MutationObserver(U => {
- for (const q of U)
- if (q.type === "childList")
- for (const x of q.addedNodes)
- x.tagName === "LINK" && x.rel === "modulepreload" && G(x)
- }
- ).observe(document, {
- childList: !0,
- subtree: !0
- });
- function V(U) {
- const q = {};
- return U.integrity && (q.integrity = U.integrity),
- U.referrerpolicy && (q.referrerPolicy = U.referrerpolicy),
- U.crossorigin === "use-credentials" ? q.credentials = "include" : U.crossorigin === "anonymous" ? q.credentials = "omit" : q.credentials = "same-origin",
- q
- }
- function G(U) {
- if (U.ep)
- return;
- U.ep = !0;
- const q = V(U);
- fetch(U.href, q)
- }
- }
- )();
- var Ce = {
- exports: {}
- };
- (function (z, W) {
- (function (V, G) {
- z.exports = G()
- }
- )(self, function () {
- return (() => {
- var V = {
- 4567: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.AccessibilityManager = void 0;
- const n = a(9042)
- , _ = a(6114)
- , h = a(9924)
- , f = a(3656)
- , d = a(844)
- , l = a(5596)
- , o = a(9631);
- class t extends d.Disposable {
- constructor(e, i) {
- super(),
- this._terminal = e,
- this._renderService = i,
- this._liveRegionLineCount = 0,
- this._charsToConsume = [],
- this._charsToAnnounce = "",
- this._accessibilityTreeRoot = document.createElement("div"),
- this._accessibilityTreeRoot.classList.add("xterm-accessibility"),
- this._accessibilityTreeRoot.tabIndex = 0,
- this._rowContainer = document.createElement("div"),
- this._rowContainer.setAttribute("role", "list"),
- this._rowContainer.classList.add("xterm-accessibility-tree"),
- this._rowElements = [];
- for (let c = 0; c < this._terminal.rows; c++)
- this._rowElements[c] = this._createAccessibilityTreeNode(),
- this._rowContainer.appendChild(this._rowElements[c]);
- if (this._topBoundaryFocusListener = c => this._onBoundaryFocus(c, 0),
- this._bottomBoundaryFocusListener = c => this._onBoundaryFocus(c, 1),
- this._rowElements[0].addEventListener("focus", this._topBoundaryFocusListener),
- this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener),
- this._refreshRowsDimensions(),
- this._accessibilityTreeRoot.appendChild(this._rowContainer),
- this._renderRowsDebouncer = new h.TimeBasedDebouncer(this._renderRows.bind(this)),
- this._refreshRows(),
- this._liveRegion = document.createElement("div"),
- this._liveRegion.classList.add("live-region"),
- this._liveRegion.setAttribute("aria-live", "assertive"),
- this._accessibilityTreeRoot.appendChild(this._liveRegion),
- !this._terminal.element)
- throw new Error("Cannot enable accessibility before Terminal.open");
- this._terminal.element.insertAdjacentElement("afterbegin", this._accessibilityTreeRoot),
- this.register(this._renderRowsDebouncer),
- this.register(this._terminal.onResize(c => this._onResize(c.rows))),
- this.register(this._terminal.onRender(c => this._refreshRows(c.start, c.end))),
- this.register(this._terminal.onScroll(() => this._refreshRows())),
- this.register(this._terminal.onA11yChar(c => this._onChar(c))),
- this.register(this._terminal.onLineFeed(() => this._onChar(`
- `))),
- this.register(this._terminal.onA11yTab(c => this._onTab(c))),
- this.register(this._terminal.onKey(c => this._onKey(c.key))),
- this.register(this._terminal.onBlur(() => this._clearLiveRegion())),
- this.register(this._renderService.onDimensionsChange(() => this._refreshRowsDimensions())),
- this._screenDprMonitor = new l.ScreenDprMonitor(window),
- this.register(this._screenDprMonitor),
- this._screenDprMonitor.setListener(() => this._refreshRowsDimensions()),
- this.register((0,
- f.addDisposableDomListener)(window, "resize", () => this._refreshRowsDimensions()))
- }
- dispose() {
- super.dispose(),
- (0,
- o.removeElementFromParent)(this._accessibilityTreeRoot),
- this._rowElements.length = 0
- }
- _onBoundaryFocus(e, i) {
- const c = e.target
- , g = this._rowElements[i === 0 ? 1 : this._rowElements.length - 2];
- if (c.getAttribute("aria-posinset") === (i === 0 ? "1" : `${this._terminal.buffer.lines.length}`) || e.relatedTarget !== g)
- return;
- let v, S;
- if (i === 0 ? (v = c,
- S = this._rowElements.pop(),
- this._rowContainer.removeChild(S)) : (v = this._rowElements.shift(),
- S = c,
- this._rowContainer.removeChild(v)),
- v.removeEventListener("focus", this._topBoundaryFocusListener),
- S.removeEventListener("focus", this._bottomBoundaryFocusListener),
- i === 0) {
- const u = this._createAccessibilityTreeNode();
- this._rowElements.unshift(u),
- this._rowContainer.insertAdjacentElement("afterbegin", u)
- } else {
- const u = this._createAccessibilityTreeNode();
- this._rowElements.push(u),
- this._rowContainer.appendChild(u)
- }
- this._rowElements[0].addEventListener("focus", this._topBoundaryFocusListener),
- this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener),
- this._terminal.scrollLines(i === 0 ? -1 : 1),
- this._rowElements[i === 0 ? 1 : this._rowElements.length - 2].focus(),
- e.preventDefault(),
- e.stopImmediatePropagation()
- }
- _onResize(e) {
- this._rowElements[this._rowElements.length - 1].removeEventListener("focus", this._bottomBoundaryFocusListener);
- for (let i = this._rowContainer.children.length; i < this._terminal.rows; i++)
- this._rowElements[i] = this._createAccessibilityTreeNode(),
- this._rowContainer.appendChild(this._rowElements[i]);
- for (; this._rowElements.length > e;)
- this._rowContainer.removeChild(this._rowElements.pop());
- this._rowElements[this._rowElements.length - 1].addEventListener("focus", this._bottomBoundaryFocusListener),
- this._refreshRowsDimensions()
- }
- _createAccessibilityTreeNode() {
- const e = document.createElement("div");
- return e.setAttribute("role", "listitem"),
- e.tabIndex = -1,
- this._refreshRowDimensions(e),
- e
- }
- _onTab(e) {
- for (let i = 0; i < e; i++)
- this._onChar(" ")
- }
- _onChar(e) {
- this._liveRegionLineCount < 21 && (this._charsToConsume.length > 0 ? this._charsToConsume.shift() !== e && (this._charsToAnnounce += e) : this._charsToAnnounce += e,
- e === `
- ` && (this._liveRegionLineCount++,
- this._liveRegionLineCount === 21 && (this._liveRegion.textContent += n.tooMuchOutput)),
- _.isMac && this._liveRegion.textContent && this._liveRegion.textContent.length > 0 && !this._liveRegion.parentNode && setTimeout(() => {
- this._accessibilityTreeRoot.appendChild(this._liveRegion)
- }
- , 0))
- }
- _clearLiveRegion() {
- this._liveRegion.textContent = "",
- this._liveRegionLineCount = 0,
- _.isMac && (0,
- o.removeElementFromParent)(this._liveRegion)
- }
- _onKey(e) {
- this._clearLiveRegion(),
- this._charsToConsume.push(e)
- }
- _refreshRows(e, i) {
- this._renderRowsDebouncer.refresh(e, i, this._terminal.rows)
- }
- _renderRows(e, i) {
- const c = this._terminal.buffer
- , g = c.lines.length.toString();
- for (let v = e; v <= i; v++) {
- const S = c.translateBufferLineToString(c.ydisp + v, !0)
- , u = (c.ydisp + v + 1).toString()
- , m = this._rowElements[v];
- m && (S.length === 0 ? m.innerText = "\xA0" : m.textContent = S,
- m.setAttribute("aria-posinset", u),
- m.setAttribute("aria-setsize", g))
- }
- this._announceCharacters()
- }
- _refreshRowsDimensions() {
- if (this._renderService.dimensions.actualCellHeight) {
- this._rowElements.length !== this._terminal.rows && this._onResize(this._terminal.rows);
- for (let e = 0; e < this._terminal.rows; e++)
- this._refreshRowDimensions(this._rowElements[e])
- }
- }
- _refreshRowDimensions(e) {
- e.style.height = `${this._renderService.dimensions.actualCellHeight}px`
- }
- _announceCharacters() {
- this._charsToAnnounce.length !== 0 && (this._liveRegion.textContent += this._charsToAnnounce,
- this._charsToAnnounce = "")
- }
- }
- r.AccessibilityManager = t
- }
- ,
- 3614: (x, r) => {
- function a(f) {
- return f.replace(/\r?\n/g, "\r")
- }
- function n(f, d) {
- return d ? "\x1B[200~" + f + "\x1B[201~" : f
- }
- function _(f, d, l) {
- f = n(f = a(f), l.decPrivateModes.bracketedPasteMode),
- l.triggerDataEvent(f, !0),
- d.value = ""
- }
- function h(f, d, l) {
- const o = l.getBoundingClientRect()
- , t = f.clientX - o.left - 10
- , s = f.clientY - o.top - 10;
- d.style.width = "20px",
- d.style.height = "20px",
- d.style.left = `${t}px`,
- d.style.top = `${s}px`,
- d.style.zIndex = "1000",
- d.focus()
- }
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.rightClickHandler = r.moveTextAreaUnderMouseCursor = r.paste = r.handlePasteEvent = r.copyHandler = r.bracketTextForPaste = r.prepareTextForTerminal = void 0,
- r.prepareTextForTerminal = a,
- r.bracketTextForPaste = n,
- r.copyHandler = function (f, d) {
- f.clipboardData && f.clipboardData.setData("text/plain", d.selectionText),
- f.preventDefault()
- }
- ,
- r.handlePasteEvent = function (f, d, l) {
- f.stopPropagation(),
- f.clipboardData && _(f.clipboardData.getData("text/plain"), d, l)
- }
- ,
- r.paste = _,
- r.moveTextAreaUnderMouseCursor = h,
- r.rightClickHandler = function (f, d, l, o, t) {
- h(f, d, l),
- t && o.rightClickSelect(f),
- d.value = o.selectionText,
- d.select()
- }
- }
- ,
- 7239: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.ColorContrastCache = void 0;
- const n = a(1505);
- r.ColorContrastCache = class {
- constructor() {
- this._color = new n.TwoKeyMap,
- this._css = new n.TwoKeyMap
- }
- setCss(_, h, f) {
- this._css.set(_, h, f)
- }
- getCss(_, h) {
- return this._css.get(_, h)
- }
- setColor(_, h, f) {
- this._color.set(_, h, f)
- }
- getColor(_, h) {
- return this._color.get(_, h)
- }
- clear() {
- this._color.clear(),
- this._css.clear()
- }
- }
- }
- ,
- 5680: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.ColorManager = r.DEFAULT_ANSI_COLORS = void 0;
- const n = a(8055)
- , _ = a(7239)
- , h = n.css.toColor("#ffffff")
- , f = n.css.toColor("#000000")
- , d = n.css.toColor("#ffffff")
- , l = n.css.toColor("#000000")
- , o = {
- css: "rgba(255, 255, 255, 0.3)",
- rgba: 4294967117
- };
- r.DEFAULT_ANSI_COLORS = Object.freeze((() => {
- const t = [n.css.toColor("#2e3436"), n.css.toColor("#cc0000"), n.css.toColor("#4e9a06"), n.css.toColor("#c4a000"), n.css.toColor("#3465a4"), n.css.toColor("#75507b"), n.css.toColor("#06989a"), n.css.toColor("#d3d7cf"), n.css.toColor("#555753"), n.css.toColor("#ef2929"), n.css.toColor("#8ae234"), n.css.toColor("#fce94f"), n.css.toColor("#729fcf"), n.css.toColor("#ad7fa8"), n.css.toColor("#34e2e2"), n.css.toColor("#eeeeec")]
- , s = [0, 95, 135, 175, 215, 255];
- for (let e = 0; e < 216; e++) {
- const i = s[e / 36 % 6 | 0]
- , c = s[e / 6 % 6 | 0]
- , g = s[e % 6];
- t.push({
- css: n.channels.toCss(i, c, g),
- rgba: n.channels.toRgba(i, c, g)
- })
- }
- for (let e = 0; e < 24; e++) {
- const i = 8 + 10 * e;
- t.push({
- css: n.channels.toCss(i, i, i),
- rgba: n.channels.toRgba(i, i, i)
- })
- }
- return t
- }
- )()),
- r.ColorManager = class {
- constructor(t, s) {
- this.allowTransparency = s;
- const e = t.createElement("canvas");
- e.width = 1,
- e.height = 1;
- const i = e.getContext("2d");
- if (!i)
- throw new Error("Could not get rendering context");
- this._ctx = i,
- this._ctx.globalCompositeOperation = "copy",
- this._litmusColor = this._ctx.createLinearGradient(0, 0, 1, 1),
- this._contrastCache = new _.ColorContrastCache,
- this.colors = {
- foreground: h,
- background: f,
- cursor: d,
- cursorAccent: l,
- selectionForeground: void 0,
- selectionBackgroundTransparent: o,
- selectionBackgroundOpaque: n.color.blend(f, o),
- selectionInactiveBackgroundTransparent: o,
- selectionInactiveBackgroundOpaque: n.color.blend(f, o),
- ansi: r.DEFAULT_ANSI_COLORS.slice(),
- contrastCache: this._contrastCache
- },
- this._updateRestoreColors()
- }
- onOptionsChange(t, s) {
- switch (t) {
- case "minimumContrastRatio":
- this._contrastCache.clear();
- break;
- case "allowTransparency":
- this.allowTransparency = s
- }
- }
- setTheme(t = {}) {
- this.colors.foreground = this._parseColor(t.foreground, h),
- this.colors.background = this._parseColor(t.background, f),
- this.colors.cursor = this._parseColor(t.cursor, d, !0),
- this.colors.cursorAccent = this._parseColor(t.cursorAccent, l, !0),
- this.colors.selectionBackgroundTransparent = this._parseColor(t.selectionBackground, o, !0),
- this.colors.selectionBackgroundOpaque = n.color.blend(this.colors.background, this.colors.selectionBackgroundTransparent),
- this.colors.selectionInactiveBackgroundTransparent = this._parseColor(t.selectionInactiveBackground, this.colors.selectionBackgroundTransparent, !0),
- this.colors.selectionInactiveBackgroundOpaque = n.color.blend(this.colors.background, this.colors.selectionInactiveBackgroundTransparent);
- const s = {
- css: "",
- rgba: 0
- };
- if (this.colors.selectionForeground = t.selectionForeground ? this._parseColor(t.selectionForeground, s) : void 0,
- this.colors.selectionForeground === s && (this.colors.selectionForeground = void 0),
- n.color.isOpaque(this.colors.selectionBackgroundTransparent) && (this.colors.selectionBackgroundTransparent = n.color.opacity(this.colors.selectionBackgroundTransparent, .3)),
- n.color.isOpaque(this.colors.selectionInactiveBackgroundTransparent) && (this.colors.selectionInactiveBackgroundTransparent = n.color.opacity(this.colors.selectionInactiveBackgroundTransparent, .3)),
- this.colors.ansi = r.DEFAULT_ANSI_COLORS.slice(),
- this.colors.ansi[0] = this._parseColor(t.black, r.DEFAULT_ANSI_COLORS[0]),
- this.colors.ansi[1] = this._parseColor(t.red, r.DEFAULT_ANSI_COLORS[1]),
- this.colors.ansi[2] = this._parseColor(t.green, r.DEFAULT_ANSI_COLORS[2]),
- this.colors.ansi[3] = this._parseColor(t.yellow, r.DEFAULT_ANSI_COLORS[3]),
- this.colors.ansi[4] = this._parseColor(t.blue, r.DEFAULT_ANSI_COLORS[4]),
- this.colors.ansi[5] = this._parseColor(t.magenta, r.DEFAULT_ANSI_COLORS[5]),
- this.colors.ansi[6] = this._parseColor(t.cyan, r.DEFAULT_ANSI_COLORS[6]),
- this.colors.ansi[7] = this._parseColor(t.white, r.DEFAULT_ANSI_COLORS[7]),
- this.colors.ansi[8] = this._parseColor(t.brightBlack, r.DEFAULT_ANSI_COLORS[8]),
- this.colors.ansi[9] = this._parseColor(t.brightRed, r.DEFAULT_ANSI_COLORS[9]),
- this.colors.ansi[10] = this._parseColor(t.brightGreen, r.DEFAULT_ANSI_COLORS[10]),
- this.colors.ansi[11] = this._parseColor(t.brightYellow, r.DEFAULT_ANSI_COLORS[11]),
- this.colors.ansi[12] = this._parseColor(t.brightBlue, r.DEFAULT_ANSI_COLORS[12]),
- this.colors.ansi[13] = this._parseColor(t.brightMagenta, r.DEFAULT_ANSI_COLORS[13]),
- this.colors.ansi[14] = this._parseColor(t.brightCyan, r.DEFAULT_ANSI_COLORS[14]),
- this.colors.ansi[15] = this._parseColor(t.brightWhite, r.DEFAULT_ANSI_COLORS[15]),
- t.extendedAnsi) {
- const e = Math.min(this.colors.ansi.length - 16, t.extendedAnsi.length);
- for (let i = 0; i < e; i++)
- this.colors.ansi[i + 16] = this._parseColor(t.extendedAnsi[i], r.DEFAULT_ANSI_COLORS[i + 16])
- }
- this._contrastCache.clear(),
- this._updateRestoreColors()
- }
- restoreColor(t) {
- if (t !== void 0)
- switch (t) {
- case 256:
- this.colors.foreground = this._restoreColors.foreground;
- break;
- case 257:
- this.colors.background = this._restoreColors.background;
- break;
- case 258:
- this.colors.cursor = this._restoreColors.cursor;
- break;
- default:
- this.colors.ansi[t] = this._restoreColors.ansi[t]
- }
- else
- for (let s = 0; s < this._restoreColors.ansi.length; ++s)
- this.colors.ansi[s] = this._restoreColors.ansi[s]
- }
- _updateRestoreColors() {
- this._restoreColors = {
- foreground: this.colors.foreground,
- background: this.colors.background,
- cursor: this.colors.cursor,
- ansi: this.colors.ansi.slice()
- }
- }
- _parseColor(t, s, e = this.allowTransparency) {
- if (t === void 0)
- return s;
- if (this._ctx.fillStyle = this._litmusColor,
- this._ctx.fillStyle = t,
- typeof this._ctx.fillStyle != "string")
- return console.warn(`Color: ${t} is invalid using fallback ${s.css}`),
- s;
- this._ctx.fillRect(0, 0, 1, 1);
- const i = this._ctx.getImageData(0, 0, 1, 1).data;
- if (i[3] !== 255) {
- if (!e)
- return console.warn(`Color: ${t} is using transparency, but allowTransparency is false. Using fallback ${s.css}.`),
- s;
- const [c, g, v, S] = this._ctx.fillStyle.substring(5, this._ctx.fillStyle.length - 1).split(",").map(m => Number(m))
- , u = Math.round(255 * S);
- return {
- rgba: n.channels.toRgba(c, g, v, u),
- css: t
- }
- }
- return {
- css: this._ctx.fillStyle,
- rgba: n.channels.toRgba(i[0], i[1], i[2], i[3])
- }
- }
- }
- }
- ,
- 9631: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.removeElementFromParent = void 0,
- r.removeElementFromParent = function (...a) {
- var n;
- for (const _ of a)
- (n = _ == null ? void 0 : _.parentElement) === null || n === void 0 || n.removeChild(_)
- }
- }
- ,
- 3656: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.addDisposableDomListener = void 0,
- r.addDisposableDomListener = function (a, n, _, h) {
- a.addEventListener(n, _, h);
- let f = !1;
- return {
- dispose: () => {
- f || (f = !0,
- a.removeEventListener(n, _, h))
- }
- }
- }
- }
- ,
- 6465: function (x, r, a) {
- var n = this && this.__decorate || function (t, s, e, i) {
- var c, g = arguments.length, v = g < 3 ? s : i === null ? i = Object.getOwnPropertyDescriptor(s, e) : i;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- v = Reflect.decorate(t, s, e, i);
- else
- for (var S = t.length - 1; S >= 0; S--)
- (c = t[S]) && (v = (g < 3 ? c(v) : g > 3 ? c(s, e, v) : c(s, e)) || v);
- return g > 3 && v && Object.defineProperty(s, e, v),
- v
- }
- , _ = this && this.__param || function (t, s) {
- return function (e, i) {
- s(e, i, t)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.Linkifier2 = void 0;
- const h = a(2585)
- , f = a(8460)
- , d = a(844)
- , l = a(3656);
- let o = class extends d.Disposable {
- constructor(t) {
- super(),
- this._bufferService = t,
- this._linkProviders = [],
- this._linkCacheDisposables = [],
- this._isMouseOut = !0,
- this._activeLine = -1,
- this._onShowLinkUnderline = this.register(new f.EventEmitter),
- this._onHideLinkUnderline = this.register(new f.EventEmitter),
- this.register((0,
- d.getDisposeArrayDisposable)(this._linkCacheDisposables))
- }
- get currentLink() {
- return this._currentLink
- }
- get onShowLinkUnderline() {
- return this._onShowLinkUnderline.event
- }
- get onHideLinkUnderline() {
- return this._onHideLinkUnderline.event
- }
- dispose() {
- super.dispose(),
- this._lastMouseEvent = void 0
- }
- registerLinkProvider(t) {
- return this._linkProviders.push(t),
- {
- dispose: () => {
- const s = this._linkProviders.indexOf(t);
- s !== -1 && this._linkProviders.splice(s, 1)
- }
- }
- }
- attachToDom(t, s, e) {
- this._element = t,
- this._mouseService = s,
- this._renderService = e,
- this.register((0,
- l.addDisposableDomListener)(this._element, "mouseleave", () => {
- this._isMouseOut = !0,
- this._clearCurrentLink()
- }
- )),
- this.register((0,
- l.addDisposableDomListener)(this._element, "mousemove", this._onMouseMove.bind(this))),
- this.register((0,
- l.addDisposableDomListener)(this._element, "mousedown", this._handleMouseDown.bind(this))),
- this.register((0,
- l.addDisposableDomListener)(this._element, "mouseup", this._handleMouseUp.bind(this)))
- }
- _onMouseMove(t) {
- if (this._lastMouseEvent = t,
- !this._element || !this._mouseService)
- return;
- const s = this._positionFromMouseEvent(t, this._element, this._mouseService);
- if (!s)
- return;
- this._isMouseOut = !1;
- const e = t.composedPath();
- for (let i = 0; i < e.length; i++) {
- const c = e[i];
- if (c.classList.contains("xterm"))
- break;
- if (c.classList.contains("xterm-hover"))
- return
- }
- this._lastBufferCell && s.x === this._lastBufferCell.x && s.y === this._lastBufferCell.y || (this._onHover(s),
- this._lastBufferCell = s)
- }
- _onHover(t) {
- if (this._activeLine !== t.y)
- return this._clearCurrentLink(),
- void this._askForLink(t, !1);
- this._currentLink && this._linkAtPosition(this._currentLink.link, t) || (this._clearCurrentLink(),
- this._askForLink(t, !0))
- }
- _askForLink(t, s) {
- var e, i;
- this._activeProviderReplies && s || ((e = this._activeProviderReplies) === null || e === void 0 || e.forEach(g => {
- g == null || g.forEach(v => {
- v.link.dispose && v.link.dispose()
- }
- )
- }
- ),
- this._activeProviderReplies = new Map,
- this._activeLine = t.y);
- let c = !1;
- for (const [g, v] of this._linkProviders.entries())
- s ? !((i = this._activeProviderReplies) === null || i === void 0) && i.get(g) && (c = this._checkLinkProviderResult(g, t, c)) : v.provideLinks(t.y, S => {
- var u, m;
- if (this._isMouseOut)
- return;
- const w = S == null ? void 0 : S.map(R => ({
- link: R
- }));
- (u = this._activeProviderReplies) === null || u === void 0 || u.set(g, w),
- c = this._checkLinkProviderResult(g, t, c),
- ((m = this._activeProviderReplies) === null || m === void 0 ? void 0 : m.size) === this._linkProviders.length && this._removeIntersectingLinks(t.y, this._activeProviderReplies)
- }
- )
- }
- _removeIntersectingLinks(t, s) {
- const e = new Set;
- for (let i = 0; i < s.size; i++) {
- const c = s.get(i);
- if (c)
- for (let g = 0; g < c.length; g++) {
- const v = c[g]
- , S = v.link.range.start.y < t ? 0 : v.link.range.start.x
- , u = v.link.range.end.y > t ? this._bufferService.cols : v.link.range.end.x;
- for (let m = S; m <= u; m++) {
- if (e.has(m)) {
- c.splice(g--, 1);
- break
- }
- e.add(m)
- }
- }
- }
- }
- _checkLinkProviderResult(t, s, e) {
- var i;
- if (!this._activeProviderReplies)
- return e;
- const c = this._activeProviderReplies.get(t);
- let g = !1;
- for (let v = 0; v < t; v++)
- this._activeProviderReplies.has(v) && !this._activeProviderReplies.get(v) || (g = !0);
- if (!g && c) {
- const v = c.find(S => this._linkAtPosition(S.link, s));
- v && (e = !0,
- this._handleNewLink(v))
- }
- if (this._activeProviderReplies.size === this._linkProviders.length && !e)
- for (let v = 0; v < this._activeProviderReplies.size; v++) {
- const S = (i = this._activeProviderReplies.get(v)) === null || i === void 0 ? void 0 : i.find(u => this._linkAtPosition(u.link, s));
- if (S) {
- e = !0,
- this._handleNewLink(S);
- break
- }
- }
- return e
- }
- _handleMouseDown() {
- this._mouseDownLink = this._currentLink
- }
- _handleMouseUp(t) {
- if (!this._element || !this._mouseService || !this._currentLink)
- return;
- const s = this._positionFromMouseEvent(t, this._element, this._mouseService);
- s && this._mouseDownLink === this._currentLink && this._linkAtPosition(this._currentLink.link, s) && this._currentLink.link.activate(t, this._currentLink.link.text)
- }
- _clearCurrentLink(t, s) {
- this._element && this._currentLink && this._lastMouseEvent && (!t || !s || this._currentLink.link.range.start.y >= t && this._currentLink.link.range.end.y <= s) && (this._linkLeave(this._element, this._currentLink.link, this._lastMouseEvent),
- this._currentLink = void 0,
- (0,
- d.disposeArray)(this._linkCacheDisposables))
- }
- _handleNewLink(t) {
- if (!this._element || !this._lastMouseEvent || !this._mouseService)
- return;
- const s = this._positionFromMouseEvent(this._lastMouseEvent, this._element, this._mouseService);
- s && this._linkAtPosition(t.link, s) && (this._currentLink = t,
- this._currentLink.state = {
- decorations: {
- underline: t.link.decorations === void 0 || t.link.decorations.underline,
- pointerCursor: t.link.decorations === void 0 || t.link.decorations.pointerCursor
- },
- isHovered: !0
- },
- this._linkHover(this._element, t.link, this._lastMouseEvent),
- t.link.decorations = {},
- Object.defineProperties(t.link.decorations, {
- pointerCursor: {
- get: () => {
- var e, i;
- return (i = (e = this._currentLink) === null || e === void 0 ? void 0 : e.state) === null || i === void 0 ? void 0 : i.decorations.pointerCursor
- }
- ,
- set: e => {
- var i, c;
- ((i = this._currentLink) === null || i === void 0 ? void 0 : i.state) && this._currentLink.state.decorations.pointerCursor !== e && (this._currentLink.state.decorations.pointerCursor = e,
- this._currentLink.state.isHovered && ((c = this._element) === null || c === void 0 || c.classList.toggle("xterm-cursor-pointer", e)))
- }
- },
- underline: {
- get: () => {
- var e, i;
- return (i = (e = this._currentLink) === null || e === void 0 ? void 0 : e.state) === null || i === void 0 ? void 0 : i.decorations.underline
- }
- ,
- set: e => {
- var i, c, g;
- ((i = this._currentLink) === null || i === void 0 ? void 0 : i.state) && ((g = (c = this._currentLink) === null || c === void 0 ? void 0 : c.state) === null || g === void 0 ? void 0 : g.decorations.underline) !== e && (this._currentLink.state.decorations.underline = e,
- this._currentLink.state.isHovered && this._fireUnderlineEvent(t.link, e))
- }
- }
- }),
- this._renderService && this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(e => {
- const i = e.start === 0 ? 0 : e.start + 1 + this._bufferService.buffer.ydisp;
- this._clearCurrentLink(i, e.end + 1 + this._bufferService.buffer.ydisp)
- }
- )))
- }
- _linkHover(t, s, e) {
- var i;
- !((i = this._currentLink) === null || i === void 0) && i.state && (this._currentLink.state.isHovered = !0,
- this._currentLink.state.decorations.underline && this._fireUnderlineEvent(s, !0),
- this._currentLink.state.decorations.pointerCursor && t.classList.add("xterm-cursor-pointer")),
- s.hover && s.hover(e, s.text)
- }
- _fireUnderlineEvent(t, s) {
- const e = t.range
- , i = this._bufferService.buffer.ydisp
- , c = this._createLinkUnderlineEvent(e.start.x - 1, e.start.y - i - 1, e.end.x, e.end.y - i - 1, void 0);
- (s ? this._onShowLinkUnderline : this._onHideLinkUnderline).fire(c)
- }
- _linkLeave(t, s, e) {
- var i;
- !((i = this._currentLink) === null || i === void 0) && i.state && (this._currentLink.state.isHovered = !1,
- this._currentLink.state.decorations.underline && this._fireUnderlineEvent(s, !1),
- this._currentLink.state.decorations.pointerCursor && t.classList.remove("xterm-cursor-pointer")),
- s.leave && s.leave(e, s.text)
- }
- _linkAtPosition(t, s) {
- const e = t.range.start.y === t.range.end.y
- , i = t.range.start.y < s.y
- , c = t.range.end.y > s.y;
- return (e && t.range.start.x <= s.x && t.range.end.x >= s.x || i && t.range.end.x >= s.x || c && t.range.start.x <= s.x || i && c) && t.range.start.y <= s.y && t.range.end.y >= s.y
- }
- _positionFromMouseEvent(t, s, e) {
- const i = e.getCoords(t, s, this._bufferService.cols, this._bufferService.rows);
- if (i)
- return {
- x: i[0],
- y: i[1] + this._bufferService.buffer.ydisp
- }
- }
- _createLinkUnderlineEvent(t, s, e, i, c) {
- return {
- x1: t,
- y1: s,
- x2: e,
- y2: i,
- cols: this._bufferService.cols,
- fg: c
- }
- }
- }
- ;
- o = n([_(0, h.IBufferService)], o),
- r.Linkifier2 = o
- },
- 9042: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.tooMuchOutput = r.promptLabel = void 0,
- r.promptLabel = "Terminal input",
- r.tooMuchOutput = "Too much output to announce, navigate to rows manually to read"
- }
- ,
- 2962: function (x, r, a) {
- var n = this && this.__decorate || function (o, t, s, e) {
- var i, c = arguments.length, g = c < 3 ? t : e === null ? e = Object.getOwnPropertyDescriptor(t, s) : e;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- g = Reflect.decorate(o, t, s, e);
- else
- for (var v = o.length - 1; v >= 0; v--)
- (i = o[v]) && (g = (c < 3 ? i(g) : c > 3 ? i(t, s, g) : i(t, s)) || g);
- return c > 3 && g && Object.defineProperty(t, s, g),
- g
- }
- , _ = this && this.__param || function (o, t) {
- return function (s, e) {
- t(s, e, o)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.OscLinkProvider = void 0;
- const h = a(511)
- , f = a(2585);
- let d = class {
- constructor(o, t, s) {
- this._bufferService = o,
- this._optionsService = t,
- this._oscLinkService = s
- }
- provideLinks(o, t) {
- var s;
- const e = this._bufferService.buffer.lines.get(o - 1);
- if (!e)
- return void t(void 0);
- const i = []
- , c = this._optionsService.rawOptions.linkHandler
- , g = new h.CellData
- , v = e.getTrimmedLength();
- let S = -1
- , u = -1
- , m = !1;
- for (let w = 0; w < v; w++)
- if (u !== -1 || e.hasContent(w)) {
- if (e.loadCell(w, g),
- g.hasExtendedAttrs() && g.extended.urlId) {
- if (u === -1) {
- u = w,
- S = g.extended.urlId;
- continue
- }
- m = g.extended.urlId !== S
- } else
- u !== -1 && (m = !0);
- if (m || u !== -1 && w === v - 1) {
- const R = (s = this._oscLinkService.getLinkData(S)) === null || s === void 0 ? void 0 : s.uri;
- if (R) {
- const L = {
- start: {
- x: u + 1,
- y: o
- },
- end: {
- x: w + (m || w !== v - 1 ? 0 : 1),
- y: o
- }
- };
- i.push({
- text: R,
- range: L,
- activate: (p, C) => c ? c.activate(p, C, L) : l(0, C),
- hover: (p, C) => {
- var b;
- return (b = c == null ? void 0 : c.hover) === null || b === void 0 ? void 0 : b.call(c, p, C, L)
- }
- ,
- leave: (p, C) => {
- var b;
- return (b = c == null ? void 0 : c.leave) === null || b === void 0 ? void 0 : b.call(c, p, C, L)
- }
- })
- }
- m = !1,
- g.hasExtendedAttrs() && g.extended.urlId ? (u = w,
- S = g.extended.urlId) : (u = -1,
- S = -1)
- }
- }
- t(i)
- }
- }
- ;
- function l(o, t) {
- if (confirm(`Do you want to navigate to ${t}?`)) {
- const s = window.open();
- if (s) {
- try {
- s.opener = null
- } catch { }
- s.location.href = t
- } else
- console.warn("Opening link blocked as opener could not be cleared")
- }
- }
- d = n([_(0, f.IBufferService), _(1, f.IOptionsService), _(2, f.IOscLinkService)], d),
- r.OscLinkProvider = d
- },
- 6193: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.RenderDebouncer = void 0,
- r.RenderDebouncer = class {
- constructor(a, n) {
- this._parentWindow = a,
- this._renderCallback = n,
- this._refreshCallbacks = []
- }
- dispose() {
- this._animationFrame && (this._parentWindow.cancelAnimationFrame(this._animationFrame),
- this._animationFrame = void 0)
- }
- addRefreshCallback(a) {
- return this._refreshCallbacks.push(a),
- this._animationFrame || (this._animationFrame = this._parentWindow.requestAnimationFrame(() => this._innerRefresh())),
- this._animationFrame
- }
- refresh(a, n, _) {
- this._rowCount = _,
- a = a !== void 0 ? a : 0,
- n = n !== void 0 ? n : this._rowCount - 1,
- this._rowStart = this._rowStart !== void 0 ? Math.min(this._rowStart, a) : a,
- this._rowEnd = this._rowEnd !== void 0 ? Math.max(this._rowEnd, n) : n,
- this._animationFrame || (this._animationFrame = this._parentWindow.requestAnimationFrame(() => this._innerRefresh()))
- }
- _innerRefresh() {
- if (this._animationFrame = void 0,
- this._rowStart === void 0 || this._rowEnd === void 0 || this._rowCount === void 0)
- return void this._runRefreshCallbacks();
- const a = Math.max(this._rowStart, 0)
- , n = Math.min(this._rowEnd, this._rowCount - 1);
- this._rowStart = void 0,
- this._rowEnd = void 0,
- this._renderCallback(a, n),
- this._runRefreshCallbacks()
- }
- _runRefreshCallbacks() {
- for (const a of this._refreshCallbacks)
- a(0);
- this._refreshCallbacks = []
- }
- }
- }
- ,
- 5596: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.ScreenDprMonitor = void 0;
- const n = a(844);
- class _ extends n.Disposable {
- constructor(f) {
- super(),
- this._parentWindow = f,
- this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio
- }
- setListener(f) {
- this._listener && this.clearListener(),
- this._listener = f,
- this._outerListener = () => {
- this._listener && (this._listener(this._parentWindow.devicePixelRatio, this._currentDevicePixelRatio),
- this._updateDpr())
- }
- ,
- this._updateDpr()
- }
- dispose() {
- super.dispose(),
- this.clearListener()
- }
- _updateDpr() {
- var f;
- this._outerListener && ((f = this._resolutionMediaMatchList) === null || f === void 0 || f.removeListener(this._outerListener),
- this._currentDevicePixelRatio = this._parentWindow.devicePixelRatio,
- this._resolutionMediaMatchList = this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),
- this._resolutionMediaMatchList.addListener(this._outerListener))
- }
- clearListener() {
- this._resolutionMediaMatchList && this._listener && this._outerListener && (this._resolutionMediaMatchList.removeListener(this._outerListener),
- this._resolutionMediaMatchList = void 0,
- this._listener = void 0,
- this._outerListener = void 0)
- }
- }
- r.ScreenDprMonitor = _
- }
- ,
- 3236: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.Terminal = void 0;
- const n = a(2950)
- , _ = a(1680)
- , h = a(3614)
- , f = a(2584)
- , d = a(5435)
- , l = a(9312)
- , o = a(6114)
- , t = a(3656)
- , s = a(9042)
- , e = a(4567)
- , i = a(1296)
- , c = a(7399)
- , g = a(8460)
- , v = a(8437)
- , S = a(5680)
- , u = a(3230)
- , m = a(4725)
- , w = a(428)
- , R = a(8934)
- , L = a(6465)
- , p = a(5114)
- , C = a(8969)
- , b = a(8055)
- , E = a(4269)
- , A = a(5941)
- , H = a(3107)
- , j = a(5744)
- , $ = a(9074)
- , P = a(2585)
- , N = a(2962)
- , y = typeof window < "u" ? window.document : null;
- class T extends C.CoreTerminal {
- constructor(k = {}) {
- super(k),
- this.browser = o,
- this._keyDownHandled = !1,
- this._keyDownSeen = !1,
- this._keyPressHandled = !1,
- this._unprocessedDeadKey = !1,
- this._onCursorMove = new g.EventEmitter,
- this._onKey = new g.EventEmitter,
- this._onRender = new g.EventEmitter,
- this._onSelectionChange = new g.EventEmitter,
- this._onTitleChange = new g.EventEmitter,
- this._onBell = new g.EventEmitter,
- this._onFocus = new g.EventEmitter,
- this._onBlur = new g.EventEmitter,
- this._onA11yCharEmitter = new g.EventEmitter,
- this._onA11yTabEmitter = new g.EventEmitter,
- this._setup(),
- this.linkifier2 = this.register(this._instantiationService.createInstance(L.Linkifier2)),
- this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(N.OscLinkProvider)),
- this._decorationService = this._instantiationService.createInstance($.DecorationService),
- this._instantiationService.setService(P.IDecorationService, this._decorationService),
- this.register(this._inputHandler.onRequestBell(() => this._onBell.fire())),
- this.register(this._inputHandler.onRequestRefreshRows((D, B) => this.refresh(D, B))),
- this.register(this._inputHandler.onRequestSendFocus(() => this._reportFocus())),
- this.register(this._inputHandler.onRequestReset(() => this.reset())),
- this.register(this._inputHandler.onRequestWindowsOptionsReport(D => this._reportWindowsOptions(D))),
- this.register(this._inputHandler.onColor(D => this._handleColorEvent(D))),
- this.register((0,
- g.forwardEvent)(this._inputHandler.onCursorMove, this._onCursorMove)),
- this.register((0,
- g.forwardEvent)(this._inputHandler.onTitleChange, this._onTitleChange)),
- this.register((0,
- g.forwardEvent)(this._inputHandler.onA11yChar, this._onA11yCharEmitter)),
- this.register((0,
- g.forwardEvent)(this._inputHandler.onA11yTab, this._onA11yTabEmitter)),
- this.register(this._bufferService.onResize(D => this._afterResize(D.cols, D.rows)))
- }
- get onCursorMove() {
- return this._onCursorMove.event
- }
- get onKey() {
- return this._onKey.event
- }
- get onRender() {
- return this._onRender.event
- }
- get onSelectionChange() {
- return this._onSelectionChange.event
- }
- get onTitleChange() {
- return this._onTitleChange.event
- }
- get onBell() {
- return this._onBell.event
- }
- get onFocus() {
- return this._onFocus.event
- }
- get onBlur() {
- return this._onBlur.event
- }
- get onA11yChar() {
- return this._onA11yCharEmitter.event
- }
- get onA11yTab() {
- return this._onA11yTabEmitter.event
- }
- _handleColorEvent(k) {
- var D, B;
- if (this._colorManager) {
- for (const I of k) {
- let F, M = "";
- switch (I.index) {
- case 256:
- F = "foreground",
- M = "10";
- break;
- case 257:
- F = "background",
- M = "11";
- break;
- case 258:
- F = "cursor",
- M = "12";
- break;
- default:
- F = "ansi",
- M = "4;" + I.index
- }
- switch (I.type) {
- case 0:
- const X = b.color.toColorRGB(F === "ansi" ? this._colorManager.colors.ansi[I.index] : this._colorManager.colors[F]);
- this.coreService.triggerDataEvent(`${f.C0.ESC}]${M};${(0,
- A.toRgbString)(X)}${f.C1_ESCAPED.ST}`);
- break;
- case 1:
- F === "ansi" ? this._colorManager.colors.ansi[I.index] = b.rgba.toColor(...I.color) : this._colorManager.colors[F] = b.rgba.toColor(...I.color);
- break;
- case 2:
- this._colorManager.restoreColor(I.index)
- }
- }
- (D = this._renderService) === null || D === void 0 || D.setColors(this._colorManager.colors),
- (B = this.viewport) === null || B === void 0 || B.onThemeChange(this._colorManager.colors)
- }
- }
- dispose() {
- var k, D, B;
- this._isDisposed || (super.dispose(),
- (k = this._renderService) === null || k === void 0 || k.dispose(),
- this._customKeyEventHandler = void 0,
- this.write = () => { }
- ,
- (B = (D = this.element) === null || D === void 0 ? void 0 : D.parentNode) === null || B === void 0 || B.removeChild(this.element))
- }
- _setup() {
- super._setup(),
- this._customKeyEventHandler = void 0
- }
- get buffer() {
- return this.buffers.active
- }
- focus() {
- this.textarea && this.textarea.focus({
- preventScroll: !0
- })
- }
- _updateOptions(k) {
- var D, B, I, F;
- switch (super._updateOptions(k),
- k) {
- case "fontFamily":
- case "fontSize":
- (D = this._renderService) === null || D === void 0 || D.clear(),
- (B = this._charSizeService) === null || B === void 0 || B.measure();
- break;
- case "cursorBlink":
- case "cursorStyle":
- this.refresh(this.buffer.y, this.buffer.y);
- break;
- case "customGlyphs":
- case "drawBoldTextInBrightColors":
- case "letterSpacing":
- case "lineHeight":
- case "fontWeight":
- case "fontWeightBold":
- case "minimumContrastRatio":
- this._renderService && (this._renderService.clear(),
- this._renderService.onResize(this.cols, this.rows),
- this.refresh(0, this.rows - 1));
- break;
- case "scrollback":
- (I = this.viewport) === null || I === void 0 || I.syncScrollArea();
- break;
- case "screenReaderMode":
- this.optionsService.rawOptions.screenReaderMode ? !this._accessibilityManager && this._renderService && (this._accessibilityManager = new e.AccessibilityManager(this, this._renderService)) : ((F = this._accessibilityManager) === null || F === void 0 || F.dispose(),
- this._accessibilityManager = void 0);
- break;
- case "tabStopWidth":
- this.buffers.setupTabStops();
- break;
- case "theme":
- this._setTheme(this.optionsService.rawOptions.theme)
- }
- }
- _onTextAreaFocus(k) {
- this.coreService.decPrivateModes.sendFocus && this.coreService.triggerDataEvent(f.C0.ESC + "[I"),
- this.updateCursorStyle(k),
- this.element.classList.add("focus"),
- this._showCursor(),
- this._onFocus.fire()
- }
- blur() {
- var k;
- return (k = this.textarea) === null || k === void 0 ? void 0 : k.blur()
- }
- _onTextAreaBlur() {
- this.textarea.value = "",
- this.refresh(this.buffer.y, this.buffer.y),
- this.coreService.decPrivateModes.sendFocus && this.coreService.triggerDataEvent(f.C0.ESC + "[O"),
- this.element.classList.remove("focus"),
- this._onBlur.fire()
- }
- _syncTextArea() {
- if (!this.textarea || !this.buffer.isCursorInViewport || this._compositionHelper.isComposing || !this._renderService)
- return;
- const k = this.buffer.ybase + this.buffer.y
- , D = this.buffer.lines.get(k);
- if (!D)
- return;
- const B = Math.min(this.buffer.x, this.cols - 1)
- , I = this._renderService.dimensions.actualCellHeight
- , F = D.getWidth(B)
- , M = this._renderService.dimensions.actualCellWidth * F
- , X = this.buffer.y * this._renderService.dimensions.actualCellHeight
- , K = B * this._renderService.dimensions.actualCellWidth;
- this.textarea.style.left = K + "px",
- this.textarea.style.top = X + "px",
- this.textarea.style.width = M + "px",
- this.textarea.style.height = I + "px",
- this.textarea.style.lineHeight = I + "px",
- this.textarea.style.zIndex = "-5"
- }
- _initGlobal() {
- this._bindKeys(),
- this.register((0,
- t.addDisposableDomListener)(this.element, "copy", D => {
- this.hasSelection() && (0,
- h.copyHandler)(D, this._selectionService)
- }
- ));
- const k = D => (0,
- h.handlePasteEvent)(D, this.textarea, this.coreService);
- this.register((0,
- t.addDisposableDomListener)(this.textarea, "paste", k)),
- this.register((0,
- t.addDisposableDomListener)(this.element, "paste", k)),
- o.isFirefox ? this.register((0,
- t.addDisposableDomListener)(this.element, "mousedown", D => {
- D.button === 2 && (0,
- h.rightClickHandler)(D, this.textarea, this.screenElement, this._selectionService, this.options.rightClickSelectsWord)
- }
- )) : this.register((0,
- t.addDisposableDomListener)(this.element, "contextmenu", D => {
- (0,
- h.rightClickHandler)(D, this.textarea, this.screenElement, this._selectionService, this.options.rightClickSelectsWord)
- }
- )),
- o.isLinux && this.register((0,
- t.addDisposableDomListener)(this.element, "auxclick", D => {
- D.button === 1 && (0,
- h.moveTextAreaUnderMouseCursor)(D, this.textarea, this.screenElement)
- }
- ))
- }
- _bindKeys() {
- this.register((0,
- t.addDisposableDomListener)(this.textarea, "keyup", k => this._keyUp(k), !0)),
- this.register((0,
- t.addDisposableDomListener)(this.textarea, "keydown", k => this._keyDown(k), !0)),
- this.register((0,
- t.addDisposableDomListener)(this.textarea, "keypress", k => this._keyPress(k), !0)),
- this.register((0,
- t.addDisposableDomListener)(this.textarea, "compositionstart", () => this._compositionHelper.compositionstart())),
- this.register((0,
- t.addDisposableDomListener)(this.textarea, "compositionupdate", k => this._compositionHelper.compositionupdate(k))),
- this.register((0,
- t.addDisposableDomListener)(this.textarea, "compositionend", () => this._compositionHelper.compositionend())),
- this.register((0,
- t.addDisposableDomListener)(this.textarea, "input", k => this._inputEvent(k), !0)),
- this.register(this.onRender(() => this._compositionHelper.updateCompositionElements()))
- }
- open(k) {
- var D;
- if (!k)
- throw new Error("Terminal requires a parent element.");
- k.isConnected || this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),
- this._document = k.ownerDocument,
- this.element = this._document.createElement("div"),
- this.element.dir = "ltr",
- this.element.classList.add("terminal"),
- this.element.classList.add("xterm"),
- this.element.setAttribute("tabindex", "0"),
- k.appendChild(this.element);
- const B = y.createDocumentFragment();
- this._viewportElement = y.createElement("div"),
- this._viewportElement.classList.add("xterm-viewport"),
- B.appendChild(this._viewportElement),
- this._viewportScrollArea = y.createElement("div"),
- this._viewportScrollArea.classList.add("xterm-scroll-area"),
- this._viewportElement.appendChild(this._viewportScrollArea),
- this.screenElement = y.createElement("div"),
- this.screenElement.classList.add("xterm-screen"),
- this._helperContainer = y.createElement("div"),
- this._helperContainer.classList.add("xterm-helpers"),
- this.screenElement.appendChild(this._helperContainer),
- B.appendChild(this.screenElement),
- this.textarea = y.createElement("textarea"),
- this.textarea.classList.add("xterm-helper-textarea"),
- this.textarea.setAttribute("aria-label", s.promptLabel),
- this.textarea.setAttribute("aria-multiline", "false"),
- this.textarea.setAttribute("autocorrect", "off"),
- this.textarea.setAttribute("autocapitalize", "off"),
- this.textarea.setAttribute("spellcheck", "false"),
- this.textarea.tabIndex = 0,
- this.register((0,
- t.addDisposableDomListener)(this.textarea, "focus", F => this._onTextAreaFocus(F))),
- this.register((0,
- t.addDisposableDomListener)(this.textarea, "blur", () => this._onTextAreaBlur())),
- this._helperContainer.appendChild(this.textarea),
- this._coreBrowserService = this._instantiationService.createInstance(p.CoreBrowserService, this.textarea, (D = this._document.defaultView) !== null && D !== void 0 ? D : window),
- this._instantiationService.setService(m.ICoreBrowserService, this._coreBrowserService),
- this._charSizeService = this._instantiationService.createInstance(w.CharSizeService, this._document, this._helperContainer),
- this._instantiationService.setService(m.ICharSizeService, this._charSizeService),
- this._theme = this.options.theme || this._theme,
- this._colorManager = new S.ColorManager(y, this.options.allowTransparency),
- this.register(this.optionsService.onOptionChange(F => this._colorManager.onOptionsChange(F, this.optionsService.rawOptions[F]))),
- this._colorManager.setTheme(this._theme),
- this._characterJoinerService = this._instantiationService.createInstance(E.CharacterJoinerService),
- this._instantiationService.setService(m.ICharacterJoinerService, this._characterJoinerService);
- const I = this._createRenderer();
- this._renderService = this.register(this._instantiationService.createInstance(u.RenderService, I, this.rows, this.screenElement)),
- this._instantiationService.setService(m.IRenderService, this._renderService),
- this.register(this._renderService.onRenderedViewportChange(F => this._onRender.fire(F))),
- this.onResize(F => this._renderService.resize(F.cols, F.rows)),
- this._compositionView = y.createElement("div"),
- this._compositionView.classList.add("composition-view"),
- this._compositionHelper = this._instantiationService.createInstance(n.CompositionHelper, this.textarea, this._compositionView),
- this._helperContainer.appendChild(this._compositionView),
- this.element.appendChild(B),
- this._mouseService = this._instantiationService.createInstance(R.MouseService),
- this._instantiationService.setService(m.IMouseService, this._mouseService),
- this.viewport = this._instantiationService.createInstance(_.Viewport, F => this.scrollLines(F, !0, 1), this._viewportElement, this._viewportScrollArea, this.element),
- this.viewport.onThemeChange(this._colorManager.colors),
- this.register(this._inputHandler.onRequestSyncScrollBar(() => this.viewport.syncScrollArea())),
- this.register(this.viewport),
- this.register(this.onCursorMove(() => {
- this._renderService.onCursorMove(),
- this._syncTextArea()
- }
- )),
- this.register(this.onResize(() => this._renderService.onResize(this.cols, this.rows))),
- this.register(this.onBlur(() => this._renderService.onBlur())),
- this.register(this.onFocus(() => this._renderService.onFocus())),
- this.register(this._renderService.onDimensionsChange(() => this.viewport.syncScrollArea())),
- this._selectionService = this.register(this._instantiationService.createInstance(l.SelectionService, this.element, this.screenElement, this.linkifier2)),
- this._instantiationService.setService(m.ISelectionService, this._selectionService),
- this.register(this._selectionService.onRequestScrollLines(F => this.scrollLines(F.amount, F.suppressScrollEvent))),
- this.register(this._selectionService.onSelectionChange(() => this._onSelectionChange.fire())),
- this.register(this._selectionService.onRequestRedraw(F => this._renderService.onSelectionChanged(F.start, F.end, F.columnSelectMode))),
- this.register(this._selectionService.onLinuxMouseSelection(F => {
- this.textarea.value = F,
- this.textarea.focus(),
- this.textarea.select()
- }
- )),
- this.register(this._onScroll.event(F => {
- this.viewport.syncScrollArea(),
- this._selectionService.refresh()
- }
- )),
- this.register((0,
- t.addDisposableDomListener)(this._viewportElement, "scroll", () => this._selectionService.refresh())),
- this.linkifier2.attachToDom(this.screenElement, this._mouseService, this._renderService),
- this.register(this._instantiationService.createInstance(H.BufferDecorationRenderer, this.screenElement)),
- this.register((0,
- t.addDisposableDomListener)(this.element, "mousedown", F => this._selectionService.onMouseDown(F))),
- this.coreMouseService.areMouseEventsActive ? (this._selectionService.disable(),
- this.element.classList.add("enable-mouse-events")) : this._selectionService.enable(),
- this.options.screenReaderMode && (this._accessibilityManager = new e.AccessibilityManager(this, this._renderService)),
- this.options.overviewRulerWidth && (this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(j.OverviewRulerRenderer, this._viewportElement, this.screenElement))),
- this.optionsService.onOptionChange(() => {
- !this._overviewRulerRenderer && this.options.overviewRulerWidth && this._viewportElement && this.screenElement && (this._overviewRulerRenderer = this.register(this._instantiationService.createInstance(j.OverviewRulerRenderer, this._viewportElement, this.screenElement)))
- }
- ),
- this._charSizeService.measure(),
- this.refresh(0, this.rows - 1),
- this._initGlobal(),
- this.bindMouse()
- }
- _createRenderer() {
- return this._instantiationService.createInstance(i.DomRenderer, this._colorManager.colors, this.element, this.screenElement, this._viewportElement, this.linkifier2)
- }
- _setTheme(k) {
- var D, B, I;
- this._theme = k,
- (D = this._colorManager) === null || D === void 0 || D.setTheme(k),
- (B = this._renderService) === null || B === void 0 || B.setColors(this._colorManager.colors),
- (I = this.viewport) === null || I === void 0 || I.onThemeChange(this._colorManager.colors)
- }
- bindMouse() {
- const k = this
- , D = this.element;
- function B(M) {
- const X = k._mouseService.getMouseReportCoords(M, k.screenElement);
- if (!X)
- return !1;
- let K, Z;
- switch (M.overrideType || M.type) {
- case "mousemove":
- Z = 32,
- M.buttons === void 0 ? (K = 3,
- M.button !== void 0 && (K = M.button < 3 ? M.button : 3)) : K = 1 & M.buttons ? 0 : 4 & M.buttons ? 1 : 2 & M.buttons ? 2 : 3;
- break;
- case "mouseup":
- Z = 0,
- K = M.button < 3 ? M.button : 3;
- break;
- case "mousedown":
- Z = 1,
- K = M.button < 3 ? M.button : 3;
- break;
- case "wheel":
- if (k.viewport.getLinesScrolled(M) === 0)
- return !1;
- Z = M.deltaY < 0 ? 0 : 1,
- K = 4;
- break;
- default:
- return !1
- }
- return !(Z === void 0 || K === void 0 || K > 4) && k.coreMouseService.triggerMouseEvent({
- col: X.col,
- row: X.row,
- x: X.x,
- y: X.y,
- button: K,
- action: Z,
- ctrl: M.ctrlKey,
- alt: M.altKey,
- shift: M.shiftKey
- })
- }
- const I = {
- mouseup: null,
- wheel: null,
- mousedrag: null,
- mousemove: null
- }
- , F = {
- mouseup: M => (B(M),
- M.buttons || (this._document.removeEventListener("mouseup", I.mouseup),
- I.mousedrag && this._document.removeEventListener("mousemove", I.mousedrag)),
- this.cancel(M)),
- wheel: M => (B(M),
- this.cancel(M, !0)),
- mousedrag: M => {
- M.buttons && B(M)
- }
- ,
- mousemove: M => {
- M.buttons || B(M)
- }
- };
- this.register(this.coreMouseService.onProtocolChange(M => {
- M ? (this.optionsService.rawOptions.logLevel === "debug" && this._logService.debug("Binding to mouse events:", this.coreMouseService.explainEvents(M)),
- this.element.classList.add("enable-mouse-events"),
- this._selectionService.disable()) : (this._logService.debug("Unbinding from mouse events."),
- this.element.classList.remove("enable-mouse-events"),
- this._selectionService.enable()),
- 8 & M ? I.mousemove || (D.addEventListener("mousemove", F.mousemove),
- I.mousemove = F.mousemove) : (D.removeEventListener("mousemove", I.mousemove),
- I.mousemove = null),
- 16 & M ? I.wheel || (D.addEventListener("wheel", F.wheel, {
- passive: !1
- }),
- I.wheel = F.wheel) : (D.removeEventListener("wheel", I.wheel),
- I.wheel = null),
- 2 & M ? I.mouseup || (I.mouseup = F.mouseup) : (this._document.removeEventListener("mouseup", I.mouseup),
- I.mouseup = null),
- 4 & M ? I.mousedrag || (I.mousedrag = F.mousedrag) : (this._document.removeEventListener("mousemove", I.mousedrag),
- I.mousedrag = null)
- }
- )),
- this.coreMouseService.activeProtocol = this.coreMouseService.activeProtocol,
- this.register((0,
- t.addDisposableDomListener)(D, "mousedown", M => {
- if (M.preventDefault(),
- this.focus(),
- this.coreMouseService.areMouseEventsActive && !this._selectionService.shouldForceSelection(M))
- return B(M),
- I.mouseup && this._document.addEventListener("mouseup", I.mouseup),
- I.mousedrag && this._document.addEventListener("mousemove", I.mousedrag),
- this.cancel(M)
- }
- )),
- this.register((0,
- t.addDisposableDomListener)(D, "wheel", M => {
- if (!I.wheel) {
- if (!this.buffer.hasScrollback) {
- const X = this.viewport.getLinesScrolled(M);
- if (X === 0)
- return;
- const K = f.C0.ESC + (this.coreService.decPrivateModes.applicationCursorKeys ? "O" : "[") + (M.deltaY < 0 ? "A" : "B");
- let Z = "";
- for (let ve = 0; ve < Math.abs(X); ve++)
- Z += K;
- return this.coreService.triggerDataEvent(Z, !0),
- this.cancel(M, !0)
- }
- return this.viewport.onWheel(M) ? this.cancel(M) : void 0
- }
- }
- , {
- passive: !1
- })),
- this.register((0,
- t.addDisposableDomListener)(D, "touchstart", M => {
- if (!this.coreMouseService.areMouseEventsActive)
- return this.viewport.onTouchStart(M),
- this.cancel(M)
- }
- , {
- passive: !0
- })),
- this.register((0,
- t.addDisposableDomListener)(D, "touchmove", M => {
- if (!this.coreMouseService.areMouseEventsActive)
- return this.viewport.onTouchMove(M) ? void 0 : this.cancel(M)
- }
- , {
- passive: !1
- }))
- }
- refresh(k, D) {
- var B;
- (B = this._renderService) === null || B === void 0 || B.refreshRows(k, D)
- }
- updateCursorStyle(k) {
- var D;
- !((D = this._selectionService) === null || D === void 0) && D.shouldColumnSelect(k) ? this.element.classList.add("column-select") : this.element.classList.remove("column-select")
- }
- _showCursor() {
- this.coreService.isCursorInitialized || (this.coreService.isCursorInitialized = !0,
- this.refresh(this.buffer.y, this.buffer.y))
- }
- scrollLines(k, D, B = 0) {
- super.scrollLines(k, D, B),
- this.refresh(0, this.rows - 1)
- }
- paste(k) {
- (0,
- h.paste)(k, this.textarea, this.coreService)
- }
- attachCustomKeyEventHandler(k) {
- this._customKeyEventHandler = k
- }
- registerLinkProvider(k) {
- return this.linkifier2.registerLinkProvider(k)
- }
- registerCharacterJoiner(k) {
- if (!this._characterJoinerService)
- throw new Error("Terminal must be opened first");
- const D = this._characterJoinerService.register(k);
- return this.refresh(0, this.rows - 1),
- D
- }
- deregisterCharacterJoiner(k) {
- if (!this._characterJoinerService)
- throw new Error("Terminal must be opened first");
- this._characterJoinerService.deregister(k) && this.refresh(0, this.rows - 1)
- }
- get markers() {
- return this.buffer.markers
- }
- addMarker(k) {
- return this.buffer.addMarker(this.buffer.ybase + this.buffer.y + k)
- }
- registerDecoration(k) {
- return this._decorationService.registerDecoration(k)
- }
- hasSelection() {
- return !!this._selectionService && this._selectionService.hasSelection
- }
- select(k, D, B) {
- this._selectionService.setSelection(k, D, B)
- }
- getSelection() {
- return this._selectionService ? this._selectionService.selectionText : ""
- }
- getSelectionPosition() {
- if (this._selectionService && this._selectionService.hasSelection)
- return {
- start: {
- x: this._selectionService.selectionStart[0],
- y: this._selectionService.selectionStart[1]
- },
- end: {
- x: this._selectionService.selectionEnd[0],
- y: this._selectionService.selectionEnd[1]
- }
- }
- }
- clearSelection() {
- var k;
- (k = this._selectionService) === null || k === void 0 || k.clearSelection()
- }
- selectAll() {
- var k;
- (k = this._selectionService) === null || k === void 0 || k.selectAll()
- }
- selectLines(k, D) {
- var B;
- (B = this._selectionService) === null || B === void 0 || B.selectLines(k, D)
- }
- _keyDown(k) {
- if (this._keyDownHandled = !1,
- this._keyDownSeen = !0,
- this._customKeyEventHandler && this._customKeyEventHandler(k) === !1)
- return !1;
- const D = this.browser.isMac && this.options.macOptionIsMeta && k.altKey;
- if (!D && !this._compositionHelper.keydown(k))
- return this.buffer.ybase !== this.buffer.ydisp && this._bufferService.scrollToBottom(),
- !1;
- D || k.key !== "Dead" && k.key !== "AltGraph" || (this._unprocessedDeadKey = !0);
- const B = (0,
- c.evaluateKeyboardEvent)(k, this.coreService.decPrivateModes.applicationCursorKeys, this.browser.isMac, this.options.macOptionIsMeta);
- if (this.updateCursorStyle(k),
- B.type === 3 || B.type === 2) {
- const I = this.rows - 1;
- return this.scrollLines(B.type === 2 ? -I : I),
- this.cancel(k, !0)
- }
- return B.type === 1 && this.selectAll(),
- !!this._isThirdLevelShift(this.browser, k) || (B.cancel && this.cancel(k, !0),
- !B.key || !!(k.key && !k.ctrlKey && !k.altKey && !k.metaKey && k.key.length === 1 && k.key.charCodeAt(0) >= 65 && k.key.charCodeAt(0) <= 90) || (this._unprocessedDeadKey ? (this._unprocessedDeadKey = !1,
- !0) : (B.key !== f.C0.ETX && B.key !== f.C0.CR || (this.textarea.value = ""),
- this._onKey.fire({
- key: B.key,
- domEvent: k
- }),
- this._showCursor(),
- this.coreService.triggerDataEvent(B.key, !0),
- this.optionsService.rawOptions.screenReaderMode ? void (this._keyDownHandled = !0) : this.cancel(k, !0))))
- }
- _isThirdLevelShift(k, D) {
- const B = k.isMac && !this.options.macOptionIsMeta && D.altKey && !D.ctrlKey && !D.metaKey || k.isWindows && D.altKey && D.ctrlKey && !D.metaKey || k.isWindows && D.getModifierState("AltGraph");
- return D.type === "keypress" ? B : B && (!D.keyCode || D.keyCode > 47)
- }
- _keyUp(k) {
- this._keyDownSeen = !1,
- this._customKeyEventHandler && this._customKeyEventHandler(k) === !1 || (function (D) {
- return D.keyCode === 16 || D.keyCode === 17 || D.keyCode === 18
- }(k) || this.focus(),
- this.updateCursorStyle(k),
- this._keyPressHandled = !1)
- }
- _keyPress(k) {
- let D;
- if (this._keyPressHandled = !1,
- this._keyDownHandled || this._customKeyEventHandler && this._customKeyEventHandler(k) === !1)
- return !1;
- if (this.cancel(k),
- k.charCode)
- D = k.charCode;
- else if (k.which === null || k.which === void 0)
- D = k.keyCode;
- else {
- if (k.which === 0 || k.charCode === 0)
- return !1;
- D = k.which
- }
- return !(!D || (k.altKey || k.ctrlKey || k.metaKey) && !this._isThirdLevelShift(this.browser, k) || (D = String.fromCharCode(D),
- this._onKey.fire({
- key: D,
- domEvent: k
- }),
- this._showCursor(),
- this.coreService.triggerDataEvent(D, !0),
- this._keyPressHandled = !0,
- this._unprocessedDeadKey = !1,
- 0))
- }
- _inputEvent(k) {
- if (k.data && k.inputType === "insertText" && (!k.composed || !this._keyDownSeen) && !this.optionsService.rawOptions.screenReaderMode) {
- if (this._keyPressHandled)
- return !1;
- this._unprocessedDeadKey = !1;
- const D = k.data;
- return this.coreService.triggerDataEvent(D, !0),
- this.cancel(k),
- !0
- }
- return !1
- }
- resize(k, D) {
- k !== this.cols || D !== this.rows ? super.resize(k, D) : this._charSizeService && !this._charSizeService.hasValidSize && this._charSizeService.measure()
- }
- _afterResize(k, D) {
- var B, I;
- (B = this._charSizeService) === null || B === void 0 || B.measure(),
- (I = this.viewport) === null || I === void 0 || I.syncScrollArea(!0)
- }
- clear() {
- if (this.buffer.ybase !== 0 || this.buffer.y !== 0) {
- this.buffer.clearAllMarkers(),
- this.buffer.lines.set(0, this.buffer.lines.get(this.buffer.ybase + this.buffer.y)),
- this.buffer.lines.length = 1,
- this.buffer.ydisp = 0,
- this.buffer.ybase = 0,
- this.buffer.y = 0;
- for (let k = 1; k < this.rows; k++)
- this.buffer.lines.push(this.buffer.getBlankLine(v.DEFAULT_ATTR_DATA));
- this.refresh(0, this.rows - 1),
- this._onScroll.fire({
- position: this.buffer.ydisp,
- source: 0
- })
- }
- }
- reset() {
- var k, D;
- this.options.rows = this.rows,
- this.options.cols = this.cols;
- const B = this._customKeyEventHandler;
- this._setup(),
- super.reset(),
- (k = this._selectionService) === null || k === void 0 || k.reset(),
- this._decorationService.reset(),
- this._customKeyEventHandler = B,
- this.refresh(0, this.rows - 1),
- (D = this.viewport) === null || D === void 0 || D.syncScrollArea()
- }
- clearTextureAtlas() {
- var k;
- (k = this._renderService) === null || k === void 0 || k.clearTextureAtlas()
- }
- _reportFocus() {
- var k;
- !((k = this.element) === null || k === void 0) && k.classList.contains("focus") ? this.coreService.triggerDataEvent(f.C0.ESC + "[I") : this.coreService.triggerDataEvent(f.C0.ESC + "[O")
- }
- _reportWindowsOptions(k) {
- if (this._renderService)
- switch (k) {
- case d.WindowsOptionsReportType.GET_WIN_SIZE_PIXELS:
- const D = this._renderService.dimensions.canvasWidth.toFixed(0)
- , B = this._renderService.dimensions.canvasHeight.toFixed(0);
- this.coreService.triggerDataEvent(`${f.C0.ESC}[4;${B};${D}t`);
- break;
- case d.WindowsOptionsReportType.GET_CELL_SIZE_PIXELS:
- const I = this._renderService.dimensions.actualCellWidth.toFixed(0)
- , F = this._renderService.dimensions.actualCellHeight.toFixed(0);
- this.coreService.triggerDataEvent(`${f.C0.ESC}[6;${F};${I}t`)
- }
- }
- cancel(k, D) {
- if (this.options.cancelEvents || D)
- return k.preventDefault(),
- k.stopPropagation(),
- !1
- }
- }
- r.Terminal = T
- }
- ,
- 9924: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.TimeBasedDebouncer = void 0,
- r.TimeBasedDebouncer = class {
- constructor(a, n = 1e3) {
- this._renderCallback = a,
- this._debounceThresholdMS = n,
- this._lastRefreshMs = 0,
- this._additionalRefreshRequested = !1
- }
- dispose() {
- this._refreshTimeoutID && clearTimeout(this._refreshTimeoutID)
- }
- refresh(a, n, _) {
- this._rowCount = _,
- a = a !== void 0 ? a : 0,
- n = n !== void 0 ? n : this._rowCount - 1,
- this._rowStart = this._rowStart !== void 0 ? Math.min(this._rowStart, a) : a,
- this._rowEnd = this._rowEnd !== void 0 ? Math.max(this._rowEnd, n) : n;
- const h = Date.now();
- if (h - this._lastRefreshMs >= this._debounceThresholdMS)
- this._lastRefreshMs = h,
- this._innerRefresh();
- else if (!this._additionalRefreshRequested) {
- const f = h - this._lastRefreshMs
- , d = this._debounceThresholdMS - f;
- this._additionalRefreshRequested = !0,
- this._refreshTimeoutID = window.setTimeout(() => {
- this._lastRefreshMs = Date.now(),
- this._innerRefresh(),
- this._additionalRefreshRequested = !1,
- this._refreshTimeoutID = void 0
- }
- , d)
- }
- }
- _innerRefresh() {
- if (this._rowStart === void 0 || this._rowEnd === void 0 || this._rowCount === void 0)
- return;
- const a = Math.max(this._rowStart, 0)
- , n = Math.min(this._rowEnd, this._rowCount - 1);
- this._rowStart = void 0,
- this._rowEnd = void 0,
- this._renderCallback(a, n)
- }
- }
- }
- ,
- 1680: function (x, r, a) {
- var n = this && this.__decorate || function (t, s, e, i) {
- var c, g = arguments.length, v = g < 3 ? s : i === null ? i = Object.getOwnPropertyDescriptor(s, e) : i;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- v = Reflect.decorate(t, s, e, i);
- else
- for (var S = t.length - 1; S >= 0; S--)
- (c = t[S]) && (v = (g < 3 ? c(v) : g > 3 ? c(s, e, v) : c(s, e)) || v);
- return g > 3 && v && Object.defineProperty(s, e, v),
- v
- }
- , _ = this && this.__param || function (t, s) {
- return function (e, i) {
- s(e, i, t)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.Viewport = void 0;
- const h = a(844)
- , f = a(3656)
- , d = a(4725)
- , l = a(2585);
- let o = class extends h.Disposable {
- constructor(t, s, e, i, c, g, v, S, u) {
- super(),
- this._scrollLines = t,
- this._viewportElement = s,
- this._scrollArea = e,
- this._element = i,
- this._bufferService = c,
- this._optionsService = g,
- this._charSizeService = v,
- this._renderService = S,
- this._coreBrowserService = u,
- this.scrollBarWidth = 0,
- this._currentRowHeight = 0,
- this._currentScaledCellHeight = 0,
- this._lastRecordedBufferLength = 0,
- this._lastRecordedViewportHeight = 0,
- this._lastRecordedBufferHeight = 0,
- this._lastTouchY = 0,
- this._lastScrollTop = 0,
- this._wheelPartialScroll = 0,
- this._refreshAnimationFrame = null,
- this._ignoreNextScrollEvent = !1,
- this._smoothScrollState = {
- startTime: 0,
- origin: -1,
- target: -1
- },
- this.scrollBarWidth = this._viewportElement.offsetWidth - this._scrollArea.offsetWidth || 15,
- this.register((0,
- f.addDisposableDomListener)(this._viewportElement, "scroll", this._onScroll.bind(this))),
- this._activeBuffer = this._bufferService.buffer,
- this.register(this._bufferService.buffers.onBufferActivate(m => this._activeBuffer = m.activeBuffer)),
- this._renderDimensions = this._renderService.dimensions,
- this.register(this._renderService.onDimensionsChange(m => this._renderDimensions = m)),
- setTimeout(() => this.syncScrollArea(), 0)
- }
- onThemeChange(t) {
- this._viewportElement.style.backgroundColor = t.background.css
- }
- _refresh(t) {
- if (t)
- return this._innerRefresh(),
- void (this._refreshAnimationFrame !== null && this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));
- this._refreshAnimationFrame === null && (this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._innerRefresh()))
- }
- _innerRefresh() {
- if (this._charSizeService.height > 0) {
- this._currentRowHeight = this._renderService.dimensions.scaledCellHeight / this._coreBrowserService.dpr,
- this._currentScaledCellHeight = this._renderService.dimensions.scaledCellHeight,
- this._lastRecordedViewportHeight = this._viewportElement.offsetHeight;
- const s = Math.round(this._currentRowHeight * this._lastRecordedBufferLength) + (this._lastRecordedViewportHeight - this._renderService.dimensions.canvasHeight);
- this._lastRecordedBufferHeight !== s && (this._lastRecordedBufferHeight = s,
- this._scrollArea.style.height = this._lastRecordedBufferHeight + "px")
- }
- const t = this._bufferService.buffer.ydisp * this._currentRowHeight;
- this._viewportElement.scrollTop !== t && (this._ignoreNextScrollEvent = !0,
- this._viewportElement.scrollTop = t),
- this._refreshAnimationFrame = null
- }
- syncScrollArea(t = !1) {
- if (this._lastRecordedBufferLength !== this._bufferService.buffer.lines.length)
- return this._lastRecordedBufferLength = this._bufferService.buffer.lines.length,
- void this._refresh(t);
- this._lastRecordedViewportHeight === this._renderService.dimensions.canvasHeight && this._lastScrollTop === this._activeBuffer.ydisp * this._currentRowHeight && this._renderDimensions.scaledCellHeight === this._currentScaledCellHeight || this._refresh(t)
- }
- _onScroll(t) {
- if (this._lastScrollTop = this._viewportElement.scrollTop,
- !this._viewportElement.offsetParent)
- return;
- if (this._ignoreNextScrollEvent)
- return this._ignoreNextScrollEvent = !1,
- void this._scrollLines(0);
- const s = Math.round(this._lastScrollTop / this._currentRowHeight) - this._bufferService.buffer.ydisp;
- this._scrollLines(s)
- }
- _smoothScroll() {
- if (this._isDisposed || this._smoothScrollState.origin === -1 || this._smoothScrollState.target === -1)
- return;
- const t = this._smoothScrollPercent();
- this._viewportElement.scrollTop = this._smoothScrollState.origin + Math.round(t * (this._smoothScrollState.target - this._smoothScrollState.origin)),
- t < 1 ? this._coreBrowserService.window.requestAnimationFrame(() => this._smoothScroll()) : this._clearSmoothScrollState()
- }
- _smoothScrollPercent() {
- return this._optionsService.rawOptions.smoothScrollDuration && this._smoothScrollState.startTime ? Math.max(Math.min((Date.now() - this._smoothScrollState.startTime) / this._optionsService.rawOptions.smoothScrollDuration, 1), 0) : 1
- }
- _clearSmoothScrollState() {
- this._smoothScrollState.startTime = 0,
- this._smoothScrollState.origin = -1,
- this._smoothScrollState.target = -1
- }
- _bubbleScroll(t, s) {
- const e = this._viewportElement.scrollTop + this._lastRecordedViewportHeight;
- return !(s < 0 && this._viewportElement.scrollTop !== 0 || s > 0 && e < this._lastRecordedBufferHeight) || (t.cancelable && t.preventDefault(),
- !1)
- }
- onWheel(t) {
- const s = this._getPixelsScrolled(t);
- return s !== 0 && (this._optionsService.rawOptions.smoothScrollDuration ? (this._smoothScrollState.startTime = Date.now(),
- this._smoothScrollPercent() < 1 ? (this._smoothScrollState.origin = this._viewportElement.scrollTop,
- this._smoothScrollState.target === -1 ? this._smoothScrollState.target = this._viewportElement.scrollTop + s : this._smoothScrollState.target += s,
- this._smoothScrollState.target = Math.max(Math.min(this._smoothScrollState.target, this._viewportElement.scrollHeight), 0),
- this._smoothScroll()) : this._clearSmoothScrollState()) : this._viewportElement.scrollTop += s,
- this._bubbleScroll(t, s))
- }
- _getPixelsScrolled(t) {
- if (t.deltaY === 0 || t.shiftKey)
- return 0;
- let s = this._applyScrollModifier(t.deltaY, t);
- return t.deltaMode === WheelEvent.DOM_DELTA_LINE ? s *= this._currentRowHeight : t.deltaMode === WheelEvent.DOM_DELTA_PAGE && (s *= this._currentRowHeight * this._bufferService.rows),
- s
- }
- getLinesScrolled(t) {
- if (t.deltaY === 0 || t.shiftKey)
- return 0;
- let s = this._applyScrollModifier(t.deltaY, t);
- return t.deltaMode === WheelEvent.DOM_DELTA_PIXEL ? (s /= this._currentRowHeight + 0,
- this._wheelPartialScroll += s,
- s = Math.floor(Math.abs(this._wheelPartialScroll)) * (this._wheelPartialScroll > 0 ? 1 : -1),
- this._wheelPartialScroll %= 1) : t.deltaMode === WheelEvent.DOM_DELTA_PAGE && (s *= this._bufferService.rows),
- s
- }
- _applyScrollModifier(t, s) {
- const e = this._optionsService.rawOptions.fastScrollModifier;
- return e === "alt" && s.altKey || e === "ctrl" && s.ctrlKey || e === "shift" && s.shiftKey ? t * this._optionsService.rawOptions.fastScrollSensitivity * this._optionsService.rawOptions.scrollSensitivity : t * this._optionsService.rawOptions.scrollSensitivity
- }
- onTouchStart(t) {
- this._lastTouchY = t.touches[0].pageY
- }
- onTouchMove(t) {
- const s = this._lastTouchY - t.touches[0].pageY;
- return this._lastTouchY = t.touches[0].pageY,
- s !== 0 && (this._viewportElement.scrollTop += s,
- this._bubbleScroll(t, s))
- }
- }
- ;
- o = n([_(4, l.IBufferService), _(5, l.IOptionsService), _(6, d.ICharSizeService), _(7, d.IRenderService), _(8, d.ICoreBrowserService)], o),
- r.Viewport = o
- },
- 3107: function (x, r, a) {
- var n = this && this.__decorate || function (t, s, e, i) {
- var c, g = arguments.length, v = g < 3 ? s : i === null ? i = Object.getOwnPropertyDescriptor(s, e) : i;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- v = Reflect.decorate(t, s, e, i);
- else
- for (var S = t.length - 1; S >= 0; S--)
- (c = t[S]) && (v = (g < 3 ? c(v) : g > 3 ? c(s, e, v) : c(s, e)) || v);
- return g > 3 && v && Object.defineProperty(s, e, v),
- v
- }
- , _ = this && this.__param || function (t, s) {
- return function (e, i) {
- s(e, i, t)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.BufferDecorationRenderer = void 0;
- const h = a(3656)
- , f = a(4725)
- , d = a(844)
- , l = a(2585);
- let o = class extends d.Disposable {
- constructor(t, s, e, i) {
- super(),
- this._screenElement = t,
- this._bufferService = s,
- this._decorationService = e,
- this._renderService = i,
- this._decorationElements = new Map,
- this._altBufferIsActive = !1,
- this._dimensionsChanged = !1,
- this._container = document.createElement("div"),
- this._container.classList.add("xterm-decoration-container"),
- this._screenElement.appendChild(this._container),
- this.register(this._renderService.onRenderedViewportChange(() => this._queueRefresh())),
- this.register(this._renderService.onDimensionsChange(() => {
- this._dimensionsChanged = !0,
- this._queueRefresh()
- }
- )),
- this.register((0,
- h.addDisposableDomListener)(window, "resize", () => this._queueRefresh())),
- this.register(this._bufferService.buffers.onBufferActivate(() => {
- this._altBufferIsActive = this._bufferService.buffer === this._bufferService.buffers.alt
- }
- )),
- this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh())),
- this.register(this._decorationService.onDecorationRemoved(c => this._removeDecoration(c)))
- }
- dispose() {
- this._container.remove(),
- this._decorationElements.clear(),
- super.dispose()
- }
- _queueRefresh() {
- this._animationFrame === void 0 && (this._animationFrame = this._renderService.addRefreshCallback(() => {
- this.refreshDecorations(),
- this._animationFrame = void 0
- }
- ))
- }
- refreshDecorations() {
- for (const t of this._decorationService.decorations)
- this._renderDecoration(t);
- this._dimensionsChanged = !1
- }
- _renderDecoration(t) {
- this._refreshStyle(t),
- this._dimensionsChanged && this._refreshXPosition(t)
- }
- _createElement(t) {
- var s;
- const e = document.createElement("div");
- e.classList.add("xterm-decoration"),
- e.style.width = `${Math.round((t.options.width || 1) * this._renderService.dimensions.actualCellWidth)}px`,
- e.style.height = (t.options.height || 1) * this._renderService.dimensions.actualCellHeight + "px",
- e.style.top = (t.marker.line - this._bufferService.buffers.active.ydisp) * this._renderService.dimensions.actualCellHeight + "px",
- e.style.lineHeight = `${this._renderService.dimensions.actualCellHeight}px`;
- const i = (s = t.options.x) !== null && s !== void 0 ? s : 0;
- return i && i > this._bufferService.cols && (e.style.display = "none"),
- this._refreshXPosition(t, e),
- e
- }
- _refreshStyle(t) {
- const s = t.marker.line - this._bufferService.buffers.active.ydisp;
- if (s < 0 || s >= this._bufferService.rows)
- t.element && (t.element.style.display = "none",
- t.onRenderEmitter.fire(t.element));
- else {
- let e = this._decorationElements.get(t);
- e || (t.onDispose(() => this._removeDecoration(t)),
- e = this._createElement(t),
- t.element = e,
- this._decorationElements.set(t, e),
- this._container.appendChild(e)),
- e.style.top = s * this._renderService.dimensions.actualCellHeight + "px",
- e.style.display = this._altBufferIsActive ? "none" : "block",
- t.onRenderEmitter.fire(e)
- }
- }
- _refreshXPosition(t, s = t.element) {
- var e;
- if (!s)
- return;
- const i = (e = t.options.x) !== null && e !== void 0 ? e : 0;
- (t.options.anchor || "left") === "right" ? s.style.right = i ? i * this._renderService.dimensions.actualCellWidth + "px" : "" : s.style.left = i ? i * this._renderService.dimensions.actualCellWidth + "px" : ""
- }
- _removeDecoration(t) {
- var s;
- (s = this._decorationElements.get(t)) === null || s === void 0 || s.remove(),
- this._decorationElements.delete(t)
- }
- }
- ;
- o = n([_(1, l.IBufferService), _(2, l.IDecorationService), _(3, f.IRenderService)], o),
- r.BufferDecorationRenderer = o
- },
- 5871: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.ColorZoneStore = void 0,
- r.ColorZoneStore = class {
- constructor() {
- this._zones = [],
- this._zonePool = [],
- this._zonePoolIndex = 0,
- this._linePadding = {
- full: 0,
- left: 0,
- center: 0,
- right: 0
- }
- }
- get zones() {
- return this._zonePool.length = Math.min(this._zonePool.length, this._zones.length),
- this._zones
- }
- clear() {
- this._zones.length = 0,
- this._zonePoolIndex = 0
- }
- addDecoration(a) {
- if (a.options.overviewRulerOptions) {
- for (const n of this._zones)
- if (n.color === a.options.overviewRulerOptions.color && n.position === a.options.overviewRulerOptions.position) {
- if (this._lineIntersectsZone(n, a.marker.line))
- return;
- if (this._lineAdjacentToZone(n, a.marker.line, a.options.overviewRulerOptions.position))
- return void this._addLineToZone(n, a.marker.line)
- }
- if (this._zonePoolIndex < this._zonePool.length)
- return this._zonePool[this._zonePoolIndex].color = a.options.overviewRulerOptions.color,
- this._zonePool[this._zonePoolIndex].position = a.options.overviewRulerOptions.position,
- this._zonePool[this._zonePoolIndex].startBufferLine = a.marker.line,
- this._zonePool[this._zonePoolIndex].endBufferLine = a.marker.line,
- void this._zones.push(this._zonePool[this._zonePoolIndex++]);
- this._zones.push({
- color: a.options.overviewRulerOptions.color,
- position: a.options.overviewRulerOptions.position,
- startBufferLine: a.marker.line,
- endBufferLine: a.marker.line
- }),
- this._zonePool.push(this._zones[this._zones.length - 1]),
- this._zonePoolIndex++
- }
- }
- setPadding(a) {
- this._linePadding = a
- }
- _lineIntersectsZone(a, n) {
- return n >= a.startBufferLine && n <= a.endBufferLine
- }
- _lineAdjacentToZone(a, n, _) {
- return n >= a.startBufferLine - this._linePadding[_ || "full"] && n <= a.endBufferLine + this._linePadding[_ || "full"]
- }
- _addLineToZone(a, n) {
- a.startBufferLine = Math.min(a.startBufferLine, n),
- a.endBufferLine = Math.max(a.endBufferLine, n)
- }
- }
- }
- ,
- 5744: function (x, r, a) {
- var n = this && this.__decorate || function (c, g, v, S) {
- var u, m = arguments.length, w = m < 3 ? g : S === null ? S = Object.getOwnPropertyDescriptor(g, v) : S;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- w = Reflect.decorate(c, g, v, S);
- else
- for (var R = c.length - 1; R >= 0; R--)
- (u = c[R]) && (w = (m < 3 ? u(w) : m > 3 ? u(g, v, w) : u(g, v)) || w);
- return m > 3 && w && Object.defineProperty(g, v, w),
- w
- }
- , _ = this && this.__param || function (c, g) {
- return function (v, S) {
- g(v, S, c)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.OverviewRulerRenderer = void 0;
- const h = a(5871)
- , f = a(3656)
- , d = a(4725)
- , l = a(844)
- , o = a(2585)
- , t = {
- full: 0,
- left: 0,
- center: 0,
- right: 0
- }
- , s = {
- full: 0,
- left: 0,
- center: 0,
- right: 0
- }
- , e = {
- full: 0,
- left: 0,
- center: 0,
- right: 0
- };
- let i = class extends l.Disposable {
- constructor(c, g, v, S, u, m, w) {
- var R;
- super(),
- this._viewportElement = c,
- this._screenElement = g,
- this._bufferService = v,
- this._decorationService = S,
- this._renderService = u,
- this._optionsService = m,
- this._coreBrowseService = w,
- this._colorZoneStore = new h.ColorZoneStore,
- this._shouldUpdateDimensions = !0,
- this._shouldUpdateAnchor = !0,
- this._lastKnownBufferLength = 0,
- this._canvas = document.createElement("canvas"),
- this._canvas.classList.add("xterm-decoration-overview-ruler"),
- this._refreshCanvasDimensions(),
- (R = this._viewportElement.parentElement) === null || R === void 0 || R.insertBefore(this._canvas, this._viewportElement);
- const L = this._canvas.getContext("2d");
- if (!L)
- throw new Error("Ctx cannot be null");
- this._ctx = L,
- this._registerDecorationListeners(),
- this._registerBufferChangeListeners(),
- this._registerDimensionChangeListeners()
- }
- get _width() {
- return this._optionsService.options.overviewRulerWidth || 0
- }
- _registerDecorationListeners() {
- this.register(this._decorationService.onDecorationRegistered(() => this._queueRefresh(void 0, !0))),
- this.register(this._decorationService.onDecorationRemoved(() => this._queueRefresh(void 0, !0)))
- }
- _registerBufferChangeListeners() {
- this.register(this._renderService.onRenderedViewportChange(() => this._queueRefresh())),
- this.register(this._bufferService.buffers.onBufferActivate(() => {
- this._canvas.style.display = this._bufferService.buffer === this._bufferService.buffers.alt ? "none" : "block"
- }
- )),
- this.register(this._bufferService.onScroll(() => {
- this._lastKnownBufferLength !== this._bufferService.buffers.normal.lines.length && (this._refreshDrawHeightConstants(),
- this._refreshColorZonePadding())
- }
- ))
- }
- _registerDimensionChangeListeners() {
- this.register(this._renderService.onRender(() => {
- this._containerHeight && this._containerHeight === this._screenElement.clientHeight || (this._queueRefresh(!0),
- this._containerHeight = this._screenElement.clientHeight)
- }
- )),
- this.register(this._optionsService.onOptionChange(c => {
- c === "overviewRulerWidth" && this._queueRefresh(!0)
- }
- )),
- this.register((0,
- f.addDisposableDomListener)(this._coreBrowseService.window, "resize", () => {
- this._queueRefresh(!0)
- }
- )),
- this._queueRefresh(!0)
- }
- dispose() {
- var c;
- (c = this._canvas) === null || c === void 0 || c.remove(),
- super.dispose()
- }
- _refreshDrawConstants() {
- const c = Math.floor(this._canvas.width / 3)
- , g = Math.ceil(this._canvas.width / 3);
- s.full = this._canvas.width,
- s.left = c,
- s.center = g,
- s.right = c,
- this._refreshDrawHeightConstants(),
- e.full = 0,
- e.left = 0,
- e.center = s.left,
- e.right = s.left + s.center
- }
- _refreshDrawHeightConstants() {
- t.full = Math.round(2 * this._coreBrowseService.dpr);
- const c = this._canvas.height / this._bufferService.buffer.lines.length
- , g = Math.round(Math.max(Math.min(c, 12), 6) * this._coreBrowseService.dpr);
- t.left = g,
- t.center = g,
- t.right = g
- }
- _refreshColorZonePadding() {
- this._colorZoneStore.setPadding({
- full: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * t.full),
- left: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * t.left),
- center: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * t.center),
- right: Math.floor(this._bufferService.buffers.active.lines.length / (this._canvas.height - 1) * t.right)
- }),
- this._lastKnownBufferLength = this._bufferService.buffers.normal.lines.length
- }
- _refreshCanvasDimensions() {
- this._canvas.style.width = `${this._width}px`,
- this._canvas.width = Math.round(this._width * this._coreBrowseService.dpr),
- this._canvas.style.height = `${this._screenElement.clientHeight}px`,
- this._canvas.height = Math.round(this._screenElement.clientHeight * this._coreBrowseService.dpr),
- this._refreshDrawConstants(),
- this._refreshColorZonePadding()
- }
- _refreshDecorations() {
- this._shouldUpdateDimensions && this._refreshCanvasDimensions(),
- this._ctx.clearRect(0, 0, this._canvas.width, this._canvas.height),
- this._colorZoneStore.clear();
- for (const g of this._decorationService.decorations)
- this._colorZoneStore.addDecoration(g);
- this._ctx.lineWidth = 1;
- const c = this._colorZoneStore.zones;
- for (const g of c)
- g.position !== "full" && this._renderColorZone(g);
- for (const g of c)
- g.position === "full" && this._renderColorZone(g);
- this._shouldUpdateDimensions = !1,
- this._shouldUpdateAnchor = !1
- }
- _renderColorZone(c) {
- this._ctx.fillStyle = c.color,
- this._ctx.fillRect(e[c.position || "full"], Math.round((this._canvas.height - 1) * (c.startBufferLine / this._bufferService.buffers.active.lines.length) - t[c.position || "full"] / 2), s[c.position || "full"], Math.round((this._canvas.height - 1) * ((c.endBufferLine - c.startBufferLine) / this._bufferService.buffers.active.lines.length) + t[c.position || "full"]))
- }
- _queueRefresh(c, g) {
- this._shouldUpdateDimensions = c || this._shouldUpdateDimensions,
- this._shouldUpdateAnchor = g || this._shouldUpdateAnchor,
- this._animationFrame === void 0 && (this._animationFrame = this._coreBrowseService.window.requestAnimationFrame(() => {
- this._refreshDecorations(),
- this._animationFrame = void 0
- }
- ))
- }
- }
- ;
- i = n([_(2, o.IBufferService), _(3, o.IDecorationService), _(4, d.IRenderService), _(5, o.IOptionsService), _(6, d.ICoreBrowserService)], i),
- r.OverviewRulerRenderer = i
- },
- 2950: function (x, r, a) {
- var n = this && this.__decorate || function (o, t, s, e) {
- var i, c = arguments.length, g = c < 3 ? t : e === null ? e = Object.getOwnPropertyDescriptor(t, s) : e;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- g = Reflect.decorate(o, t, s, e);
- else
- for (var v = o.length - 1; v >= 0; v--)
- (i = o[v]) && (g = (c < 3 ? i(g) : c > 3 ? i(t, s, g) : i(t, s)) || g);
- return c > 3 && g && Object.defineProperty(t, s, g),
- g
- }
- , _ = this && this.__param || function (o, t) {
- return function (s, e) {
- t(s, e, o)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.CompositionHelper = void 0;
- const h = a(4725)
- , f = a(2585)
- , d = a(2584);
- let l = class {
- constructor(o, t, s, e, i, c) {
- this._textarea = o,
- this._compositionView = t,
- this._bufferService = s,
- this._optionsService = e,
- this._coreService = i,
- this._renderService = c,
- this._isComposing = !1,
- this._isSendingComposition = !1,
- this._compositionPosition = {
- start: 0,
- end: 0
- },
- this._dataAlreadySent = ""
- }
- get isComposing() {
- return this._isComposing
- }
- compositionstart() {
- this._isComposing = !0,
- this._compositionPosition.start = this._textarea.value.length,
- this._compositionView.textContent = "",
- this._dataAlreadySent = "",
- this._compositionView.classList.add("active")
- }
- compositionupdate(o) {
- this._compositionView.textContent = o.data,
- this.updateCompositionElements(),
- setTimeout(() => {
- this._compositionPosition.end = this._textarea.value.length
- }
- , 0)
- }
- compositionend() {
- this._finalizeComposition(!0)
- }
- keydown(o) {
- if (this._isComposing || this._isSendingComposition) {
- if (o.keyCode === 229 || o.keyCode === 16 || o.keyCode === 17 || o.keyCode === 18)
- return !1;
- this._finalizeComposition(!1)
- }
- return o.keyCode !== 229 || (this._handleAnyTextareaChanges(),
- !1)
- }
- _finalizeComposition(o) {
- if (this._compositionView.classList.remove("active"),
- this._isComposing = !1,
- o) {
- const t = {
- start: this._compositionPosition.start,
- end: this._compositionPosition.end
- };
- this._isSendingComposition = !0,
- setTimeout(() => {
- if (this._isSendingComposition) {
- let s;
- this._isSendingComposition = !1,
- t.start += this._dataAlreadySent.length,
- s = this._isComposing ? this._textarea.value.substring(t.start, t.end) : this._textarea.value.substring(t.start),
- s.length > 0 && this._coreService.triggerDataEvent(s, !0)
- }
- }
- , 0)
- } else {
- this._isSendingComposition = !1;
- const t = this._textarea.value.substring(this._compositionPosition.start, this._compositionPosition.end);
- this._coreService.triggerDataEvent(t, !0)
- }
- }
- _handleAnyTextareaChanges() {
- const o = this._textarea.value;
- setTimeout(() => {
- if (!this._isComposing) {
- const t = this._textarea.value
- , s = t.replace(o, "");
- this._dataAlreadySent = s,
- t.length > o.length ? this._coreService.triggerDataEvent(s, !0) : t.length < o.length ? this._coreService.triggerDataEvent(`${d.C0.DEL}`, !0) : t.length === o.length && t !== o && this._coreService.triggerDataEvent(t, !0)
- }
- }
- , 0)
- }
- updateCompositionElements(o) {
- if (this._isComposing) {
- if (this._bufferService.buffer.isCursorInViewport) {
- const t = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1)
- , s = this._renderService.dimensions.actualCellHeight
- , e = this._bufferService.buffer.y * this._renderService.dimensions.actualCellHeight
- , i = t * this._renderService.dimensions.actualCellWidth;
- this._compositionView.style.left = i + "px",
- this._compositionView.style.top = e + "px",
- this._compositionView.style.height = s + "px",
- this._compositionView.style.lineHeight = s + "px",
- this._compositionView.style.fontFamily = this._optionsService.rawOptions.fontFamily,
- this._compositionView.style.fontSize = this._optionsService.rawOptions.fontSize + "px";
- const c = this._compositionView.getBoundingClientRect();
- this._textarea.style.left = i + "px",
- this._textarea.style.top = e + "px",
- this._textarea.style.width = Math.max(c.width, 1) + "px",
- this._textarea.style.height = Math.max(c.height, 1) + "px",
- this._textarea.style.lineHeight = c.height + "px"
- }
- o || setTimeout(() => this.updateCompositionElements(!0), 0)
- }
- }
- }
- ;
- l = n([_(2, f.IBufferService), _(3, f.IOptionsService), _(4, f.ICoreService), _(5, h.IRenderService)], l),
- r.CompositionHelper = l
- },
- 9806: (x, r) => {
- function a(n, _, h) {
- const f = h.getBoundingClientRect()
- , d = n.getComputedStyle(h)
- , l = parseInt(d.getPropertyValue("padding-left"))
- , o = parseInt(d.getPropertyValue("padding-top"));
- return [_.clientX - f.left - l, _.clientY - f.top - o]
- }
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.getCoords = r.getCoordsRelativeToElement = void 0,
- r.getCoordsRelativeToElement = a,
- r.getCoords = function (n, _, h, f, d, l, o, t, s) {
- if (!l)
- return;
- const e = a(n, _, h);
- return e ? (e[0] = Math.ceil((e[0] + (s ? o / 2 : 0)) / o),
- e[1] = Math.ceil(e[1] / t),
- e[0] = Math.min(Math.max(e[0], 1), f + (s ? 1 : 0)),
- e[1] = Math.min(Math.max(e[1], 1), d),
- e) : void 0
- }
- }
- ,
- 9504: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.moveToCellSequence = void 0;
- const n = a(2584);
- function _(t, s, e, i) {
- const c = t - h(e, t)
- , g = s - h(e, s)
- , v = Math.abs(c - g) - function (S, u, m) {
- let w = 0;
- const R = S - h(m, S)
- , L = u - h(m, u);
- for (let p = 0; p < Math.abs(R - L); p++) {
- const C = f(S, u) === "A" ? -1 : 1
- , b = m.buffer.lines.get(R + C * p);
- b != null && b.isWrapped && w++
- }
- return w
- }(t, s, e);
- return o(v, l(f(t, s), i))
- }
- function h(t, s) {
- let e = 0
- , i = t.buffer.lines.get(s)
- , c = i == null ? void 0 : i.isWrapped;
- for (; c && s >= 0 && s < t.rows;)
- e++,
- i = t.buffer.lines.get(--s),
- c = i == null ? void 0 : i.isWrapped;
- return e
- }
- function f(t, s) {
- return t > s ? "A" : "B"
- }
- function d(t, s, e, i, c, g) {
- let v = t
- , S = s
- , u = "";
- for (; v !== e || S !== i;)
- v += c ? 1 : -1,
- c && v > g.cols - 1 ? (u += g.buffer.translateBufferLineToString(S, !1, t, v),
- v = 0,
- t = 0,
- S++) : !c && v < 0 && (u += g.buffer.translateBufferLineToString(S, !1, 0, t + 1),
- v = g.cols - 1,
- t = v,
- S--);
- return u + g.buffer.translateBufferLineToString(S, !1, t, v)
- }
- function l(t, s) {
- const e = s ? "O" : "[";
- return n.C0.ESC + e + t
- }
- function o(t, s) {
- t = Math.floor(t);
- let e = "";
- for (let i = 0; i < t; i++)
- e += s;
- return e
- }
- r.moveToCellSequence = function (t, s, e, i) {
- const c = e.buffer.x
- , g = e.buffer.y;
- if (!e.buffer.hasScrollback)
- return function (u, m, w, R, L, p) {
- return _(m, R, L, p).length === 0 ? "" : o(d(u, m, u, m - h(L, m), !1, L).length, l("D", p))
- }(c, g, 0, s, e, i) + _(g, s, e, i) + function (u, m, w, R, L, p) {
- let C;
- C = _(m, R, L, p).length > 0 ? R - h(L, R) : m;
- const b = R
- , E = function (A, H, j, $, P, N) {
- let y;
- return y = _(j, $, P, N).length > 0 ? $ - h(P, $) : H,
- A < j && y <= $ || A >= j && y < $ ? "C" : "D"
- }(u, m, w, R, L, p);
- return o(d(u, C, w, b, E === "C", L).length, l(E, p))
- }(c, g, t, s, e, i);
- let v;
- if (g === s)
- return v = c > t ? "D" : "C",
- o(Math.abs(c - t), l(v, i));
- v = g > s ? "D" : "C";
- const S = Math.abs(g - s);
- return o(function (u, m) {
- return m.cols - u
- }(g > s ? t : c, e) + (S - 1) * e.cols + 1 + ((g > s ? c : t) - 1), l(v, i))
- }
- }
- ,
- 8036: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.TEXT_BASELINE = r.DIM_OPACITY = r.INVERTED_DEFAULT_COLOR = void 0;
- const n = a(6114);
- r.INVERTED_DEFAULT_COLOR = 257,
- r.DIM_OPACITY = .5,
- r.TEXT_BASELINE = n.isFirefox || n.isLegacyEdge ? "bottom" : "ideographic"
- }
- ,
- 1752: (x, r) => {
- function a(n) {
- return 57508 <= n && n <= 57558
- }
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.excludeFromContrastRatioDemands = r.isRestrictedPowerlineGlyph = r.isPowerlineGlyph = r.throwIfFalsy = void 0,
- r.throwIfFalsy = function (n) {
- if (!n)
- throw new Error("value must not be falsy");
- return n
- }
- ,
- r.isPowerlineGlyph = a,
- r.isRestrictedPowerlineGlyph = function (n) {
- return 57520 <= n && n <= 57527
- }
- ,
- r.excludeFromContrastRatioDemands = function (n) {
- return a(n) || function (_) {
- return 9472 <= _ && _ <= 9631
- }(n)
- }
- }
- ,
- 1296: function (x, r, a) {
- var n = this && this.__decorate || function (S, u, m, w) {
- var R, L = arguments.length, p = L < 3 ? u : w === null ? w = Object.getOwnPropertyDescriptor(u, m) : w;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- p = Reflect.decorate(S, u, m, w);
- else
- for (var C = S.length - 1; C >= 0; C--)
- (R = S[C]) && (p = (L < 3 ? R(p) : L > 3 ? R(u, m, p) : R(u, m)) || p);
- return L > 3 && p && Object.defineProperty(u, m, p),
- p
- }
- , _ = this && this.__param || function (S, u) {
- return function (m, w) {
- u(m, w, S)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.DomRenderer = void 0;
- const h = a(3787)
- , f = a(8036)
- , d = a(844)
- , l = a(4725)
- , o = a(2585)
- , t = a(8460)
- , s = a(8055)
- , e = a(9631)
- , i = "xterm-dom-renderer-owner-"
- , c = "xterm-focus";
- let g = 1
- , v = class extends d.Disposable {
- constructor(S, u, m, w, R, L, p, C, b, E) {
- super(),
- this._colors = S,
- this._element = u,
- this._screenElement = m,
- this._viewportElement = w,
- this._linkifier2 = R,
- this._charSizeService = p,
- this._optionsService = C,
- this._bufferService = b,
- this._coreBrowserService = E,
- this._terminalClass = g++,
- this._rowElements = [],
- this._rowContainer = document.createElement("div"),
- this._rowContainer.classList.add("xterm-rows"),
- this._rowContainer.style.lineHeight = "normal",
- this._rowContainer.setAttribute("aria-hidden", "true"),
- this._refreshRowElements(this._bufferService.cols, this._bufferService.rows),
- this._selectionContainer = document.createElement("div"),
- this._selectionContainer.classList.add("xterm-selection"),
- this._selectionContainer.setAttribute("aria-hidden", "true"),
- this.dimensions = {
- scaledCharWidth: 0,
- scaledCharHeight: 0,
- scaledCellWidth: 0,
- scaledCellHeight: 0,
- scaledCharLeft: 0,
- scaledCharTop: 0,
- scaledCanvasWidth: 0,
- scaledCanvasHeight: 0,
- canvasWidth: 0,
- canvasHeight: 0,
- actualCellWidth: 0,
- actualCellHeight: 0
- },
- this._updateDimensions(),
- this._injectCss(),
- this._rowFactory = L.createInstance(h.DomRendererRowFactory, document, this._colors),
- this._element.classList.add(i + this._terminalClass),
- this._screenElement.appendChild(this._rowContainer),
- this._screenElement.appendChild(this._selectionContainer),
- this.register(this._linkifier2.onShowLinkUnderline(A => this._onLinkHover(A))),
- this.register(this._linkifier2.onHideLinkUnderline(A => this._onLinkLeave(A)))
- }
- get onRequestRedraw() {
- return new t.EventEmitter().event
- }
- dispose() {
- this._element.classList.remove(i + this._terminalClass),
- (0,
- e.removeElementFromParent)(this._rowContainer, this._selectionContainer, this._themeStyleElement, this._dimensionsStyleElement),
- super.dispose()
- }
- _updateDimensions() {
- const S = this._coreBrowserService.dpr;
- this.dimensions.scaledCharWidth = this._charSizeService.width * S,
- this.dimensions.scaledCharHeight = Math.ceil(this._charSizeService.height * S),
- this.dimensions.scaledCellWidth = this.dimensions.scaledCharWidth + Math.round(this._optionsService.rawOptions.letterSpacing),
- this.dimensions.scaledCellHeight = Math.floor(this.dimensions.scaledCharHeight * this._optionsService.rawOptions.lineHeight),
- this.dimensions.scaledCharLeft = 0,
- this.dimensions.scaledCharTop = 0,
- this.dimensions.scaledCanvasWidth = this.dimensions.scaledCellWidth * this._bufferService.cols,
- this.dimensions.scaledCanvasHeight = this.dimensions.scaledCellHeight * this._bufferService.rows,
- this.dimensions.canvasWidth = Math.round(this.dimensions.scaledCanvasWidth / S),
- this.dimensions.canvasHeight = Math.round(this.dimensions.scaledCanvasHeight / S),
- this.dimensions.actualCellWidth = this.dimensions.canvasWidth / this._bufferService.cols,
- this.dimensions.actualCellHeight = this.dimensions.canvasHeight / this._bufferService.rows;
- for (const m of this._rowElements)
- m.style.width = `${this.dimensions.canvasWidth}px`,
- m.style.height = `${this.dimensions.actualCellHeight}px`,
- m.style.lineHeight = `${this.dimensions.actualCellHeight}px`,
- m.style.overflow = "hidden";
- this._dimensionsStyleElement || (this._dimensionsStyleElement = document.createElement("style"),
- this._screenElement.appendChild(this._dimensionsStyleElement));
- const u = `${this._terminalSelector} .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: ${this.dimensions.actualCellWidth}px}`;
- this._dimensionsStyleElement.textContent = u,
- this._selectionContainer.style.height = this._viewportElement.style.height,
- this._screenElement.style.width = `${this.dimensions.canvasWidth}px`,
- this._screenElement.style.height = `${this.dimensions.canvasHeight}px`
- }
- setColors(S) {
- this._colors = S,
- this._injectCss()
- }
- _injectCss() {
- this._themeStyleElement || (this._themeStyleElement = document.createElement("style"),
- this._screenElement.appendChild(this._themeStyleElement));
- let S = `${this._terminalSelector} .xterm-rows { color: ${this._colors.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px;}`;
- S += `${this._terminalSelector} span:not(.${h.BOLD_CLASS}) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.${h.BOLD_CLASS} { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.${h.ITALIC_CLASS} { font-style: italic;}`,
- S += "@keyframes blink_box_shadow_" + this._terminalClass + " { 50% { box-shadow: none; }}",
- S += "@keyframes blink_block_" + this._terminalClass + ` { 0% { background-color: ${this._colors.cursor.css}; color: ${this._colors.cursorAccent.css}; } 50% { background-color: ${this._colors.cursorAccent.css}; color: ${this._colors.cursor.css}; }}`,
- S += `${this._terminalSelector} .xterm-rows:not(.xterm-focus) .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_BLOCK_CLASS} { outline: 1px solid ${this._colors.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .xterm-rows.xterm-focus .${h.CURSOR_CLASS}.${h.CURSOR_BLINK_CLASS}:not(.${h.CURSOR_STYLE_BLOCK_CLASS}) { animation: blink_box_shadow_` + this._terminalClass + ` 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .${h.CURSOR_CLASS}.${h.CURSOR_BLINK_CLASS}.${h.CURSOR_STYLE_BLOCK_CLASS} { animation: blink_block_` + this._terminalClass + ` 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_BLOCK_CLASS} { background-color: ${this._colors.cursor.css}; color: ${this._colors.cursorAccent.css};}${this._terminalSelector} .xterm-rows .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_BAR_CLASS} { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${this._colors.cursor.css} inset;}${this._terminalSelector} .xterm-rows .${h.CURSOR_CLASS}.${h.CURSOR_STYLE_UNDERLINE_CLASS} { box-shadow: 0 -1px 0 ${this._colors.cursor.css} inset;}`,
- S += `${this._terminalSelector} .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .xterm-selection div { position: absolute; background-color: ${this._colors.selectionBackgroundOpaque.css};}${this._terminalSelector} .xterm-selection div { position: absolute; background-color: ${this._colors.selectionInactiveBackgroundOpaque.css};}`,
- this._colors.ansi.forEach((u, m) => {
- S += `${this._terminalSelector} .xterm-fg-${m} { color: ${u.css}; }${this._terminalSelector} .xterm-bg-${m} { background-color: ${u.css}; }`
- }
- ),
- S += `${this._terminalSelector} .xterm-fg-${f.INVERTED_DEFAULT_COLOR} { color: ${s.color.opaque(this._colors.background).css}; }${this._terminalSelector} .xterm-bg-${f.INVERTED_DEFAULT_COLOR} { background-color: ${this._colors.foreground.css}; }`,
- this._themeStyleElement.textContent = S
- }
- onDevicePixelRatioChange() {
- this._updateDimensions()
- }
- _refreshRowElements(S, u) {
- for (let m = this._rowElements.length; m <= u; m++) {
- const w = document.createElement("div");
- this._rowContainer.appendChild(w),
- this._rowElements.push(w)
- }
- for (; this._rowElements.length > u;)
- this._rowContainer.removeChild(this._rowElements.pop())
- }
- onResize(S, u) {
- this._refreshRowElements(S, u),
- this._updateDimensions()
- }
- onCharSizeChanged() {
- this._updateDimensions()
- }
- onBlur() {
- this._rowContainer.classList.remove(c)
- }
- onFocus() {
- this._rowContainer.classList.add(c)
- }
- onSelectionChanged(S, u, m) {
- for (; this._selectionContainer.children.length;)
- this._selectionContainer.removeChild(this._selectionContainer.children[0]);
- if (this._rowFactory.onSelectionChanged(S, u, m),
- this.renderRows(0, this._bufferService.rows - 1),
- !S || !u)
- return;
- const w = S[1] - this._bufferService.buffer.ydisp
- , R = u[1] - this._bufferService.buffer.ydisp
- , L = Math.max(w, 0)
- , p = Math.min(R, this._bufferService.rows - 1);
- if (L >= this._bufferService.rows || p < 0)
- return;
- const C = document.createDocumentFragment();
- if (m) {
- const b = S[0] > u[0];
- C.appendChild(this._createSelectionElement(L, b ? u[0] : S[0], b ? S[0] : u[0], p - L + 1))
- } else {
- const b = w === L ? S[0] : 0
- , E = L === R ? u[0] : this._bufferService.cols;
- C.appendChild(this._createSelectionElement(L, b, E));
- const A = p - L - 1;
- if (C.appendChild(this._createSelectionElement(L + 1, 0, this._bufferService.cols, A)),
- L !== p) {
- const H = R === p ? u[0] : this._bufferService.cols;
- C.appendChild(this._createSelectionElement(p, 0, H))
- }
- }
- this._selectionContainer.appendChild(C)
- }
- _createSelectionElement(S, u, m, w = 1) {
- const R = document.createElement("div");
- return R.style.height = w * this.dimensions.actualCellHeight + "px",
- R.style.top = S * this.dimensions.actualCellHeight + "px",
- R.style.left = u * this.dimensions.actualCellWidth + "px",
- R.style.width = this.dimensions.actualCellWidth * (m - u) + "px",
- R
- }
- onCursorMove() { }
- onOptionsChanged() {
- this._updateDimensions(),
- this._injectCss()
- }
- clear() {
- for (const S of this._rowElements)
- S.innerText = ""
- }
- renderRows(S, u) {
- const m = this._bufferService.buffer.ybase + this._bufferService.buffer.y
- , w = Math.min(this._bufferService.buffer.x, this._bufferService.cols - 1)
- , R = this._optionsService.rawOptions.cursorBlink;
- for (let L = S; L <= u; L++) {
- const p = this._rowElements[L];
- p.innerText = "";
- const C = L + this._bufferService.buffer.ydisp
- , b = this._bufferService.buffer.lines.get(C)
- , E = this._optionsService.rawOptions.cursorStyle;
- p.appendChild(this._rowFactory.createRow(b, C, C === m, E, w, R, this.dimensions.actualCellWidth, this._bufferService.cols))
- }
- }
- get _terminalSelector() {
- return `.${i}${this._terminalClass}`
- }
- _onLinkHover(S) {
- this._setCellUnderline(S.x1, S.x2, S.y1, S.y2, S.cols, !0)
- }
- _onLinkLeave(S) {
- this._setCellUnderline(S.x1, S.x2, S.y1, S.y2, S.cols, !1)
- }
- _setCellUnderline(S, u, m, w, R, L) {
- for (; S !== u || m !== w;) {
- const p = this._rowElements[m];
- if (!p)
- return;
- const C = p.children[S];
- C && (C.style.textDecoration = L ? "underline" : "none"),
- ++S >= R && (S = 0,
- m++)
- }
- }
- }
- ;
- v = n([_(5, o.IInstantiationService), _(6, l.ICharSizeService), _(7, o.IOptionsService), _(8, o.IBufferService), _(9, l.ICoreBrowserService)], v),
- r.DomRenderer = v
- },
- 3787: function (x, r, a) {
- var n = this && this.__decorate || function (v, S, u, m) {
- var w, R = arguments.length, L = R < 3 ? S : m === null ? m = Object.getOwnPropertyDescriptor(S, u) : m;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- L = Reflect.decorate(v, S, u, m);
- else
- for (var p = v.length - 1; p >= 0; p--)
- (w = v[p]) && (L = (R < 3 ? w(L) : R > 3 ? w(S, u, L) : w(S, u)) || L);
- return R > 3 && L && Object.defineProperty(S, u, L),
- L
- }
- , _ = this && this.__param || function (v, S) {
- return function (u, m) {
- S(u, m, v)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.DomRendererRowFactory = r.CURSOR_STYLE_UNDERLINE_CLASS = r.CURSOR_STYLE_BAR_CLASS = r.CURSOR_STYLE_BLOCK_CLASS = r.CURSOR_BLINK_CLASS = r.CURSOR_CLASS = r.STRIKETHROUGH_CLASS = r.UNDERLINE_CLASS = r.ITALIC_CLASS = r.DIM_CLASS = r.BOLD_CLASS = void 0;
- const h = a(8036)
- , f = a(643)
- , d = a(511)
- , l = a(2585)
- , o = a(8055)
- , t = a(4725)
- , s = a(4269)
- , e = a(1752)
- , i = a(3734);
- r.BOLD_CLASS = "xterm-bold",
- r.DIM_CLASS = "xterm-dim",
- r.ITALIC_CLASS = "xterm-italic",
- r.UNDERLINE_CLASS = "xterm-underline",
- r.STRIKETHROUGH_CLASS = "xterm-strikethrough",
- r.CURSOR_CLASS = "xterm-cursor",
- r.CURSOR_BLINK_CLASS = "xterm-cursor-blink",
- r.CURSOR_STYLE_BLOCK_CLASS = "xterm-cursor-block",
- r.CURSOR_STYLE_BAR_CLASS = "xterm-cursor-bar",
- r.CURSOR_STYLE_UNDERLINE_CLASS = "xterm-cursor-underline";
- let c = class {
- constructor(v, S, u, m, w, R, L) {
- this._document = v,
- this._colors = S,
- this._characterJoinerService = u,
- this._optionsService = m,
- this._coreBrowserService = w,
- this._coreService = R,
- this._decorationService = L,
- this._workCell = new d.CellData,
- this._columnSelectMode = !1
- }
- setColors(v) {
- this._colors = v
- }
- onSelectionChanged(v, S, u) {
- this._selectionStart = v,
- this._selectionEnd = S,
- this._columnSelectMode = u
- }
- createRow(v, S, u, m, w, R, L, p) {
- const C = this._document.createDocumentFragment()
- , b = this._characterJoinerService.getJoinedCharacters(S);
- let E = 0;
- for (let A = Math.min(v.length, p) - 1; A >= 0; A--)
- if (v.loadCell(A, this._workCell).getCode() !== f.NULL_CELL_CODE || u && A === w) {
- E = A + 1;
- break
- }
- for (let A = 0; A < E; A++) {
- v.loadCell(A, this._workCell);
- let H = this._workCell.getWidth();
- if (H === 0)
- continue;
- let j = !1
- , $ = A
- , P = this._workCell;
- if (b.length > 0 && A === b[0][0]) {
- j = !0;
- const K = b.shift();
- P = new s.JoinedCellData(this._workCell, v.translateToString(!0, K[0], K[1]), K[1] - K[0]),
- $ = K[1] - 1,
- H = P.getWidth()
- }
- const N = this._document.createElement("span");
- if (H > 1 && (N.style.width = L * H + "px"),
- j && (N.style.display = "inline",
- w >= A && w <= $ && (w = A)),
- !this._coreService.isCursorHidden && u && A === w)
- switch (N.classList.add(r.CURSOR_CLASS),
- R && N.classList.add(r.CURSOR_BLINK_CLASS),
- m) {
- case "bar":
- N.classList.add(r.CURSOR_STYLE_BAR_CLASS);
- break;
- case "underline":
- N.classList.add(r.CURSOR_STYLE_UNDERLINE_CLASS);
- break;
- default:
- N.classList.add(r.CURSOR_STYLE_BLOCK_CLASS)
- }
- if (P.isBold() && N.classList.add(r.BOLD_CLASS),
- P.isItalic() && N.classList.add(r.ITALIC_CLASS),
- P.isDim() && N.classList.add(r.DIM_CLASS),
- P.isInvisible() ? N.textContent = f.WHITESPACE_CELL_CHAR : N.textContent = P.getChars() || f.WHITESPACE_CELL_CHAR,
- P.isUnderline() && (N.classList.add(`${r.UNDERLINE_CLASS}-${P.extended.underlineStyle}`),
- N.textContent === " " && (N.innerHTML = " "),
- !P.isUnderlineColorDefault()))
- if (P.isUnderlineColorRGB())
- N.style.textDecorationColor = `rgb(${i.AttributeData.toColorRGB(P.getUnderlineColor()).join(",")})`;
- else {
- let K = P.getUnderlineColor();
- this._optionsService.rawOptions.drawBoldTextInBrightColors && P.isBold() && K < 8 && (K += 8),
- N.style.textDecorationColor = this._colors.ansi[K].css
- }
- P.isStrikethrough() && N.classList.add(r.STRIKETHROUGH_CLASS);
- let y = P.getFgColor()
- , T = P.getFgColorMode()
- , O = P.getBgColor()
- , k = P.getBgColorMode();
- const D = !!P.isInverse();
- if (D) {
- const K = y;
- y = O,
- O = K;
- const Z = T;
- T = k,
- k = Z
- }
- let B, I, F = !1;
- this._decorationService.forEachDecorationAtCell(A, S, void 0, K => {
- K.options.layer !== "top" && F || (K.backgroundColorRGB && (k = 50331648,
- O = K.backgroundColorRGB.rgba >> 8 & 16777215,
- B = K.backgroundColorRGB),
- K.foregroundColorRGB && (T = 50331648,
- y = K.foregroundColorRGB.rgba >> 8 & 16777215,
- I = K.foregroundColorRGB),
- F = K.options.layer === "top")
- }
- );
- const M = this._isCellInSelection(A, S);
- let X;
- switch (F || this._colors.selectionForeground && M && (T = 50331648,
- y = this._colors.selectionForeground.rgba >> 8 & 16777215,
- I = this._colors.selectionForeground),
- M && (B = this._coreBrowserService.isFocused ? this._colors.selectionBackgroundOpaque : this._colors.selectionInactiveBackgroundOpaque,
- F = !0),
- F && N.classList.add("xterm-decoration-top"),
- k) {
- case 16777216:
- case 33554432:
- X = this._colors.ansi[O],
- N.classList.add(`xterm-bg-${O}`);
- break;
- case 50331648:
- X = o.rgba.toColor(O >> 16, O >> 8 & 255, 255 & O),
- this._addStyle(N, `background-color:#${g((O >>> 0).toString(16), "0", 6)}`);
- break;
- default:
- D ? (X = this._colors.foreground,
- N.classList.add(`xterm-bg-${h.INVERTED_DEFAULT_COLOR}`)) : X = this._colors.background
- }
- switch (B || P.isDim() && (B = o.color.multiplyOpacity(X, .5)),
- T) {
- case 16777216:
- case 33554432:
- P.isBold() && y < 8 && this._optionsService.rawOptions.drawBoldTextInBrightColors && (y += 8),
- this._applyMinimumContrast(N, X, this._colors.ansi[y], P, B, void 0) || N.classList.add(`xterm-fg-${y}`);
- break;
- case 50331648:
- const K = o.rgba.toColor(y >> 16 & 255, y >> 8 & 255, 255 & y);
- this._applyMinimumContrast(N, X, K, P, B, I) || this._addStyle(N, `color:#${g(y.toString(16), "0", 6)}`);
- break;
- default:
- this._applyMinimumContrast(N, X, this._colors.foreground, P, B, void 0) || D && N.classList.add(`xterm-fg-${h.INVERTED_DEFAULT_COLOR}`)
- }
- C.appendChild(N),
- A = $
- }
- return C
- }
- _applyMinimumContrast(v, S, u, m, w, R) {
- if (this._optionsService.rawOptions.minimumContrastRatio === 1 || (0,
- e.excludeFromContrastRatioDemands)(m.getCode()))
- return !1;
- let L;
- return w || R || (L = this._colors.contrastCache.getColor(S.rgba, u.rgba)),
- L === void 0 && (L = o.color.ensureContrastRatio(w || S, R || u, this._optionsService.rawOptions.minimumContrastRatio),
- this._colors.contrastCache.setColor((w || S).rgba, (R || u).rgba, L != null ? L : null)),
- !!L && (this._addStyle(v, `color:${L.css}`),
- !0)
- }
- _addStyle(v, S) {
- v.setAttribute("style", `${v.getAttribute("style") || ""}${S};`)
- }
- _isCellInSelection(v, S) {
- const u = this._selectionStart
- , m = this._selectionEnd;
- return !(!u || !m) && (this._columnSelectMode ? u[0] <= m[0] ? v >= u[0] && S >= u[1] && v < m[0] && S <= m[1] : v < u[0] && S >= u[1] && v >= m[0] && S <= m[1] : S > u[1] && S < m[1] || u[1] === m[1] && S === u[1] && v >= u[0] && v < m[0] || u[1] < m[1] && S === m[1] && v < m[0] || u[1] < m[1] && S === u[1] && v >= u[0])
- }
- }
- ;
- function g(v, S, u) {
- for (; v.length < u;)
- v = S + v;
- return v
- }
- c = n([_(2, t.ICharacterJoinerService), _(3, l.IOptionsService), _(4, t.ICoreBrowserService), _(5, l.ICoreService), _(6, l.IDecorationService)], c),
- r.DomRendererRowFactory = c
- },
- 456: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.SelectionModel = void 0,
- r.SelectionModel = class {
- constructor(a) {
- this._bufferService = a,
- this.isSelectAllActive = !1,
- this.selectionStartLength = 0
- }
- clearSelection() {
- this.selectionStart = void 0,
- this.selectionEnd = void 0,
- this.isSelectAllActive = !1,
- this.selectionStartLength = 0
- }
- get finalSelectionStart() {
- return this.isSelectAllActive ? [0, 0] : this.selectionEnd && this.selectionStart && this.areSelectionValuesReversed() ? this.selectionEnd : this.selectionStart
- }
- get finalSelectionEnd() {
- if (this.isSelectAllActive)
- return [this._bufferService.cols, this._bufferService.buffer.ybase + this._bufferService.rows - 1];
- if (this.selectionStart) {
- if (!this.selectionEnd || this.areSelectionValuesReversed()) {
- const a = this.selectionStart[0] + this.selectionStartLength;
- return a > this._bufferService.cols ? a % this._bufferService.cols == 0 ? [this._bufferService.cols, this.selectionStart[1] + Math.floor(a / this._bufferService.cols) - 1] : [a % this._bufferService.cols, this.selectionStart[1] + Math.floor(a / this._bufferService.cols)] : [a, this.selectionStart[1]]
- }
- if (this.selectionStartLength && this.selectionEnd[1] === this.selectionStart[1]) {
- const a = this.selectionStart[0] + this.selectionStartLength;
- return a > this._bufferService.cols ? [a % this._bufferService.cols, this.selectionStart[1] + Math.floor(a / this._bufferService.cols)] : [Math.max(a, this.selectionEnd[0]), this.selectionEnd[1]]
- }
- return this.selectionEnd
- }
- }
- areSelectionValuesReversed() {
- const a = this.selectionStart
- , n = this.selectionEnd;
- return !(!a || !n) && (a[1] > n[1] || a[1] === n[1] && a[0] > n[0])
- }
- onTrim(a) {
- return this.selectionStart && (this.selectionStart[1] -= a),
- this.selectionEnd && (this.selectionEnd[1] -= a),
- this.selectionEnd && this.selectionEnd[1] < 0 ? (this.clearSelection(),
- !0) : (this.selectionStart && this.selectionStart[1] < 0 && (this.selectionStart[1] = 0),
- !1)
- }
- }
- }
- ,
- 428: function (x, r, a) {
- var n = this && this.__decorate || function (o, t, s, e) {
- var i, c = arguments.length, g = c < 3 ? t : e === null ? e = Object.getOwnPropertyDescriptor(t, s) : e;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- g = Reflect.decorate(o, t, s, e);
- else
- for (var v = o.length - 1; v >= 0; v--)
- (i = o[v]) && (g = (c < 3 ? i(g) : c > 3 ? i(t, s, g) : i(t, s)) || g);
- return c > 3 && g && Object.defineProperty(t, s, g),
- g
- }
- , _ = this && this.__param || function (o, t) {
- return function (s, e) {
- t(s, e, o)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.CharSizeService = void 0;
- const h = a(2585)
- , f = a(8460);
- let d = class {
- constructor(o, t, s) {
- this._optionsService = s,
- this.width = 0,
- this.height = 0,
- this._onCharSizeChange = new f.EventEmitter,
- this._measureStrategy = new l(o, t, this._optionsService)
- }
- get hasValidSize() {
- return this.width > 0 && this.height > 0
- }
- get onCharSizeChange() {
- return this._onCharSizeChange.event
- }
- measure() {
- const o = this._measureStrategy.measure();
- o.width === this.width && o.height === this.height || (this.width = o.width,
- this.height = o.height,
- this._onCharSizeChange.fire())
- }
- }
- ;
- d = n([_(2, h.IOptionsService)], d),
- r.CharSizeService = d;
- class l {
- constructor(t, s, e) {
- this._document = t,
- this._parentElement = s,
- this._optionsService = e,
- this._result = {
- width: 0,
- height: 0
- },
- this._measureElement = this._document.createElement("span"),
- this._measureElement.classList.add("xterm-char-measure-element"),
- this._measureElement.textContent = "W",
- this._measureElement.setAttribute("aria-hidden", "true"),
- this._parentElement.appendChild(this._measureElement)
- }
- measure() {
- this._measureElement.style.fontFamily = this._optionsService.rawOptions.fontFamily,
- this._measureElement.style.fontSize = `${this._optionsService.rawOptions.fontSize}px`;
- const t = this._measureElement.getBoundingClientRect();
- return t.width !== 0 && t.height !== 0 && (this._result.width = t.width,
- this._result.height = Math.ceil(t.height)),
- this._result
- }
- }
- },
- 4269: function (x, r, a) {
- var n = this && this.__decorate || function (s, e, i, c) {
- var g, v = arguments.length, S = v < 3 ? e : c === null ? c = Object.getOwnPropertyDescriptor(e, i) : c;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- S = Reflect.decorate(s, e, i, c);
- else
- for (var u = s.length - 1; u >= 0; u--)
- (g = s[u]) && (S = (v < 3 ? g(S) : v > 3 ? g(e, i, S) : g(e, i)) || S);
- return v > 3 && S && Object.defineProperty(e, i, S),
- S
- }
- , _ = this && this.__param || function (s, e) {
- return function (i, c) {
- e(i, c, s)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.CharacterJoinerService = r.JoinedCellData = void 0;
- const h = a(3734)
- , f = a(643)
- , d = a(511)
- , l = a(2585);
- class o extends h.AttributeData {
- constructor(e, i, c) {
- super(),
- this.content = 0,
- this.combinedData = "",
- this.fg = e.fg,
- this.bg = e.bg,
- this.combinedData = i,
- this._width = c
- }
- isCombined() {
- return 2097152
- }
- getWidth() {
- return this._width
- }
- getChars() {
- return this.combinedData
- }
- getCode() {
- return 2097151
- }
- setFromCharData(e) {
- throw new Error("not implemented")
- }
- getAsCharData() {
- return [this.fg, this.getChars(), this.getWidth(), this.getCode()]
- }
- }
- r.JoinedCellData = o;
- let t = class be {
- constructor(e) {
- this._bufferService = e,
- this._characterJoiners = [],
- this._nextCharacterJoinerId = 0,
- this._workCell = new d.CellData
- }
- register(e) {
- const i = {
- id: this._nextCharacterJoinerId++,
- handler: e
- };
- return this._characterJoiners.push(i),
- i.id
- }
- deregister(e) {
- for (let i = 0; i < this._characterJoiners.length; i++)
- if (this._characterJoiners[i].id === e)
- return this._characterJoiners.splice(i, 1),
- !0;
- return !1
- }
- getJoinedCharacters(e) {
- if (this._characterJoiners.length === 0)
- return [];
- const i = this._bufferService.buffer.lines.get(e);
- if (!i || i.length === 0)
- return [];
- const c = []
- , g = i.translateToString(!0);
- let v = 0
- , S = 0
- , u = 0
- , m = i.getFg(0)
- , w = i.getBg(0);
- for (let R = 0; R < i.getTrimmedLength(); R++)
- if (i.loadCell(R, this._workCell),
- this._workCell.getWidth() !== 0) {
- if (this._workCell.fg !== m || this._workCell.bg !== w) {
- if (R - v > 1) {
- const L = this._getJoinedRanges(g, u, S, i, v);
- for (let p = 0; p < L.length; p++)
- c.push(L[p])
- }
- v = R,
- u = S,
- m = this._workCell.fg,
- w = this._workCell.bg
- }
- S += this._workCell.getChars().length || f.WHITESPACE_CELL_CHAR.length
- }
- if (this._bufferService.cols - v > 1) {
- const R = this._getJoinedRanges(g, u, S, i, v);
- for (let L = 0; L < R.length; L++)
- c.push(R[L])
- }
- return c
- }
- _getJoinedRanges(e, i, c, g, v) {
- const S = e.substring(i, c);
- let u = [];
- try {
- u = this._characterJoiners[0].handler(S)
- } catch (m) {
- console.error(m)
- }
- for (let m = 1; m < this._characterJoiners.length; m++)
- try {
- const w = this._characterJoiners[m].handler(S);
- for (let R = 0; R < w.length; R++)
- be._mergeRanges(u, w[R])
- } catch (w) {
- console.error(w)
- }
- return this._stringRangesToCellRanges(u, g, v),
- u
- }
- _stringRangesToCellRanges(e, i, c) {
- let g = 0
- , v = !1
- , S = 0
- , u = e[g];
- if (u) {
- for (let m = c; m < this._bufferService.cols; m++) {
- const w = i.getWidth(m)
- , R = i.getString(m).length || f.WHITESPACE_CELL_CHAR.length;
- if (w !== 0) {
- if (!v && u[0] <= S && (u[0] = m,
- v = !0),
- u[1] <= S) {
- if (u[1] = m,
- u = e[++g],
- !u)
- break;
- u[0] <= S ? (u[0] = m,
- v = !0) : v = !1
- }
- S += R
- }
- }
- u && (u[1] = this._bufferService.cols)
- }
- }
- static _mergeRanges(e, i) {
- let c = !1;
- for (let g = 0; g < e.length; g++) {
- const v = e[g];
- if (c) {
- if (i[1] <= v[0])
- return e[g - 1][1] = i[1],
- e;
- if (i[1] <= v[1])
- return e[g - 1][1] = Math.max(i[1], v[1]),
- e.splice(g, 1),
- e;
- e.splice(g, 1),
- g--
- } else {
- if (i[1] <= v[0])
- return e.splice(g, 0, i),
- e;
- if (i[1] <= v[1])
- return v[0] = Math.min(i[0], v[0]),
- e;
- i[0] < v[1] && (v[0] = Math.min(i[0], v[0]),
- c = !0)
- }
- }
- return c ? e[e.length - 1][1] = i[1] : e.push(i),
- e
- }
- }
- ;
- t = n([_(0, l.IBufferService)], t),
- r.CharacterJoinerService = t
- },
- 5114: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.CoreBrowserService = void 0,
- r.CoreBrowserService = class {
- constructor(a, n) {
- this._textarea = a,
- this.window = n
- }
- get dpr() {
- return this.window.devicePixelRatio
- }
- get isFocused() {
- return (this._textarea.getRootNode ? this._textarea.getRootNode() : this._textarea.ownerDocument).activeElement === this._textarea && this._textarea.ownerDocument.hasFocus()
- }
- }
- }
- ,
- 8934: function (x, r, a) {
- var n = this && this.__decorate || function (l, o, t, s) {
- var e, i = arguments.length, c = i < 3 ? o : s === null ? s = Object.getOwnPropertyDescriptor(o, t) : s;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- c = Reflect.decorate(l, o, t, s);
- else
- for (var g = l.length - 1; g >= 0; g--)
- (e = l[g]) && (c = (i < 3 ? e(c) : i > 3 ? e(o, t, c) : e(o, t)) || c);
- return i > 3 && c && Object.defineProperty(o, t, c),
- c
- }
- , _ = this && this.__param || function (l, o) {
- return function (t, s) {
- o(t, s, l)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.MouseService = void 0;
- const h = a(4725)
- , f = a(9806);
- let d = class {
- constructor(l, o) {
- this._renderService = l,
- this._charSizeService = o
- }
- getCoords(l, o, t, s, e) {
- return (0,
- f.getCoords)(window, l, o, t, s, this._charSizeService.hasValidSize, this._renderService.dimensions.actualCellWidth, this._renderService.dimensions.actualCellHeight, e)
- }
- getMouseReportCoords(l, o) {
- const t = (0,
- f.getCoordsRelativeToElement)(window, l, o);
- if (!(!this._charSizeService.hasValidSize || t[0] < 0 || t[1] < 0 || t[0] >= this._renderService.dimensions.canvasWidth || t[1] >= this._renderService.dimensions.canvasHeight))
- return {
- col: Math.floor(t[0] / this._renderService.dimensions.actualCellWidth),
- row: Math.floor(t[1] / this._renderService.dimensions.actualCellHeight),
- x: Math.floor(t[0]),
- y: Math.floor(t[1])
- }
- }
- }
- ;
- d = n([_(0, h.IRenderService), _(1, h.ICharSizeService)], d),
- r.MouseService = d
- },
- 3230: function (x, r, a) {
- var n = this && this.__decorate || function (i, c, g, v) {
- var S, u = arguments.length, m = u < 3 ? c : v === null ? v = Object.getOwnPropertyDescriptor(c, g) : v;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- m = Reflect.decorate(i, c, g, v);
- else
- for (var w = i.length - 1; w >= 0; w--)
- (S = i[w]) && (m = (u < 3 ? S(m) : u > 3 ? S(c, g, m) : S(c, g)) || m);
- return u > 3 && m && Object.defineProperty(c, g, m),
- m
- }
- , _ = this && this.__param || function (i, c) {
- return function (g, v) {
- c(g, v, i)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.RenderService = void 0;
- const h = a(6193)
- , f = a(8460)
- , d = a(844)
- , l = a(5596)
- , o = a(3656)
- , t = a(2585)
- , s = a(4725);
- let e = class extends d.Disposable {
- constructor(i, c, g, v, S, u, m, w) {
- if (super(),
- this._renderer = i,
- this._rowCount = c,
- this._charSizeService = S,
- this._isPaused = !1,
- this._needsFullRefresh = !1,
- this._isNextRenderRedrawOnly = !0,
- this._needsSelectionRefresh = !1,
- this._canvasWidth = 0,
- this._canvasHeight = 0,
- this._selectionState = {
- start: void 0,
- end: void 0,
- columnSelectMode: !1
- },
- this._onDimensionsChange = new f.EventEmitter,
- this._onRenderedViewportChange = new f.EventEmitter,
- this._onRender = new f.EventEmitter,
- this._onRefreshRequest = new f.EventEmitter,
- this.register({
- dispose: () => this._renderer.dispose()
- }),
- this._renderDebouncer = new h.RenderDebouncer(w.window, (R, L) => this._renderRows(R, L)),
- this.register(this._renderDebouncer),
- this._screenDprMonitor = new l.ScreenDprMonitor(w.window),
- this._screenDprMonitor.setListener(() => this.onDevicePixelRatioChange()),
- this.register(this._screenDprMonitor),
- this.register(m.onResize(() => this._fullRefresh())),
- this.register(m.buffers.onBufferActivate(() => {
- var R;
- return (R = this._renderer) === null || R === void 0 ? void 0 : R.clear()
- }
- )),
- this.register(v.onOptionChange(() => this._handleOptionsChanged())),
- this.register(this._charSizeService.onCharSizeChange(() => this.onCharSizeChanged())),
- this.register(u.onDecorationRegistered(() => this._fullRefresh())),
- this.register(u.onDecorationRemoved(() => this._fullRefresh())),
- this._renderer.onRequestRedraw(R => this.refreshRows(R.start, R.end, !0)),
- this.register((0,
- o.addDisposableDomListener)(w.window, "resize", () => this.onDevicePixelRatioChange())),
- "IntersectionObserver" in w.window) {
- const R = new w.window.IntersectionObserver(L => this._onIntersectionChange(L[L.length - 1]), {
- threshold: 0
- });
- R.observe(g),
- this.register({
- dispose: () => R.disconnect()
- })
- }
- }
- get onDimensionsChange() {
- return this._onDimensionsChange.event
- }
- get onRenderedViewportChange() {
- return this._onRenderedViewportChange.event
- }
- get onRender() {
- return this._onRender.event
- }
- get onRefreshRequest() {
- return this._onRefreshRequest.event
- }
- get dimensions() {
- return this._renderer.dimensions
- }
- _onIntersectionChange(i) {
- this._isPaused = i.isIntersecting === void 0 ? i.intersectionRatio === 0 : !i.isIntersecting,
- this._isPaused || this._charSizeService.hasValidSize || this._charSizeService.measure(),
- !this._isPaused && this._needsFullRefresh && (this.refreshRows(0, this._rowCount - 1),
- this._needsFullRefresh = !1)
- }
- refreshRows(i, c, g = !1) {
- this._isPaused ? this._needsFullRefresh = !0 : (g || (this._isNextRenderRedrawOnly = !1),
- this._renderDebouncer.refresh(i, c, this._rowCount))
- }
- _renderRows(i, c) {
- this._renderer.renderRows(i, c),
- this._needsSelectionRefresh && (this._renderer.onSelectionChanged(this._selectionState.start, this._selectionState.end, this._selectionState.columnSelectMode),
- this._needsSelectionRefresh = !1),
- this._isNextRenderRedrawOnly || this._onRenderedViewportChange.fire({
- start: i,
- end: c
- }),
- this._onRender.fire({
- start: i,
- end: c
- }),
- this._isNextRenderRedrawOnly = !0
- }
- resize(i, c) {
- this._rowCount = c,
- this._fireOnCanvasResize()
- }
- _handleOptionsChanged() {
- this._renderer.onOptionsChanged(),
- this.refreshRows(0, this._rowCount - 1),
- this._fireOnCanvasResize()
- }
- _fireOnCanvasResize() {
- this._renderer.dimensions.canvasWidth === this._canvasWidth && this._renderer.dimensions.canvasHeight === this._canvasHeight || this._onDimensionsChange.fire(this._renderer.dimensions)
- }
- dispose() {
- super.dispose()
- }
- setRenderer(i) {
- this._renderer.dispose(),
- this._renderer = i,
- this._renderer.onRequestRedraw(c => this.refreshRows(c.start, c.end, !0)),
- this._needsSelectionRefresh = !0,
- this._fullRefresh()
- }
- addRefreshCallback(i) {
- return this._renderDebouncer.addRefreshCallback(i)
- }
- _fullRefresh() {
- this._isPaused ? this._needsFullRefresh = !0 : this.refreshRows(0, this._rowCount - 1)
- }
- clearTextureAtlas() {
- var i, c;
- (c = (i = this._renderer) === null || i === void 0 ? void 0 : i.clearTextureAtlas) === null || c === void 0 || c.call(i),
- this._fullRefresh()
- }
- setColors(i) {
- this._renderer.setColors(i),
- this._fullRefresh()
- }
- onDevicePixelRatioChange() {
- this._charSizeService.measure(),
- this._renderer.onDevicePixelRatioChange(),
- this.refreshRows(0, this._rowCount - 1)
- }
- onResize(i, c) {
- this._renderer.onResize(i, c),
- this._fullRefresh()
- }
- onCharSizeChanged() {
- this._renderer.onCharSizeChanged()
- }
- onBlur() {
- this._renderer.onBlur()
- }
- onFocus() {
- this._renderer.onFocus()
- }
- onSelectionChanged(i, c, g) {
- this._selectionState.start = i,
- this._selectionState.end = c,
- this._selectionState.columnSelectMode = g,
- this._renderer.onSelectionChanged(i, c, g)
- }
- onCursorMove() {
- this._renderer.onCursorMove()
- }
- clear() {
- this._renderer.clear()
- }
- }
- ;
- e = n([_(3, t.IOptionsService), _(4, s.ICharSizeService), _(5, t.IDecorationService), _(6, t.IBufferService), _(7, s.ICoreBrowserService)], e),
- r.RenderService = e
- },
- 9312: function (x, r, a) {
- var n = this && this.__decorate || function (u, m, w, R) {
- var L, p = arguments.length, C = p < 3 ? m : R === null ? R = Object.getOwnPropertyDescriptor(m, w) : R;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- C = Reflect.decorate(u, m, w, R);
- else
- for (var b = u.length - 1; b >= 0; b--)
- (L = u[b]) && (C = (p < 3 ? L(C) : p > 3 ? L(m, w, C) : L(m, w)) || C);
- return p > 3 && C && Object.defineProperty(m, w, C),
- C
- }
- , _ = this && this.__param || function (u, m) {
- return function (w, R) {
- m(w, R, u)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.SelectionService = void 0;
- const h = a(6114)
- , f = a(456)
- , d = a(511)
- , l = a(8460)
- , o = a(4725)
- , t = a(2585)
- , s = a(9806)
- , e = a(9504)
- , i = a(844)
- , c = a(4841)
- , g = String.fromCharCode(160)
- , v = new RegExp(g, "g");
- let S = class extends i.Disposable {
- constructor(u, m, w, R, L, p, C, b, E) {
- super(),
- this._element = u,
- this._screenElement = m,
- this._linkifier = w,
- this._bufferService = R,
- this._coreService = L,
- this._mouseService = p,
- this._optionsService = C,
- this._renderService = b,
- this._coreBrowserService = E,
- this._dragScrollAmount = 0,
- this._enabled = !0,
- this._workCell = new d.CellData,
- this._mouseDownTimeStamp = 0,
- this._oldHasSelection = !1,
- this._oldSelectionStart = void 0,
- this._oldSelectionEnd = void 0,
- this._onLinuxMouseSelection = this.register(new l.EventEmitter),
- this._onRedrawRequest = this.register(new l.EventEmitter),
- this._onSelectionChange = this.register(new l.EventEmitter),
- this._onRequestScrollLines = this.register(new l.EventEmitter),
- this._mouseMoveListener = A => this._onMouseMove(A),
- this._mouseUpListener = A => this._onMouseUp(A),
- this._coreService.onUserInput(() => {
- this.hasSelection && this.clearSelection()
- }
- ),
- this._trimListener = this._bufferService.buffer.lines.onTrim(A => this._onTrim(A)),
- this.register(this._bufferService.buffers.onBufferActivate(A => this._onBufferActivate(A))),
- this.enable(),
- this._model = new f.SelectionModel(this._bufferService),
- this._activeSelectionMode = 0
- }
- get onLinuxMouseSelection() {
- return this._onLinuxMouseSelection.event
- }
- get onRequestRedraw() {
- return this._onRedrawRequest.event
- }
- get onSelectionChange() {
- return this._onSelectionChange.event
- }
- get onRequestScrollLines() {
- return this._onRequestScrollLines.event
- }
- dispose() {
- this._removeMouseDownListeners()
- }
- reset() {
- this.clearSelection()
- }
- disable() {
- this.clearSelection(),
- this._enabled = !1
- }
- enable() {
- this._enabled = !0
- }
- get selectionStart() {
- return this._model.finalSelectionStart
- }
- get selectionEnd() {
- return this._model.finalSelectionEnd
- }
- get hasSelection() {
- const u = this._model.finalSelectionStart
- , m = this._model.finalSelectionEnd;
- return !(!u || !m || u[0] === m[0] && u[1] === m[1])
- }
- get selectionText() {
- const u = this._model.finalSelectionStart
- , m = this._model.finalSelectionEnd;
- if (!u || !m)
- return "";
- const w = this._bufferService.buffer
- , R = [];
- if (this._activeSelectionMode === 3) {
- if (u[0] === m[0])
- return "";
- const L = u[0] < m[0] ? u[0] : m[0]
- , p = u[0] < m[0] ? m[0] : u[0];
- for (let C = u[1]; C <= m[1]; C++) {
- const b = w.translateBufferLineToString(C, !0, L, p);
- R.push(b)
- }
- } else {
- const L = u[1] === m[1] ? m[0] : void 0;
- R.push(w.translateBufferLineToString(u[1], !0, u[0], L));
- for (let p = u[1] + 1; p <= m[1] - 1; p++) {
- const C = w.lines.get(p)
- , b = w.translateBufferLineToString(p, !0);
- C != null && C.isWrapped ? R[R.length - 1] += b : R.push(b)
- }
- if (u[1] !== m[1]) {
- const p = w.lines.get(m[1])
- , C = w.translateBufferLineToString(m[1], !0, 0, m[0]);
- p && p.isWrapped ? R[R.length - 1] += C : R.push(C)
- }
- }
- return R.map(L => L.replace(v, " ")).join(h.isWindows ? `\r
- ` : `
- `)
- }
- clearSelection() {
- this._model.clearSelection(),
- this._removeMouseDownListeners(),
- this.refresh(),
- this._onSelectionChange.fire()
- }
- refresh(u) {
- this._refreshAnimationFrame || (this._refreshAnimationFrame = this._coreBrowserService.window.requestAnimationFrame(() => this._refresh())),
- h.isLinux && u && this.selectionText.length && this._onLinuxMouseSelection.fire(this.selectionText)
- }
- _refresh() {
- this._refreshAnimationFrame = void 0,
- this._onRedrawRequest.fire({
- start: this._model.finalSelectionStart,
- end: this._model.finalSelectionEnd,
- columnSelectMode: this._activeSelectionMode === 3
- })
- }
- _isClickInSelection(u) {
- const m = this._getMouseBufferCoords(u)
- , w = this._model.finalSelectionStart
- , R = this._model.finalSelectionEnd;
- return !!(w && R && m) && this._areCoordsInSelection(m, w, R)
- }
- isCellInSelection(u, m) {
- const w = this._model.finalSelectionStart
- , R = this._model.finalSelectionEnd;
- return !(!w || !R) && this._areCoordsInSelection([u, m], w, R)
- }
- _areCoordsInSelection(u, m, w) {
- return u[1] > m[1] && u[1] < w[1] || m[1] === w[1] && u[1] === m[1] && u[0] >= m[0] && u[0] < w[0] || m[1] < w[1] && u[1] === w[1] && u[0] < w[0] || m[1] < w[1] && u[1] === m[1] && u[0] >= m[0]
- }
- _selectWordAtCursor(u, m) {
- var w, R;
- const L = (R = (w = this._linkifier.currentLink) === null || w === void 0 ? void 0 : w.link) === null || R === void 0 ? void 0 : R.range;
- if (L)
- return this._model.selectionStart = [L.start.x - 1, L.start.y - 1],
- this._model.selectionStartLength = (0,
- c.getRangeLength)(L, this._bufferService.cols),
- this._model.selectionEnd = void 0,
- !0;
- const p = this._getMouseBufferCoords(u);
- return !!p && (this._selectWordAt(p, m),
- this._model.selectionEnd = void 0,
- !0)
- }
- selectAll() {
- this._model.isSelectAllActive = !0,
- this.refresh(),
- this._onSelectionChange.fire()
- }
- selectLines(u, m) {
- this._model.clearSelection(),
- u = Math.max(u, 0),
- m = Math.min(m, this._bufferService.buffer.lines.length - 1),
- this._model.selectionStart = [0, u],
- this._model.selectionEnd = [this._bufferService.cols, m],
- this.refresh(),
- this._onSelectionChange.fire()
- }
- _onTrim(u) {
- this._model.onTrim(u) && this.refresh()
- }
- _getMouseBufferCoords(u) {
- const m = this._mouseService.getCoords(u, this._screenElement, this._bufferService.cols, this._bufferService.rows, !0);
- if (m)
- return m[0]--,
- m[1]--,
- m[1] += this._bufferService.buffer.ydisp,
- m
- }
- _getMouseEventScrollAmount(u) {
- let m = (0,
- s.getCoordsRelativeToElement)(this._coreBrowserService.window, u, this._screenElement)[1];
- const w = this._renderService.dimensions.canvasHeight;
- return m >= 0 && m <= w ? 0 : (m > w && (m -= w),
- m = Math.min(Math.max(m, -50), 50),
- m /= 50,
- m / Math.abs(m) + Math.round(14 * m))
- }
- shouldForceSelection(u) {
- return h.isMac ? u.altKey && this._optionsService.rawOptions.macOptionClickForcesSelection : u.shiftKey
- }
- onMouseDown(u) {
- if (this._mouseDownTimeStamp = u.timeStamp,
- (u.button !== 2 || !this.hasSelection) && u.button === 0) {
- if (!this._enabled) {
- if (!this.shouldForceSelection(u))
- return;
- u.stopPropagation()
- }
- u.preventDefault(),
- this._dragScrollAmount = 0,
- this._enabled && u.shiftKey ? this._onIncrementalClick(u) : u.detail === 1 ? this._onSingleClick(u) : u.detail === 2 ? this._onDoubleClick(u) : u.detail === 3 && this._onTripleClick(u),
- this._addMouseDownListeners(),
- this.refresh(!0)
- }
- }
- _addMouseDownListeners() {
- this._screenElement.ownerDocument && (this._screenElement.ownerDocument.addEventListener("mousemove", this._mouseMoveListener),
- this._screenElement.ownerDocument.addEventListener("mouseup", this._mouseUpListener)),
- this._dragScrollIntervalTimer = this._coreBrowserService.window.setInterval(() => this._dragScroll(), 50)
- }
- _removeMouseDownListeners() {
- this._screenElement.ownerDocument && (this._screenElement.ownerDocument.removeEventListener("mousemove", this._mouseMoveListener),
- this._screenElement.ownerDocument.removeEventListener("mouseup", this._mouseUpListener)),
- this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),
- this._dragScrollIntervalTimer = void 0
- }
- _onIncrementalClick(u) {
- this._model.selectionStart && (this._model.selectionEnd = this._getMouseBufferCoords(u))
- }
- _onSingleClick(u) {
- if (this._model.selectionStartLength = 0,
- this._model.isSelectAllActive = !1,
- this._activeSelectionMode = this.shouldColumnSelect(u) ? 3 : 0,
- this._model.selectionStart = this._getMouseBufferCoords(u),
- !this._model.selectionStart)
- return;
- this._model.selectionEnd = void 0;
- const m = this._bufferService.buffer.lines.get(this._model.selectionStart[1]);
- m && m.length !== this._model.selectionStart[0] && m.hasWidth(this._model.selectionStart[0]) === 0 && this._model.selectionStart[0]++
- }
- _onDoubleClick(u) {
- this._selectWordAtCursor(u, !0) && (this._activeSelectionMode = 1)
- }
- _onTripleClick(u) {
- const m = this._getMouseBufferCoords(u);
- m && (this._activeSelectionMode = 2,
- this._selectLineAt(m[1]))
- }
- shouldColumnSelect(u) {
- return u.altKey && !(h.isMac && this._optionsService.rawOptions.macOptionClickForcesSelection)
- }
- _onMouseMove(u) {
- if (u.stopImmediatePropagation(),
- !this._model.selectionStart)
- return;
- const m = this._model.selectionEnd ? [this._model.selectionEnd[0], this._model.selectionEnd[1]] : null;
- if (this._model.selectionEnd = this._getMouseBufferCoords(u),
- !this._model.selectionEnd)
- return void this.refresh(!0);
- this._activeSelectionMode === 2 ? this._model.selectionEnd[1] < this._model.selectionStart[1] ? this._model.selectionEnd[0] = 0 : this._model.selectionEnd[0] = this._bufferService.cols : this._activeSelectionMode === 1 && this._selectToWordAt(this._model.selectionEnd),
- this._dragScrollAmount = this._getMouseEventScrollAmount(u),
- this._activeSelectionMode !== 3 && (this._dragScrollAmount > 0 ? this._model.selectionEnd[0] = this._bufferService.cols : this._dragScrollAmount < 0 && (this._model.selectionEnd[0] = 0));
- const w = this._bufferService.buffer;
- if (this._model.selectionEnd[1] < w.lines.length) {
- const R = w.lines.get(this._model.selectionEnd[1]);
- R && R.hasWidth(this._model.selectionEnd[0]) === 0 && this._model.selectionEnd[0]++
- }
- m && m[0] === this._model.selectionEnd[0] && m[1] === this._model.selectionEnd[1] || this.refresh(!0)
- }
- _dragScroll() {
- if (this._model.selectionEnd && this._model.selectionStart && this._dragScrollAmount) {
- this._onRequestScrollLines.fire({
- amount: this._dragScrollAmount,
- suppressScrollEvent: !1
- });
- const u = this._bufferService.buffer;
- this._dragScrollAmount > 0 ? (this._activeSelectionMode !== 3 && (this._model.selectionEnd[0] = this._bufferService.cols),
- this._model.selectionEnd[1] = Math.min(u.ydisp + this._bufferService.rows, u.lines.length - 1)) : (this._activeSelectionMode !== 3 && (this._model.selectionEnd[0] = 0),
- this._model.selectionEnd[1] = u.ydisp),
- this.refresh()
- }
- }
- _onMouseUp(u) {
- const m = u.timeStamp - this._mouseDownTimeStamp;
- if (this._removeMouseDownListeners(),
- this.selectionText.length <= 1 && m < 500 && u.altKey && this._optionsService.rawOptions.altClickMovesCursor) {
- if (this._bufferService.buffer.ybase === this._bufferService.buffer.ydisp) {
- const w = this._mouseService.getCoords(u, this._element, this._bufferService.cols, this._bufferService.rows, !1);
- if (w && w[0] !== void 0 && w[1] !== void 0) {
- const R = (0,
- e.moveToCellSequence)(w[0] - 1, w[1] - 1, this._bufferService, this._coreService.decPrivateModes.applicationCursorKeys);
- this._coreService.triggerDataEvent(R, !0)
- }
- }
- } else
- this._fireEventIfSelectionChanged()
- }
- _fireEventIfSelectionChanged() {
- const u = this._model.finalSelectionStart
- , m = this._model.finalSelectionEnd
- , w = !(!u || !m || u[0] === m[0] && u[1] === m[1]);
- w ? u && m && (this._oldSelectionStart && this._oldSelectionEnd && u[0] === this._oldSelectionStart[0] && u[1] === this._oldSelectionStart[1] && m[0] === this._oldSelectionEnd[0] && m[1] === this._oldSelectionEnd[1] || this._fireOnSelectionChange(u, m, w)) : this._oldHasSelection && this._fireOnSelectionChange(u, m, w)
- }
- _fireOnSelectionChange(u, m, w) {
- this._oldSelectionStart = u,
- this._oldSelectionEnd = m,
- this._oldHasSelection = w,
- this._onSelectionChange.fire()
- }
- _onBufferActivate(u) {
- this.clearSelection(),
- this._trimListener.dispose(),
- this._trimListener = u.activeBuffer.lines.onTrim(m => this._onTrim(m))
- }
- _convertViewportColToCharacterIndex(u, m) {
- let w = m[0];
- for (let R = 0; m[0] >= R; R++) {
- const L = u.loadCell(R, this._workCell).getChars().length;
- this._workCell.getWidth() === 0 ? w-- : L > 1 && m[0] !== R && (w += L - 1)
- }
- return w
- }
- setSelection(u, m, w) {
- this._model.clearSelection(),
- this._removeMouseDownListeners(),
- this._model.selectionStart = [u, m],
- this._model.selectionStartLength = w,
- this.refresh(),
- this._fireEventIfSelectionChanged()
- }
- rightClickSelect(u) {
- this._isClickInSelection(u) || (this._selectWordAtCursor(u, !1) && this.refresh(!0),
- this._fireEventIfSelectionChanged())
- }
- _getWordAt(u, m, w = !0, R = !0) {
- if (u[0] >= this._bufferService.cols)
- return;
- const L = this._bufferService.buffer
- , p = L.lines.get(u[1]);
- if (!p)
- return;
- const C = L.translateBufferLineToString(u[1], !1);
- let b = this._convertViewportColToCharacterIndex(p, u)
- , E = b;
- const A = u[0] - b;
- let H = 0
- , j = 0
- , $ = 0
- , P = 0;
- if (C.charAt(b) === " ") {
- for (; b > 0 && C.charAt(b - 1) === " ";)
- b--;
- for (; E < C.length && C.charAt(E + 1) === " ";)
- E++
- } else {
- let T = u[0]
- , O = u[0];
- p.getWidth(T) === 0 && (H++,
- T--),
- p.getWidth(O) === 2 && (j++,
- O++);
- const k = p.getString(O).length;
- for (k > 1 && (P += k - 1,
- E += k - 1); T > 0 && b > 0 && !this._isCharWordSeparator(p.loadCell(T - 1, this._workCell));) {
- p.loadCell(T - 1, this._workCell);
- const D = this._workCell.getChars().length;
- this._workCell.getWidth() === 0 ? (H++,
- T--) : D > 1 && ($ += D - 1,
- b -= D - 1),
- b--,
- T--
- }
- for (; O < p.length && E + 1 < C.length && !this._isCharWordSeparator(p.loadCell(O + 1, this._workCell));) {
- p.loadCell(O + 1, this._workCell);
- const D = this._workCell.getChars().length;
- this._workCell.getWidth() === 2 ? (j++,
- O++) : D > 1 && (P += D - 1,
- E += D - 1),
- E++,
- O++
- }
- }
- E++;
- let N = b + A - H + $
- , y = Math.min(this._bufferService.cols, E - b + H + j - $ - P);
- if (m || C.slice(b, E).trim() !== "") {
- if (w && N === 0 && p.getCodePoint(0) !== 32) {
- const T = L.lines.get(u[1] - 1);
- if (T && p.isWrapped && T.getCodePoint(this._bufferService.cols - 1) !== 32) {
- const O = this._getWordAt([this._bufferService.cols - 1, u[1] - 1], !1, !0, !1);
- if (O) {
- const k = this._bufferService.cols - O.start;
- N -= k,
- y += k
- }
- }
- }
- if (R && N + y === this._bufferService.cols && p.getCodePoint(this._bufferService.cols - 1) !== 32) {
- const T = L.lines.get(u[1] + 1);
- if ((T == null ? void 0 : T.isWrapped) && T.getCodePoint(0) !== 32) {
- const O = this._getWordAt([0, u[1] + 1], !1, !1, !0);
- O && (y += O.length)
- }
- }
- return {
- start: N,
- length: y
- }
- }
- }
- _selectWordAt(u, m) {
- const w = this._getWordAt(u, m);
- if (w) {
- for (; w.start < 0;)
- w.start += this._bufferService.cols,
- u[1]--;
- this._model.selectionStart = [w.start, u[1]],
- this._model.selectionStartLength = w.length
- }
- }
- _selectToWordAt(u) {
- const m = this._getWordAt(u, !0);
- if (m) {
- let w = u[1];
- for (; m.start < 0;)
- m.start += this._bufferService.cols,
- w--;
- if (!this._model.areSelectionValuesReversed())
- for (; m.start + m.length > this._bufferService.cols;)
- m.length -= this._bufferService.cols,
- w++;
- this._model.selectionEnd = [this._model.areSelectionValuesReversed() ? m.start : m.start + m.length, w]
- }
- }
- _isCharWordSeparator(u) {
- return u.getWidth() !== 0 && this._optionsService.rawOptions.wordSeparator.indexOf(u.getChars()) >= 0
- }
- _selectLineAt(u) {
- const m = this._bufferService.buffer.getWrappedRangeForLine(u)
- , w = {
- start: {
- x: 0,
- y: m.first
- },
- end: {
- x: this._bufferService.cols - 1,
- y: m.last
- }
- };
- this._model.selectionStart = [0, m.first],
- this._model.selectionEnd = void 0,
- this._model.selectionStartLength = (0,
- c.getRangeLength)(w, this._bufferService.cols)
- }
- }
- ;
- S = n([_(3, t.IBufferService), _(4, t.ICoreService), _(5, o.IMouseService), _(6, t.IOptionsService), _(7, o.IRenderService), _(8, o.ICoreBrowserService)], S),
- r.SelectionService = S
- },
- 4725: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.ICharacterJoinerService = r.ISelectionService = r.IRenderService = r.IMouseService = r.ICoreBrowserService = r.ICharSizeService = void 0;
- const n = a(8343);
- r.ICharSizeService = (0,
- n.createDecorator)("CharSizeService"),
- r.ICoreBrowserService = (0,
- n.createDecorator)("CoreBrowserService"),
- r.IMouseService = (0,
- n.createDecorator)("MouseService"),
- r.IRenderService = (0,
- n.createDecorator)("RenderService"),
- r.ISelectionService = (0,
- n.createDecorator)("SelectionService"),
- r.ICharacterJoinerService = (0,
- n.createDecorator)("CharacterJoinerService")
- }
- ,
- 6349: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.CircularList = void 0;
- const n = a(8460);
- r.CircularList = class {
- constructor(_) {
- this._maxLength = _,
- this.onDeleteEmitter = new n.EventEmitter,
- this.onInsertEmitter = new n.EventEmitter,
- this.onTrimEmitter = new n.EventEmitter,
- this._array = new Array(this._maxLength),
- this._startIndex = 0,
- this._length = 0
- }
- get onDelete() {
- return this.onDeleteEmitter.event
- }
- get onInsert() {
- return this.onInsertEmitter.event
- }
- get onTrim() {
- return this.onTrimEmitter.event
- }
- get maxLength() {
- return this._maxLength
- }
- set maxLength(_) {
- if (this._maxLength === _)
- return;
- const h = new Array(_);
- for (let f = 0; f < Math.min(_, this.length); f++)
- h[f] = this._array[this._getCyclicIndex(f)];
- this._array = h,
- this._maxLength = _,
- this._startIndex = 0
- }
- get length() {
- return this._length
- }
- set length(_) {
- if (_ > this._length)
- for (let h = this._length; h < _; h++)
- this._array[h] = void 0;
- this._length = _
- }
- get(_) {
- return this._array[this._getCyclicIndex(_)]
- }
- set(_, h) {
- this._array[this._getCyclicIndex(_)] = h
- }
- push(_) {
- this._array[this._getCyclicIndex(this._length)] = _,
- this._length === this._maxLength ? (this._startIndex = ++this._startIndex % this._maxLength,
- this.onTrimEmitter.fire(1)) : this._length++
- }
- recycle() {
- if (this._length !== this._maxLength)
- throw new Error("Can only recycle when the buffer is full");
- return this._startIndex = ++this._startIndex % this._maxLength,
- this.onTrimEmitter.fire(1),
- this._array[this._getCyclicIndex(this._length - 1)]
- }
- get isFull() {
- return this._length === this._maxLength
- }
- pop() {
- return this._array[this._getCyclicIndex(this._length-- - 1)]
- }
- splice(_, h, ...f) {
- if (h) {
- for (let d = _; d < this._length - h; d++)
- this._array[this._getCyclicIndex(d)] = this._array[this._getCyclicIndex(d + h)];
- this._length -= h,
- this.onDeleteEmitter.fire({
- index: _,
- amount: h
- })
- }
- for (let d = this._length - 1; d >= _; d--)
- this._array[this._getCyclicIndex(d + f.length)] = this._array[this._getCyclicIndex(d)];
- for (let d = 0; d < f.length; d++)
- this._array[this._getCyclicIndex(_ + d)] = f[d];
- if (f.length && this.onInsertEmitter.fire({
- index: _,
- amount: f.length
- }),
- this._length + f.length > this._maxLength) {
- const d = this._length + f.length - this._maxLength;
- this._startIndex += d,
- this._length = this._maxLength,
- this.onTrimEmitter.fire(d)
- } else
- this._length += f.length
- }
- trimStart(_) {
- _ > this._length && (_ = this._length),
- this._startIndex += _,
- this._length -= _,
- this.onTrimEmitter.fire(_)
- }
- shiftElements(_, h, f) {
- if (!(h <= 0)) {
- if (_ < 0 || _ >= this._length)
- throw new Error("start argument out of range");
- if (_ + f < 0)
- throw new Error("Cannot shift elements in list beyond index 0");
- if (f > 0) {
- for (let l = h - 1; l >= 0; l--)
- this.set(_ + l + f, this.get(_ + l));
- const d = _ + h + f - this._length;
- if (d > 0)
- for (this._length += d; this._length > this._maxLength;)
- this._length--,
- this._startIndex++,
- this.onTrimEmitter.fire(1)
- } else
- for (let d = 0; d < h; d++)
- this.set(_ + d + f, this.get(_ + d))
- }
- }
- _getCyclicIndex(_) {
- return (this._startIndex + _) % this._maxLength
- }
- }
- }
- ,
- 1439: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.clone = void 0,
- r.clone = function a(n, _ = 5) {
- if (typeof n != "object")
- return n;
- const h = Array.isArray(n) ? [] : {};
- for (const f in n)
- h[f] = _ <= 1 ? n[f] : n[f] && a(n[f], _ - 1);
- return h
- }
- }
- ,
- 8055: (x, r) => {
- var a, n, _;
- function h(d) {
- const l = d.toString(16);
- return l.length < 2 ? "0" + l : l
- }
- function f(d, l) {
- return d < l ? (l + .05) / (d + .05) : (d + .05) / (l + .05)
- }
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.contrastRatio = r.toPaddedHex = r.rgba = r.rgb = r.css = r.color = r.channels = void 0,
- function (d) {
- d.toCss = function (l, o, t, s) {
- return s !== void 0 ? `#${h(l)}${h(o)}${h(t)}${h(s)}` : `#${h(l)}${h(o)}${h(t)}`
- }
- ,
- d.toRgba = function (l, o, t, s = 255) {
- return (l << 24 | o << 16 | t << 8 | s) >>> 0
- }
- }(a = r.channels || (r.channels = {})),
- function (d) {
- function l(o, t) {
- const s = Math.round(255 * t)
- , [e, i, c] = _.toChannels(o.rgba);
- return {
- css: a.toCss(e, i, c, s),
- rgba: a.toRgba(e, i, c, s)
- }
- }
- d.blend = function (o, t) {
- const s = (255 & t.rgba) / 255;
- if (s === 1)
- return {
- css: t.css,
- rgba: t.rgba
- };
- const e = t.rgba >> 24 & 255
- , i = t.rgba >> 16 & 255
- , c = t.rgba >> 8 & 255
- , g = o.rgba >> 24 & 255
- , v = o.rgba >> 16 & 255
- , S = o.rgba >> 8 & 255
- , u = g + Math.round((e - g) * s)
- , m = v + Math.round((i - v) * s)
- , w = S + Math.round((c - S) * s);
- return {
- css: a.toCss(u, m, w),
- rgba: a.toRgba(u, m, w)
- }
- }
- ,
- d.isOpaque = function (o) {
- return (255 & o.rgba) == 255
- }
- ,
- d.ensureContrastRatio = function (o, t, s) {
- const e = _.ensureContrastRatio(o.rgba, t.rgba, s);
- if (e)
- return _.toColor(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255)
- }
- ,
- d.opaque = function (o) {
- const t = (255 | o.rgba) >>> 0
- , [s, e, i] = _.toChannels(t);
- return {
- css: a.toCss(s, e, i),
- rgba: t
- }
- }
- ,
- d.opacity = l,
- d.multiplyOpacity = function (o, t) {
- return l(o, (255 & o.rgba) * t / 255)
- }
- ,
- d.toColorRGB = function (o) {
- return [o.rgba >> 24 & 255, o.rgba >> 16 & 255, o.rgba >> 8 & 255]
- }
- }(r.color || (r.color = {})),
- (r.css || (r.css = {})).toColor = function (d) {
- if (d.match(/#[0-9a-f]{3,8}/i))
- switch (d.length) {
- case 4:
- {
- const o = parseInt(d.slice(1, 2).repeat(2), 16)
- , t = parseInt(d.slice(2, 3).repeat(2), 16)
- , s = parseInt(d.slice(3, 4).repeat(2), 16);
- return _.toColor(o, t, s)
- }
- case 5:
- {
- const o = parseInt(d.slice(1, 2).repeat(2), 16)
- , t = parseInt(d.slice(2, 3).repeat(2), 16)
- , s = parseInt(d.slice(3, 4).repeat(2), 16)
- , e = parseInt(d.slice(4, 5).repeat(2), 16);
- return _.toColor(o, t, s, e)
- }
- case 7:
- return {
- css: d,
- rgba: (parseInt(d.slice(1), 16) << 8 | 255) >>> 0
- };
- case 9:
- return {
- css: d,
- rgba: parseInt(d.slice(1), 16) >>> 0
- }
- }
- const l = d.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);
- if (l) {
- const o = parseInt(l[1])
- , t = parseInt(l[2])
- , s = parseInt(l[3])
- , e = Math.round(255 * (l[5] === void 0 ? 1 : parseFloat(l[5])));
- return _.toColor(o, t, s, e)
- }
- throw new Error("css.toColor: Unsupported css format")
- }
- ,
- function (d) {
- function l(o, t, s) {
- const e = o / 255
- , i = t / 255
- , c = s / 255;
- return .2126 * (e <= .03928 ? e / 12.92 : Math.pow((e + .055) / 1.055, 2.4)) + .7152 * (i <= .03928 ? i / 12.92 : Math.pow((i + .055) / 1.055, 2.4)) + .0722 * (c <= .03928 ? c / 12.92 : Math.pow((c + .055) / 1.055, 2.4))
- }
- d.relativeLuminance = function (o) {
- return l(o >> 16 & 255, o >> 8 & 255, 255 & o)
- }
- ,
- d.relativeLuminance2 = l
- }(n = r.rgb || (r.rgb = {})),
- function (d) {
- function l(t, s, e) {
- const i = t >> 24 & 255
- , c = t >> 16 & 255
- , g = t >> 8 & 255;
- let v = s >> 24 & 255
- , S = s >> 16 & 255
- , u = s >> 8 & 255
- , m = f(n.relativeLuminance2(v, S, u), n.relativeLuminance2(i, c, g));
- for (; m < e && (v > 0 || S > 0 || u > 0);)
- v -= Math.max(0, Math.ceil(.1 * v)),
- S -= Math.max(0, Math.ceil(.1 * S)),
- u -= Math.max(0, Math.ceil(.1 * u)),
- m = f(n.relativeLuminance2(v, S, u), n.relativeLuminance2(i, c, g));
- return (v << 24 | S << 16 | u << 8 | 255) >>> 0
- }
- function o(t, s, e) {
- const i = t >> 24 & 255
- , c = t >> 16 & 255
- , g = t >> 8 & 255;
- let v = s >> 24 & 255
- , S = s >> 16 & 255
- , u = s >> 8 & 255
- , m = f(n.relativeLuminance2(v, S, u), n.relativeLuminance2(i, c, g));
- for (; m < e && (v < 255 || S < 255 || u < 255);)
- v = Math.min(255, v + Math.ceil(.1 * (255 - v))),
- S = Math.min(255, S + Math.ceil(.1 * (255 - S))),
- u = Math.min(255, u + Math.ceil(.1 * (255 - u))),
- m = f(n.relativeLuminance2(v, S, u), n.relativeLuminance2(i, c, g));
- return (v << 24 | S << 16 | u << 8 | 255) >>> 0
- }
- d.ensureContrastRatio = function (t, s, e) {
- const i = n.relativeLuminance(t >> 8)
- , c = n.relativeLuminance(s >> 8);
- if (f(i, c) < e) {
- if (c < i) {
- const S = l(t, s, e)
- , u = f(i, n.relativeLuminance(S >> 8));
- if (u < e) {
- const m = o(t, s, e);
- return u > f(i, n.relativeLuminance(m >> 8)) ? S : m
- }
- return S
- }
- const g = o(t, s, e)
- , v = f(i, n.relativeLuminance(g >> 8));
- if (v < e) {
- const S = l(t, s, e);
- return v > f(i, n.relativeLuminance(S >> 8)) ? g : S
- }
- return g
- }
- }
- ,
- d.reduceLuminance = l,
- d.increaseLuminance = o,
- d.toChannels = function (t) {
- return [t >> 24 & 255, t >> 16 & 255, t >> 8 & 255, 255 & t]
- }
- ,
- d.toColor = function (t, s, e, i) {
- return {
- css: a.toCss(t, s, e, i),
- rgba: a.toRgba(t, s, e, i)
- }
- }
- }(_ = r.rgba || (r.rgba = {})),
- r.toPaddedHex = h,
- r.contrastRatio = f
- }
- ,
- 8969: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.CoreTerminal = void 0;
- const n = a(844)
- , _ = a(2585)
- , h = a(4348)
- , f = a(7866)
- , d = a(744)
- , l = a(7302)
- , o = a(6975)
- , t = a(8460)
- , s = a(1753)
- , e = a(3730)
- , i = a(1480)
- , c = a(7994)
- , g = a(9282)
- , v = a(5435)
- , S = a(5981)
- , u = a(2660);
- let m = !1;
- class w extends n.Disposable {
- constructor(L) {
- super(),
- this._onBinary = new t.EventEmitter,
- this._onData = new t.EventEmitter,
- this._onLineFeed = new t.EventEmitter,
- this._onResize = new t.EventEmitter,
- this._onScroll = new t.EventEmitter,
- this._onWriteParsed = new t.EventEmitter,
- this._instantiationService = new h.InstantiationService,
- this.optionsService = new l.OptionsService(L),
- this._instantiationService.setService(_.IOptionsService, this.optionsService),
- this._bufferService = this.register(this._instantiationService.createInstance(d.BufferService)),
- this._instantiationService.setService(_.IBufferService, this._bufferService),
- this._logService = this._instantiationService.createInstance(f.LogService),
- this._instantiationService.setService(_.ILogService, this._logService),
- this.coreService = this.register(this._instantiationService.createInstance(o.CoreService, () => this.scrollToBottom())),
- this._instantiationService.setService(_.ICoreService, this.coreService),
- this.coreMouseService = this._instantiationService.createInstance(s.CoreMouseService),
- this._instantiationService.setService(_.ICoreMouseService, this.coreMouseService),
- this._dirtyRowService = this._instantiationService.createInstance(e.DirtyRowService),
- this._instantiationService.setService(_.IDirtyRowService, this._dirtyRowService),
- this.unicodeService = this._instantiationService.createInstance(i.UnicodeService),
- this._instantiationService.setService(_.IUnicodeService, this.unicodeService),
- this._charsetService = this._instantiationService.createInstance(c.CharsetService),
- this._instantiationService.setService(_.ICharsetService, this._charsetService),
- this._oscLinkService = this._instantiationService.createInstance(u.OscLinkService),
- this._instantiationService.setService(_.IOscLinkService, this._oscLinkService),
- this._inputHandler = new v.InputHandler(this._bufferService, this._charsetService, this.coreService, this._dirtyRowService, this._logService, this.optionsService, this._oscLinkService, this.coreMouseService, this.unicodeService),
- this.register((0,
- t.forwardEvent)(this._inputHandler.onLineFeed, this._onLineFeed)),
- this.register(this._inputHandler),
- this.register((0,
- t.forwardEvent)(this._bufferService.onResize, this._onResize)),
- this.register((0,
- t.forwardEvent)(this.coreService.onData, this._onData)),
- this.register((0,
- t.forwardEvent)(this.coreService.onBinary, this._onBinary)),
- this.register(this.optionsService.onOptionChange(p => this._updateOptions(p))),
- this.register(this._bufferService.onScroll(p => {
- this._onScroll.fire({
- position: this._bufferService.buffer.ydisp,
- source: 0
- }),
- this._dirtyRowService.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom)
- }
- )),
- this.register(this._inputHandler.onScroll(p => {
- this._onScroll.fire({
- position: this._bufferService.buffer.ydisp,
- source: 0
- }),
- this._dirtyRowService.markRangeDirty(this._bufferService.buffer.scrollTop, this._bufferService.buffer.scrollBottom)
- }
- )),
- this._writeBuffer = new S.WriteBuffer((p, C) => this._inputHandler.parse(p, C)),
- this.register((0,
- t.forwardEvent)(this._writeBuffer.onWriteParsed, this._onWriteParsed))
- }
- get onBinary() {
- return this._onBinary.event
- }
- get onData() {
- return this._onData.event
- }
- get onLineFeed() {
- return this._onLineFeed.event
- }
- get onResize() {
- return this._onResize.event
- }
- get onWriteParsed() {
- return this._onWriteParsed.event
- }
- get onScroll() {
- return this._onScrollApi || (this._onScrollApi = new t.EventEmitter,
- this.register(this._onScroll.event(L => {
- var p;
- (p = this._onScrollApi) === null || p === void 0 || p.fire(L.position)
- }
- ))),
- this._onScrollApi.event
- }
- get cols() {
- return this._bufferService.cols
- }
- get rows() {
- return this._bufferService.rows
- }
- get buffers() {
- return this._bufferService.buffers
- }
- get options() {
- return this.optionsService.options
- }
- set options(L) {
- for (const p in L)
- this.optionsService.options[p] = L[p]
- }
- dispose() {
- var L;
- this._isDisposed || (super.dispose(),
- (L = this._windowsMode) === null || L === void 0 || L.dispose(),
- this._windowsMode = void 0)
- }
- write(L, p) {
- this._writeBuffer.write(L, p)
- }
- writeSync(L, p) {
- this._logService.logLevel <= _.LogLevelEnum.WARN && !m && (this._logService.warn("writeSync is unreliable and will be removed soon."),
- m = !0),
- this._writeBuffer.writeSync(L, p)
- }
- resize(L, p) {
- isNaN(L) || isNaN(p) || (L = Math.max(L, d.MINIMUM_COLS),
- p = Math.max(p, d.MINIMUM_ROWS),
- this._bufferService.resize(L, p))
- }
- scroll(L, p = !1) {
- this._bufferService.scroll(L, p)
- }
- scrollLines(L, p, C) {
- this._bufferService.scrollLines(L, p, C)
- }
- scrollPages(L) {
- this._bufferService.scrollPages(L)
- }
- scrollToTop() {
- this._bufferService.scrollToTop()
- }
- scrollToBottom() {
- this._bufferService.scrollToBottom()
- }
- scrollToLine(L) {
- this._bufferService.scrollToLine(L)
- }
- registerEscHandler(L, p) {
- return this._inputHandler.registerEscHandler(L, p)
- }
- registerDcsHandler(L, p) {
- return this._inputHandler.registerDcsHandler(L, p)
- }
- registerCsiHandler(L, p) {
- return this._inputHandler.registerCsiHandler(L, p)
- }
- registerOscHandler(L, p) {
- return this._inputHandler.registerOscHandler(L, p)
- }
- _setup() {
- this.optionsService.rawOptions.windowsMode && this._enableWindowsMode()
- }
- reset() {
- this._inputHandler.reset(),
- this._bufferService.reset(),
- this._charsetService.reset(),
- this.coreService.reset(),
- this.coreMouseService.reset()
- }
- _updateOptions(L) {
- var p;
- switch (L) {
- case "scrollback":
- this.buffers.resize(this.cols, this.rows);
- break;
- case "windowsMode":
- this.optionsService.rawOptions.windowsMode ? this._enableWindowsMode() : ((p = this._windowsMode) === null || p === void 0 || p.dispose(),
- this._windowsMode = void 0)
- }
- }
- _enableWindowsMode() {
- if (!this._windowsMode) {
- const L = [];
- L.push(this.onLineFeed(g.updateWindowsModeWrappedState.bind(null, this._bufferService))),
- L.push(this.registerCsiHandler({
- final: "H"
- }, () => ((0,
- g.updateWindowsModeWrappedState)(this._bufferService),
- !1))),
- this._windowsMode = {
- dispose: () => {
- for (const p of L)
- p.dispose()
- }
- }
- }
- }
- }
- r.CoreTerminal = w
- }
- ,
- 8460: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.forwardEvent = r.EventEmitter = void 0,
- r.EventEmitter = class {
- constructor() {
- this._listeners = [],
- this._disposed = !1
- }
- get event() {
- return this._event || (this._event = a => (this._listeners.push(a),
- {
- dispose: () => {
- if (!this._disposed) {
- for (let n = 0; n < this._listeners.length; n++)
- if (this._listeners[n] === a)
- return void this._listeners.splice(n, 1)
- }
- }
- })),
- this._event
- }
- fire(a, n) {
- const _ = [];
- for (let h = 0; h < this._listeners.length; h++)
- _.push(this._listeners[h]);
- for (let h = 0; h < _.length; h++)
- _[h].call(void 0, a, n)
- }
- dispose() {
- this._listeners && (this._listeners.length = 0),
- this._disposed = !0
- }
- }
- ,
- r.forwardEvent = function (a, n) {
- return a(_ => n.fire(_))
- }
- }
- ,
- 5435: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.InputHandler = r.WindowsOptionsReportType = void 0;
- const n = a(2584)
- , _ = a(7116)
- , h = a(2015)
- , f = a(844)
- , d = a(482)
- , l = a(8437)
- , o = a(8460)
- , t = a(643)
- , s = a(511)
- , e = a(3734)
- , i = a(2585)
- , c = a(6242)
- , g = a(6351)
- , v = a(5941)
- , S = {
- "(": 0,
- ")": 1,
- "*": 2,
- "+": 3,
- "-": 1,
- ".": 2
- }
- , u = 131072;
- function m(L, p) {
- if (L > 24)
- return p.setWinLines || !1;
- switch (L) {
- case 1:
- return !!p.restoreWin;
- case 2:
- return !!p.minimizeWin;
- case 3:
- return !!p.setWinPosition;
- case 4:
- return !!p.setWinSizePixels;
- case 5:
- return !!p.raiseWin;
- case 6:
- return !!p.lowerWin;
- case 7:
- return !!p.refreshWin;
- case 8:
- return !!p.setWinSizeChars;
- case 9:
- return !!p.maximizeWin;
- case 10:
- return !!p.fullscreenWin;
- case 11:
- return !!p.getWinState;
- case 13:
- return !!p.getWinPosition;
- case 14:
- return !!p.getWinSizePixels;
- case 15:
- return !!p.getScreenSizePixels;
- case 16:
- return !!p.getCellSizePixels;
- case 18:
- return !!p.getWinSizeChars;
- case 19:
- return !!p.getScreenSizeChars;
- case 20:
- return !!p.getIconTitle;
- case 21:
- return !!p.getWinTitle;
- case 22:
- return !!p.pushTitle;
- case 23:
- return !!p.popTitle;
- case 24:
- return !!p.setWinLines
- }
- return !1
- }
- var w;
- (function (L) {
- L[L.GET_WIN_SIZE_PIXELS = 0] = "GET_WIN_SIZE_PIXELS",
- L[L.GET_CELL_SIZE_PIXELS = 1] = "GET_CELL_SIZE_PIXELS"
- }
- )(w = r.WindowsOptionsReportType || (r.WindowsOptionsReportType = {}));
- class R extends f.Disposable {
- constructor(p, C, b, E, A, H, j, $, P, N = new h.EscapeSequenceParser) {
- super(),
- this._bufferService = p,
- this._charsetService = C,
- this._coreService = b,
- this._dirtyRowService = E,
- this._logService = A,
- this._optionsService = H,
- this._oscLinkService = j,
- this._coreMouseService = $,
- this._unicodeService = P,
- this._parser = N,
- this._parseBuffer = new Uint32Array(4096),
- this._stringDecoder = new d.StringToUtf32,
- this._utf8Decoder = new d.Utf8ToUtf32,
- this._workCell = new s.CellData,
- this._windowTitle = "",
- this._iconName = "",
- this._windowTitleStack = [],
- this._iconNameStack = [],
- this._curAttrData = l.DEFAULT_ATTR_DATA.clone(),
- this._eraseAttrDataInternal = l.DEFAULT_ATTR_DATA.clone(),
- this._onRequestBell = new o.EventEmitter,
- this._onRequestRefreshRows = new o.EventEmitter,
- this._onRequestReset = new o.EventEmitter,
- this._onRequestSendFocus = new o.EventEmitter,
- this._onRequestSyncScrollBar = new o.EventEmitter,
- this._onRequestWindowsOptionsReport = new o.EventEmitter,
- this._onA11yChar = new o.EventEmitter,
- this._onA11yTab = new o.EventEmitter,
- this._onCursorMove = new o.EventEmitter,
- this._onLineFeed = new o.EventEmitter,
- this._onScroll = new o.EventEmitter,
- this._onTitleChange = new o.EventEmitter,
- this._onColor = new o.EventEmitter,
- this._parseStack = {
- paused: !1,
- cursorStartX: 0,
- cursorStartY: 0,
- decodedLength: 0,
- position: 0
- },
- this._specialColors = [256, 257, 258],
- this.register(this._parser),
- this._activeBuffer = this._bufferService.buffer,
- this.register(this._bufferService.buffers.onBufferActivate(y => this._activeBuffer = y.activeBuffer)),
- this._parser.setCsiHandlerFallback((y, T) => {
- this._logService.debug("Unknown CSI code: ", {
- identifier: this._parser.identToString(y),
- params: T.toArray()
- })
- }
- ),
- this._parser.setEscHandlerFallback(y => {
- this._logService.debug("Unknown ESC code: ", {
- identifier: this._parser.identToString(y)
- })
- }
- ),
- this._parser.setExecuteHandlerFallback(y => {
- this._logService.debug("Unknown EXECUTE code: ", {
- code: y
- })
- }
- ),
- this._parser.setOscHandlerFallback((y, T, O) => {
- this._logService.debug("Unknown OSC code: ", {
- identifier: y,
- action: T,
- data: O
- })
- }
- ),
- this._parser.setDcsHandlerFallback((y, T, O) => {
- T === "HOOK" && (O = O.toArray()),
- this._logService.debug("Unknown DCS code: ", {
- identifier: this._parser.identToString(y),
- action: T,
- payload: O
- })
- }
- ),
- this._parser.setPrintHandler((y, T, O) => this.print(y, T, O)),
- this._parser.registerCsiHandler({
- final: "@"
- }, y => this.insertChars(y)),
- this._parser.registerCsiHandler({
- intermediates: " ",
- final: "@"
- }, y => this.scrollLeft(y)),
- this._parser.registerCsiHandler({
- final: "A"
- }, y => this.cursorUp(y)),
- this._parser.registerCsiHandler({
- intermediates: " ",
- final: "A"
- }, y => this.scrollRight(y)),
- this._parser.registerCsiHandler({
- final: "B"
- }, y => this.cursorDown(y)),
- this._parser.registerCsiHandler({
- final: "C"
- }, y => this.cursorForward(y)),
- this._parser.registerCsiHandler({
- final: "D"
- }, y => this.cursorBackward(y)),
- this._parser.registerCsiHandler({
- final: "E"
- }, y => this.cursorNextLine(y)),
- this._parser.registerCsiHandler({
- final: "F"
- }, y => this.cursorPrecedingLine(y)),
- this._parser.registerCsiHandler({
- final: "G"
- }, y => this.cursorCharAbsolute(y)),
- this._parser.registerCsiHandler({
- final: "H"
- }, y => this.cursorPosition(y)),
- this._parser.registerCsiHandler({
- final: "I"
- }, y => this.cursorForwardTab(y)),
- this._parser.registerCsiHandler({
- final: "J"
- }, y => this.eraseInDisplay(y, !1)),
- this._parser.registerCsiHandler({
- prefix: "?",
- final: "J"
- }, y => this.eraseInDisplay(y, !0)),
- this._parser.registerCsiHandler({
- final: "K"
- }, y => this.eraseInLine(y, !1)),
- this._parser.registerCsiHandler({
- prefix: "?",
- final: "K"
- }, y => this.eraseInLine(y, !0)),
- this._parser.registerCsiHandler({
- final: "L"
- }, y => this.insertLines(y)),
- this._parser.registerCsiHandler({
- final: "M"
- }, y => this.deleteLines(y)),
- this._parser.registerCsiHandler({
- final: "P"
- }, y => this.deleteChars(y)),
- this._parser.registerCsiHandler({
- final: "S"
- }, y => this.scrollUp(y)),
- this._parser.registerCsiHandler({
- final: "T"
- }, y => this.scrollDown(y)),
- this._parser.registerCsiHandler({
- final: "X"
- }, y => this.eraseChars(y)),
- this._parser.registerCsiHandler({
- final: "Z"
- }, y => this.cursorBackwardTab(y)),
- this._parser.registerCsiHandler({
- final: "`"
- }, y => this.charPosAbsolute(y)),
- this._parser.registerCsiHandler({
- final: "a"
- }, y => this.hPositionRelative(y)),
- this._parser.registerCsiHandler({
- final: "b"
- }, y => this.repeatPrecedingCharacter(y)),
- this._parser.registerCsiHandler({
- final: "c"
- }, y => this.sendDeviceAttributesPrimary(y)),
- this._parser.registerCsiHandler({
- prefix: ">",
- final: "c"
- }, y => this.sendDeviceAttributesSecondary(y)),
- this._parser.registerCsiHandler({
- final: "d"
- }, y => this.linePosAbsolute(y)),
- this._parser.registerCsiHandler({
- final: "e"
- }, y => this.vPositionRelative(y)),
- this._parser.registerCsiHandler({
- final: "f"
- }, y => this.hVPosition(y)),
- this._parser.registerCsiHandler({
- final: "g"
- }, y => this.tabClear(y)),
- this._parser.registerCsiHandler({
- final: "h"
- }, y => this.setMode(y)),
- this._parser.registerCsiHandler({
- prefix: "?",
- final: "h"
- }, y => this.setModePrivate(y)),
- this._parser.registerCsiHandler({
- final: "l"
- }, y => this.resetMode(y)),
- this._parser.registerCsiHandler({
- prefix: "?",
- final: "l"
- }, y => this.resetModePrivate(y)),
- this._parser.registerCsiHandler({
- final: "m"
- }, y => this.charAttributes(y)),
- this._parser.registerCsiHandler({
- final: "n"
- }, y => this.deviceStatus(y)),
- this._parser.registerCsiHandler({
- prefix: "?",
- final: "n"
- }, y => this.deviceStatusPrivate(y)),
- this._parser.registerCsiHandler({
- intermediates: "!",
- final: "p"
- }, y => this.softReset(y)),
- this._parser.registerCsiHandler({
- intermediates: " ",
- final: "q"
- }, y => this.setCursorStyle(y)),
- this._parser.registerCsiHandler({
- final: "r"
- }, y => this.setScrollRegion(y)),
- this._parser.registerCsiHandler({
- final: "s"
- }, y => this.saveCursor(y)),
- this._parser.registerCsiHandler({
- final: "t"
- }, y => this.windowOptions(y)),
- this._parser.registerCsiHandler({
- final: "u"
- }, y => this.restoreCursor(y)),
- this._parser.registerCsiHandler({
- intermediates: "'",
- final: "}"
- }, y => this.insertColumns(y)),
- this._parser.registerCsiHandler({
- intermediates: "'",
- final: "~"
- }, y => this.deleteColumns(y)),
- this._parser.registerCsiHandler({
- intermediates: '"',
- final: "q"
- }, y => this.selectProtected(y)),
- this._parser.registerCsiHandler({
- intermediates: "$",
- final: "p"
- }, y => this.requestMode(y, !0)),
- this._parser.registerCsiHandler({
- prefix: "?",
- intermediates: "$",
- final: "p"
- }, y => this.requestMode(y, !1)),
- this._parser.setExecuteHandler(n.C0.BEL, () => this.bell()),
- this._parser.setExecuteHandler(n.C0.LF, () => this.lineFeed()),
- this._parser.setExecuteHandler(n.C0.VT, () => this.lineFeed()),
- this._parser.setExecuteHandler(n.C0.FF, () => this.lineFeed()),
- this._parser.setExecuteHandler(n.C0.CR, () => this.carriageReturn()),
- this._parser.setExecuteHandler(n.C0.BS, () => this.backspace()),
- this._parser.setExecuteHandler(n.C0.HT, () => this.tab()),
- this._parser.setExecuteHandler(n.C0.SO, () => this.shiftOut()),
- this._parser.setExecuteHandler(n.C0.SI, () => this.shiftIn()),
- this._parser.setExecuteHandler(n.C1.IND, () => this.index()),
- this._parser.setExecuteHandler(n.C1.NEL, () => this.nextLine()),
- this._parser.setExecuteHandler(n.C1.HTS, () => this.tabSet()),
- this._parser.registerOscHandler(0, new c.OscHandler(y => (this.setTitle(y),
- this.setIconName(y),
- !0))),
- this._parser.registerOscHandler(1, new c.OscHandler(y => this.setIconName(y))),
- this._parser.registerOscHandler(2, new c.OscHandler(y => this.setTitle(y))),
- this._parser.registerOscHandler(4, new c.OscHandler(y => this.setOrReportIndexedColor(y))),
- this._parser.registerOscHandler(8, new c.OscHandler(y => this.setHyperlink(y))),
- this._parser.registerOscHandler(10, new c.OscHandler(y => this.setOrReportFgColor(y))),
- this._parser.registerOscHandler(11, new c.OscHandler(y => this.setOrReportBgColor(y))),
- this._parser.registerOscHandler(12, new c.OscHandler(y => this.setOrReportCursorColor(y))),
- this._parser.registerOscHandler(104, new c.OscHandler(y => this.restoreIndexedColor(y))),
- this._parser.registerOscHandler(110, new c.OscHandler(y => this.restoreFgColor(y))),
- this._parser.registerOscHandler(111, new c.OscHandler(y => this.restoreBgColor(y))),
- this._parser.registerOscHandler(112, new c.OscHandler(y => this.restoreCursorColor(y))),
- this._parser.registerEscHandler({
- final: "7"
- }, () => this.saveCursor()),
- this._parser.registerEscHandler({
- final: "8"
- }, () => this.restoreCursor()),
- this._parser.registerEscHandler({
- final: "D"
- }, () => this.index()),
- this._parser.registerEscHandler({
- final: "E"
- }, () => this.nextLine()),
- this._parser.registerEscHandler({
- final: "H"
- }, () => this.tabSet()),
- this._parser.registerEscHandler({
- final: "M"
- }, () => this.reverseIndex()),
- this._parser.registerEscHandler({
- final: "="
- }, () => this.keypadApplicationMode()),
- this._parser.registerEscHandler({
- final: ">"
- }, () => this.keypadNumericMode()),
- this._parser.registerEscHandler({
- final: "c"
- }, () => this.fullReset()),
- this._parser.registerEscHandler({
- final: "n"
- }, () => this.setgLevel(2)),
- this._parser.registerEscHandler({
- final: "o"
- }, () => this.setgLevel(3)),
- this._parser.registerEscHandler({
- final: "|"
- }, () => this.setgLevel(3)),
- this._parser.registerEscHandler({
- final: "}"
- }, () => this.setgLevel(2)),
- this._parser.registerEscHandler({
- final: "~"
- }, () => this.setgLevel(1)),
- this._parser.registerEscHandler({
- intermediates: "%",
- final: "@"
- }, () => this.selectDefaultCharset()),
- this._parser.registerEscHandler({
- intermediates: "%",
- final: "G"
- }, () => this.selectDefaultCharset());
- for (const y in _.CHARSETS)
- this._parser.registerEscHandler({
- intermediates: "(",
- final: y
- }, () => this.selectCharset("(" + y)),
- this._parser.registerEscHandler({
- intermediates: ")",
- final: y
- }, () => this.selectCharset(")" + y)),
- this._parser.registerEscHandler({
- intermediates: "*",
- final: y
- }, () => this.selectCharset("*" + y)),
- this._parser.registerEscHandler({
- intermediates: "+",
- final: y
- }, () => this.selectCharset("+" + y)),
- this._parser.registerEscHandler({
- intermediates: "-",
- final: y
- }, () => this.selectCharset("-" + y)),
- this._parser.registerEscHandler({
- intermediates: ".",
- final: y
- }, () => this.selectCharset("." + y)),
- this._parser.registerEscHandler({
- intermediates: "/",
- final: y
- }, () => this.selectCharset("/" + y));
- this._parser.registerEscHandler({
- intermediates: "#",
- final: "8"
- }, () => this.screenAlignmentPattern()),
- this._parser.setErrorHandler(y => (this._logService.error("Parsing error: ", y),
- y)),
- this._parser.registerDcsHandler({
- intermediates: "$",
- final: "q"
- }, new g.DcsHandler((y, T) => this.requestStatusString(y, T)))
- }
- getAttrData() {
- return this._curAttrData
- }
- get onRequestBell() {
- return this._onRequestBell.event
- }
- get onRequestRefreshRows() {
- return this._onRequestRefreshRows.event
- }
- get onRequestReset() {
- return this._onRequestReset.event
- }
- get onRequestSendFocus() {
- return this._onRequestSendFocus.event
- }
- get onRequestSyncScrollBar() {
- return this._onRequestSyncScrollBar.event
- }
- get onRequestWindowsOptionsReport() {
- return this._onRequestWindowsOptionsReport.event
- }
- get onA11yChar() {
- return this._onA11yChar.event
- }
- get onA11yTab() {
- return this._onA11yTab.event
- }
- get onCursorMove() {
- return this._onCursorMove.event
- }
- get onLineFeed() {
- return this._onLineFeed.event
- }
- get onScroll() {
- return this._onScroll.event
- }
- get onTitleChange() {
- return this._onTitleChange.event
- }
- get onColor() {
- return this._onColor.event
- }
- dispose() {
- super.dispose()
- }
- _preserveStack(p, C, b, E) {
- this._parseStack.paused = !0,
- this._parseStack.cursorStartX = p,
- this._parseStack.cursorStartY = C,
- this._parseStack.decodedLength = b,
- this._parseStack.position = E
- }
- _logSlowResolvingAsync(p) {
- this._logService.logLevel <= i.LogLevelEnum.WARN && Promise.race([p, new Promise((C, b) => setTimeout(() => b("#SLOW_TIMEOUT"), 5e3))]).catch(C => {
- if (C !== "#SLOW_TIMEOUT")
- throw C;
- console.warn("async parser handler taking longer than 5000 ms")
- }
- )
- }
- parse(p, C) {
- let b, E = this._activeBuffer.x, A = this._activeBuffer.y, H = 0;
- const j = this._parseStack.paused;
- if (j) {
- if (b = this._parser.parse(this._parseBuffer, this._parseStack.decodedLength, C))
- return this._logSlowResolvingAsync(b),
- b;
- E = this._parseStack.cursorStartX,
- A = this._parseStack.cursorStartY,
- this._parseStack.paused = !1,
- p.length > u && (H = this._parseStack.position + u)
- }
- if (this._logService.logLevel <= i.LogLevelEnum.DEBUG && this._logService.debug("parsing data" + (typeof p == "string" ? ` "${p}"` : ` "${Array.prototype.map.call(p, $ => String.fromCharCode($)).join("")}"`), typeof p == "string" ? p.split("").map($ => $.charCodeAt(0)) : p),
- this._parseBuffer.length < p.length && this._parseBuffer.length < u && (this._parseBuffer = new Uint32Array(Math.min(p.length, u))),
- j || this._dirtyRowService.clearRange(),
- p.length > u)
- for (let$ = H; $ < p.length; $ += u) {
- const P = $ + u < p.length ? $ + u : p.length
- , N = typeof p == "string" ? this._stringDecoder.decode(p.substring($, P), this._parseBuffer) : this._utf8Decoder.decode(p.subarray($, P), this._parseBuffer);
- if (b = this._parser.parse(this._parseBuffer, N))
- return this._preserveStack(E, A, N, $),
- this._logSlowResolvingAsync(b),
- b
- }
- else if (!j) {
- const $ = typeof p == "string" ? this._stringDecoder.decode(p, this._parseBuffer) : this._utf8Decoder.decode(p, this._parseBuffer);
- if (b = this._parser.parse(this._parseBuffer, $))
- return this._preserveStack(E, A, $, 0),
- this._logSlowResolvingAsync(b),
- b
- }
- this._activeBuffer.x === E && this._activeBuffer.y === A || this._onCursorMove.fire(),
- this._onRequestRefreshRows.fire(this._dirtyRowService.start, this._dirtyRowService.end)
- }
- print(p, C, b) {
- let E, A;
- const H = this._charsetService.charset
- , j = this._optionsService.rawOptions.screenReaderMode
- , $ = this._bufferService.cols
- , P = this._coreService.decPrivateModes.wraparound
- , N = this._coreService.modes.insertMode
- , y = this._curAttrData;
- let T = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
- this._dirtyRowService.markDirty(this._activeBuffer.y),
- this._activeBuffer.x && b - C > 0 && T.getWidth(this._activeBuffer.x - 1) === 2 && T.setCellFromCodePoint(this._activeBuffer.x - 1, 0, 1, y.fg, y.bg, y.extended);
- for (let O = C; O < b; ++O) {
- if (E = p[O],
- A = this._unicodeService.wcwidth(E),
- E < 127 && H) {
- const k = H[String.fromCharCode(E)];
- k && (E = k.charCodeAt(0))
- }
- if (j && this._onA11yChar.fire((0,
- d.stringFromCodePoint)(E)),
- this._currentLinkId !== void 0 && this._oscLinkService.addLineToLink(this._currentLinkId, this._activeBuffer.ybase + this._activeBuffer.y),
- A || !this._activeBuffer.x) {
- if (this._activeBuffer.x + A - 1 >= $) {
- if (P) {
- for (; this._activeBuffer.x < $;)
- T.setCellFromCodePoint(this._activeBuffer.x++, 0, 1, y.fg, y.bg, y.extended);
- this._activeBuffer.x = 0,
- this._activeBuffer.y++,
- this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--,
- this._bufferService.scroll(this._eraseAttrData(), !0)) : (this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1),
- this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = !0),
- T = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)
- } else if (this._activeBuffer.x = $ - 1,
- A === 2)
- continue
- }
- if (N && (T.insertCells(this._activeBuffer.x, A, this._activeBuffer.getNullCell(y), y),
- T.getWidth($ - 1) === 2 && T.setCellFromCodePoint($ - 1, t.NULL_CELL_CODE, t.NULL_CELL_WIDTH, y.fg, y.bg, y.extended)),
- T.setCellFromCodePoint(this._activeBuffer.x++, E, A, y.fg, y.bg, y.extended),
- A > 0)
- for (; --A;)
- T.setCellFromCodePoint(this._activeBuffer.x++, 0, 0, y.fg, y.bg, y.extended)
- } else
- T.getWidth(this._activeBuffer.x - 1) ? T.addCodepointToCell(this._activeBuffer.x - 1, E) : T.addCodepointToCell(this._activeBuffer.x - 2, E)
- }
- b - C > 0 && (T.loadCell(this._activeBuffer.x - 1, this._workCell),
- this._workCell.getWidth() === 2 || this._workCell.getCode() > 65535 ? this._parser.precedingCodepoint = 0 : this._workCell.isCombined() ? this._parser.precedingCodepoint = this._workCell.getChars().charCodeAt(0) : this._parser.precedingCodepoint = this._workCell.content),
- this._activeBuffer.x < $ && b - C > 0 && T.getWidth(this._activeBuffer.x) === 0 && !T.hasContent(this._activeBuffer.x) && T.setCellFromCodePoint(this._activeBuffer.x, 0, 1, y.fg, y.bg, y.extended),
- this._dirtyRowService.markDirty(this._activeBuffer.y)
- }
- registerCsiHandler(p, C) {
- return p.final !== "t" || p.prefix || p.intermediates ? this._parser.registerCsiHandler(p, C) : this._parser.registerCsiHandler(p, b => !m(b.params[0], this._optionsService.rawOptions.windowOptions) || C(b))
- }
- registerDcsHandler(p, C) {
- return this._parser.registerDcsHandler(p, new g.DcsHandler(C))
- }
- registerEscHandler(p, C) {
- return this._parser.registerEscHandler(p, C)
- }
- registerOscHandler(p, C) {
- return this._parser.registerOscHandler(p, new c.OscHandler(C))
- }
- bell() {
- return this._onRequestBell.fire(),
- !0
- }
- lineFeed() {
- return this._dirtyRowService.markDirty(this._activeBuffer.y),
- this._optionsService.rawOptions.convertEol && (this._activeBuffer.x = 0),
- this._activeBuffer.y++,
- this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--,
- this._bufferService.scroll(this._eraseAttrData())) : this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1),
- this._activeBuffer.x >= this._bufferService.cols && this._activeBuffer.x--,
- this._dirtyRowService.markDirty(this._activeBuffer.y),
- this._onLineFeed.fire(),
- !0
- }
- carriageReturn() {
- return this._activeBuffer.x = 0,
- !0
- }
- backspace() {
- var p;
- if (!this._coreService.decPrivateModes.reverseWraparound)
- return this._restrictCursor(),
- this._activeBuffer.x > 0 && this._activeBuffer.x--,
- !0;
- if (this._restrictCursor(this._bufferService.cols),
- this._activeBuffer.x > 0)
- this._activeBuffer.x--;
- else if (this._activeBuffer.x === 0 && this._activeBuffer.y > this._activeBuffer.scrollTop && this._activeBuffer.y <= this._activeBuffer.scrollBottom && ((p = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y)) === null || p === void 0 ? void 0 : p.isWrapped)) {
- this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y).isWrapped = !1,
- this._activeBuffer.y--,
- this._activeBuffer.x = this._bufferService.cols - 1;
- const C = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
- C.hasWidth(this._activeBuffer.x) && !C.hasContent(this._activeBuffer.x) && this._activeBuffer.x--
- }
- return this._restrictCursor(),
- !0
- }
- tab() {
- if (this._activeBuffer.x >= this._bufferService.cols)
- return !0;
- const p = this._activeBuffer.x;
- return this._activeBuffer.x = this._activeBuffer.nextStop(),
- this._optionsService.rawOptions.screenReaderMode && this._onA11yTab.fire(this._activeBuffer.x - p),
- !0
- }
- shiftOut() {
- return this._charsetService.setgLevel(1),
- !0
- }
- shiftIn() {
- return this._charsetService.setgLevel(0),
- !0
- }
- _restrictCursor(p = this._bufferService.cols - 1) {
- this._activeBuffer.x = Math.min(p, Math.max(0, this._activeBuffer.x)),
- this._activeBuffer.y = this._coreService.decPrivateModes.origin ? Math.min(this._activeBuffer.scrollBottom, Math.max(this._activeBuffer.scrollTop, this._activeBuffer.y)) : Math.min(this._bufferService.rows - 1, Math.max(0, this._activeBuffer.y)),
- this._dirtyRowService.markDirty(this._activeBuffer.y)
- }
- _setCursor(p, C) {
- this._dirtyRowService.markDirty(this._activeBuffer.y),
- this._coreService.decPrivateModes.origin ? (this._activeBuffer.x = p,
- this._activeBuffer.y = this._activeBuffer.scrollTop + C) : (this._activeBuffer.x = p,
- this._activeBuffer.y = C),
- this._restrictCursor(),
- this._dirtyRowService.markDirty(this._activeBuffer.y)
- }
- _moveCursor(p, C) {
- this._restrictCursor(),
- this._setCursor(this._activeBuffer.x + p, this._activeBuffer.y + C)
- }
- cursorUp(p) {
- const C = this._activeBuffer.y - this._activeBuffer.scrollTop;
- return C >= 0 ? this._moveCursor(0, -Math.min(C, p.params[0] || 1)) : this._moveCursor(0, -(p.params[0] || 1)),
- !0
- }
- cursorDown(p) {
- const C = this._activeBuffer.scrollBottom - this._activeBuffer.y;
- return C >= 0 ? this._moveCursor(0, Math.min(C, p.params[0] || 1)) : this._moveCursor(0, p.params[0] || 1),
- !0
- }
- cursorForward(p) {
- return this._moveCursor(p.params[0] || 1, 0),
- !0
- }
- cursorBackward(p) {
- return this._moveCursor(-(p.params[0] || 1), 0),
- !0
- }
- cursorNextLine(p) {
- return this.cursorDown(p),
- this._activeBuffer.x = 0,
- !0
- }
- cursorPrecedingLine(p) {
- return this.cursorUp(p),
- this._activeBuffer.x = 0,
- !0
- }
- cursorCharAbsolute(p) {
- return this._setCursor((p.params[0] || 1) - 1, this._activeBuffer.y),
- !0
- }
- cursorPosition(p) {
- return this._setCursor(p.length >= 2 ? (p.params[1] || 1) - 1 : 0, (p.params[0] || 1) - 1),
- !0
- }
- charPosAbsolute(p) {
- return this._setCursor((p.params[0] || 1) - 1, this._activeBuffer.y),
- !0
- }
- hPositionRelative(p) {
- return this._moveCursor(p.params[0] || 1, 0),
- !0
- }
- linePosAbsolute(p) {
- return this._setCursor(this._activeBuffer.x, (p.params[0] || 1) - 1),
- !0
- }
- vPositionRelative(p) {
- return this._moveCursor(0, p.params[0] || 1),
- !0
- }
- hVPosition(p) {
- return this.cursorPosition(p),
- !0
- }
- tabClear(p) {
- const C = p.params[0];
- return C === 0 ? delete this._activeBuffer.tabs[this._activeBuffer.x] : C === 3 && (this._activeBuffer.tabs = {}),
- !0
- }
- cursorForwardTab(p) {
- if (this._activeBuffer.x >= this._bufferService.cols)
- return !0;
- let C = p.params[0] || 1;
- for (; C--;)
- this._activeBuffer.x = this._activeBuffer.nextStop();
- return !0
- }
- cursorBackwardTab(p) {
- if (this._activeBuffer.x >= this._bufferService.cols)
- return !0;
- let C = p.params[0] || 1;
- for (; C--;)
- this._activeBuffer.x = this._activeBuffer.prevStop();
- return !0
- }
- selectProtected(p) {
- const C = p.params[0];
- return C === 1 && (this._curAttrData.bg |= 536870912),
- C !== 2 && C !== 0 || (this._curAttrData.bg &= -536870913),
- !0
- }
- _eraseInBufferLine(p, C, b, E = !1, A = !1) {
- const H = this._activeBuffer.lines.get(this._activeBuffer.ybase + p);
- H.replaceCells(C, b, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData(), A),
- E && (H.isWrapped = !1)
- }
- _resetBufferLine(p, C = !1) {
- const b = this._activeBuffer.lines.get(this._activeBuffer.ybase + p);
- b.fill(this._activeBuffer.getNullCell(this._eraseAttrData()), C),
- this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase + p),
- b.isWrapped = !1
- }
- eraseInDisplay(p, C = !1) {
- let b;
- switch (this._restrictCursor(this._bufferService.cols),
- p.params[0]) {
- case 0:
- for (b = this._activeBuffer.y,
- this._dirtyRowService.markDirty(b),
- this._eraseInBufferLine(b++, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, C); b < this._bufferService.rows; b++)
- this._resetBufferLine(b, C);
- this._dirtyRowService.markDirty(b);
- break;
- case 1:
- for (b = this._activeBuffer.y,
- this._dirtyRowService.markDirty(b),
- this._eraseInBufferLine(b, 0, this._activeBuffer.x + 1, !0, C),
- this._activeBuffer.x + 1 >= this._bufferService.cols && (this._activeBuffer.lines.get(b + 1).isWrapped = !1); b--;)
- this._resetBufferLine(b, C);
- this._dirtyRowService.markDirty(0);
- break;
- case 2:
- for (b = this._bufferService.rows,
- this._dirtyRowService.markDirty(b - 1); b--;)
- this._resetBufferLine(b, C);
- this._dirtyRowService.markDirty(0);
- break;
- case 3:
- const E = this._activeBuffer.lines.length - this._bufferService.rows;
- E > 0 && (this._activeBuffer.lines.trimStart(E),
- this._activeBuffer.ybase = Math.max(this._activeBuffer.ybase - E, 0),
- this._activeBuffer.ydisp = Math.max(this._activeBuffer.ydisp - E, 0),
- this._onScroll.fire(0))
- }
- return !0
- }
- eraseInLine(p, C = !1) {
- switch (this._restrictCursor(this._bufferService.cols),
- p.params[0]) {
- case 0:
- this._eraseInBufferLine(this._activeBuffer.y, this._activeBuffer.x, this._bufferService.cols, this._activeBuffer.x === 0, C);
- break;
- case 1:
- this._eraseInBufferLine(this._activeBuffer.y, 0, this._activeBuffer.x + 1, !1, C);
- break;
- case 2:
- this._eraseInBufferLine(this._activeBuffer.y, 0, this._bufferService.cols, !0, C)
- }
- return this._dirtyRowService.markDirty(this._activeBuffer.y),
- !0
- }
- insertLines(p) {
- this._restrictCursor();
- let C = p.params[0] || 1;
- if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
- return !0;
- const b = this._activeBuffer.ybase + this._activeBuffer.y
- , E = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom
- , A = this._bufferService.rows - 1 + this._activeBuffer.ybase - E + 1;
- for (; C--;)
- this._activeBuffer.lines.splice(A - 1, 1),
- this._activeBuffer.lines.splice(b, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));
- return this._dirtyRowService.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom),
- this._activeBuffer.x = 0,
- !0
- }
- deleteLines(p) {
- this._restrictCursor();
- let C = p.params[0] || 1;
- if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
- return !0;
- const b = this._activeBuffer.ybase + this._activeBuffer.y;
- let E;
- for (E = this._bufferService.rows - 1 - this._activeBuffer.scrollBottom,
- E = this._bufferService.rows - 1 + this._activeBuffer.ybase - E; C--;)
- this._activeBuffer.lines.splice(b, 1),
- this._activeBuffer.lines.splice(E, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));
- return this._dirtyRowService.markRangeDirty(this._activeBuffer.y, this._activeBuffer.scrollBottom),
- this._activeBuffer.x = 0,
- !0
- }
- insertChars(p) {
- this._restrictCursor();
- const C = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
- return C && (C.insertCells(this._activeBuffer.x, p.params[0] || 1, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
- this._dirtyRowService.markDirty(this._activeBuffer.y)),
- !0
- }
- deleteChars(p) {
- this._restrictCursor();
- const C = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
- return C && (C.deleteCells(this._activeBuffer.x, p.params[0] || 1, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
- this._dirtyRowService.markDirty(this._activeBuffer.y)),
- !0
- }
- scrollUp(p) {
- let C = p.params[0] || 1;
- for (; C--;)
- this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 1),
- this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 0, this._activeBuffer.getBlankLine(this._eraseAttrData()));
- return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom),
- !0
- }
- scrollDown(p) {
- let C = p.params[0] || 1;
- for (; C--;)
- this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollBottom, 1),
- this._activeBuffer.lines.splice(this._activeBuffer.ybase + this._activeBuffer.scrollTop, 0, this._activeBuffer.getBlankLine(l.DEFAULT_ATTR_DATA));
- return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom),
- !0
- }
- scrollLeft(p) {
- if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
- return !0;
- const C = p.params[0] || 1;
- for (let b = this._activeBuffer.scrollTop; b <= this._activeBuffer.scrollBottom; ++b) {
- const E = this._activeBuffer.lines.get(this._activeBuffer.ybase + b);
- E.deleteCells(0, C, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
- E.isWrapped = !1
- }
- return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom),
- !0
- }
- scrollRight(p) {
- if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
- return !0;
- const C = p.params[0] || 1;
- for (let b = this._activeBuffer.scrollTop; b <= this._activeBuffer.scrollBottom; ++b) {
- const E = this._activeBuffer.lines.get(this._activeBuffer.ybase + b);
- E.insertCells(0, C, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
- E.isWrapped = !1
- }
- return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom),
- !0
- }
- insertColumns(p) {
- if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
- return !0;
- const C = p.params[0] || 1;
- for (let b = this._activeBuffer.scrollTop; b <= this._activeBuffer.scrollBottom; ++b) {
- const E = this._activeBuffer.lines.get(this._activeBuffer.ybase + b);
- E.insertCells(this._activeBuffer.x, C, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
- E.isWrapped = !1
- }
- return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom),
- !0
- }
- deleteColumns(p) {
- if (this._activeBuffer.y > this._activeBuffer.scrollBottom || this._activeBuffer.y < this._activeBuffer.scrollTop)
- return !0;
- const C = p.params[0] || 1;
- for (let b = this._activeBuffer.scrollTop; b <= this._activeBuffer.scrollBottom; ++b) {
- const E = this._activeBuffer.lines.get(this._activeBuffer.ybase + b);
- E.deleteCells(this._activeBuffer.x, C, this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
- E.isWrapped = !1
- }
- return this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom),
- !0
- }
- eraseChars(p) {
- this._restrictCursor();
- const C = this._activeBuffer.lines.get(this._activeBuffer.ybase + this._activeBuffer.y);
- return C && (C.replaceCells(this._activeBuffer.x, this._activeBuffer.x + (p.params[0] || 1), this._activeBuffer.getNullCell(this._eraseAttrData()), this._eraseAttrData()),
- this._dirtyRowService.markDirty(this._activeBuffer.y)),
- !0
- }
- repeatPrecedingCharacter(p) {
- if (!this._parser.precedingCodepoint)
- return !0;
- const C = p.params[0] || 1
- , b = new Uint32Array(C);
- for (let E = 0; E < C; ++E)
- b[E] = this._parser.precedingCodepoint;
- return this.print(b, 0, b.length),
- !0
- }
- sendDeviceAttributesPrimary(p) {
- return p.params[0] > 0 || (this._is("xterm") || this._is("rxvt-unicode") || this._is("screen") ? this._coreService.triggerDataEvent(n.C0.ESC + "[?1;2c") : this._is("linux") && this._coreService.triggerDataEvent(n.C0.ESC + "[?6c")),
- !0
- }
- sendDeviceAttributesSecondary(p) {
- return p.params[0] > 0 || (this._is("xterm") ? this._coreService.triggerDataEvent(n.C0.ESC + "[>0;276;0c") : this._is("rxvt-unicode") ? this._coreService.triggerDataEvent(n.C0.ESC + "[>85;95;0c") : this._is("linux") ? this._coreService.triggerDataEvent(p.params[0] + "c") : this._is("screen") && this._coreService.triggerDataEvent(n.C0.ESC + "[>83;40003;0c")),
- !0
- }
- _is(p) {
- return (this._optionsService.rawOptions.termName + "").indexOf(p) === 0
- }
- setMode(p) {
- for (let C = 0; C < p.length; C++)
- switch (p.params[C]) {
- case 4:
- this._coreService.modes.insertMode = !0;
- break;
- case 20:
- this._optionsService.options.convertEol = !0
- }
- return !0
- }
- setModePrivate(p) {
- for (let C = 0; C < p.length; C++)
- switch (p.params[C]) {
- case 1:
- this._coreService.decPrivateModes.applicationCursorKeys = !0;
- break;
- case 2:
- this._charsetService.setgCharset(0, _.DEFAULT_CHARSET),
- this._charsetService.setgCharset(1, _.DEFAULT_CHARSET),
- this._charsetService.setgCharset(2, _.DEFAULT_CHARSET),
- this._charsetService.setgCharset(3, _.DEFAULT_CHARSET);
- break;
- case 3:
- this._optionsService.rawOptions.windowOptions.setWinLines && (this._bufferService.resize(132, this._bufferService.rows),
- this._onRequestReset.fire());
- break;
- case 6:
- this._coreService.decPrivateModes.origin = !0,
- this._setCursor(0, 0);
- break;
- case 7:
- this._coreService.decPrivateModes.wraparound = !0;
- break;
- case 12:
- this._optionsService.options.cursorBlink = !0;
- break;
- case 45:
- this._coreService.decPrivateModes.reverseWraparound = !0;
- break;
- case 66:
- this._logService.debug("Serial port requested application keypad."),
- this._coreService.decPrivateModes.applicationKeypad = !0,
- this._onRequestSyncScrollBar.fire();
- break;
- case 9:
- this._coreMouseService.activeProtocol = "X10";
- break;
- case 1e3:
- this._coreMouseService.activeProtocol = "VT200";
- break;
- case 1002:
- this._coreMouseService.activeProtocol = "DRAG";
- break;
- case 1003:
- this._coreMouseService.activeProtocol = "ANY";
- break;
- case 1004:
- this._coreService.decPrivateModes.sendFocus = !0,
- this._onRequestSendFocus.fire();
- break;
- case 1005:
- this._logService.debug("DECSET 1005 not supported (see #2507)");
- break;
- case 1006:
- this._coreMouseService.activeEncoding = "SGR";
- break;
- case 1015:
- this._logService.debug("DECSET 1015 not supported (see #2507)");
- break;
- case 1016:
- this._coreMouseService.activeEncoding = "SGR_PIXELS";
- break;
- case 25:
- this._coreService.isCursorHidden = !1;
- break;
- case 1048:
- this.saveCursor();
- break;
- case 1049:
- this.saveCursor();
- case 47:
- case 1047:
- this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),
- this._coreService.isCursorInitialized = !0,
- this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1),
- this._onRequestSyncScrollBar.fire();
- break;
- case 2004:
- this._coreService.decPrivateModes.bracketedPasteMode = !0
- }
- return !0
- }
- resetMode(p) {
- for (let C = 0; C < p.length; C++)
- switch (p.params[C]) {
- case 4:
- this._coreService.modes.insertMode = !1;
- break;
- case 20:
- this._optionsService.options.convertEol = !1
- }
- return !0
- }
- resetModePrivate(p) {
- for (let C = 0; C < p.length; C++)
- switch (p.params[C]) {
- case 1:
- this._coreService.decPrivateModes.applicationCursorKeys = !1;
- break;
- case 3:
- this._optionsService.rawOptions.windowOptions.setWinLines && (this._bufferService.resize(80, this._bufferService.rows),
- this._onRequestReset.fire());
- break;
- case 6:
- this._coreService.decPrivateModes.origin = !1,
- this._setCursor(0, 0);
- break;
- case 7:
- this._coreService.decPrivateModes.wraparound = !1;
- break;
- case 12:
- this._optionsService.options.cursorBlink = !1;
- break;
- case 45:
- this._coreService.decPrivateModes.reverseWraparound = !1;
- break;
- case 66:
- this._logService.debug("Switching back to normal keypad."),
- this._coreService.decPrivateModes.applicationKeypad = !1,
- this._onRequestSyncScrollBar.fire();
- break;
- case 9:
- case 1e3:
- case 1002:
- case 1003:
- this._coreMouseService.activeProtocol = "NONE";
- break;
- case 1004:
- this._coreService.decPrivateModes.sendFocus = !1;
- break;
- case 1005:
- this._logService.debug("DECRST 1005 not supported (see #2507)");
- break;
- case 1006:
- case 1016:
- this._coreMouseService.activeEncoding = "DEFAULT";
- break;
- case 1015:
- this._logService.debug("DECRST 1015 not supported (see #2507)");
- break;
- case 25:
- this._coreService.isCursorHidden = !0;
- break;
- case 1048:
- this.restoreCursor();
- break;
- case 1049:
- case 47:
- case 1047:
- this._bufferService.buffers.activateNormalBuffer(),
- p.params[C] === 1049 && this.restoreCursor(),
- this._coreService.isCursorInitialized = !0,
- this._onRequestRefreshRows.fire(0, this._bufferService.rows - 1),
- this._onRequestSyncScrollBar.fire();
- break;
- case 2004:
- this._coreService.decPrivateModes.bracketedPasteMode = !1
- }
- return !0
- }
- requestMode(p, C) {
- const b = this._coreService.decPrivateModes
- , { activeProtocol: E, activeEncoding: A } = this._coreMouseService
- , H = this._coreService
- , { buffers: j, cols: $ } = this._bufferService
- , { active: P, alt: N } = j
- , y = this._optionsService.rawOptions
- , T = B => B ? 1 : 2
- , O = p.params[0];
- return k = O,
- D = C ? O === 2 ? 3 : O === 4 ? T(H.modes.insertMode) : O === 12 ? 4 : O === 20 ? T(y.convertEol) : 0 : O === 1 ? T(b.applicationCursorKeys) : O === 3 ? y.windowOptions.setWinLines ? $ === 80 ? 2 : $ === 132 ? 1 : 0 : 0 : O === 6 ? T(b.origin) : O === 7 ? T(b.wraparound) : O === 8 ? 3 : O === 9 ? T(E === "X10") : O === 12 ? T(y.cursorBlink) : O === 25 ? T(!H.isCursorHidden) : O === 45 ? T(b.reverseWraparound) : O === 66 ? T(b.applicationKeypad) : O === 1e3 ? T(E === "VT200") : O === 1002 ? T(E === "DRAG") : O === 1003 ? T(E === "ANY") : O === 1004 ? T(b.sendFocus) : O === 1005 ? 4 : O === 1006 ? T(A === "SGR") : O === 1015 ? 4 : O === 1016 ? T(A === "SGR_PIXELS") : O === 1048 ? 1 : O === 47 || O === 1047 || O === 1049 ? T(P === N) : O === 2004 ? T(b.bracketedPasteMode) : 0,
- H.triggerDataEvent(`${n.C0.ESC}[${C ? "" : "?"}${k};${D}$y`),
- !0;
- var k, D
- }
- _updateAttrColor(p, C, b, E, A) {
- return C === 2 ? (p |= 50331648,
- p &= -16777216,
- p |= e.AttributeData.fromColorRGB([b, E, A])) : C === 5 && (p &= -50331904,
- p |= 33554432 | 255 & b),
- p
- }
- _extractColor(p, C, b) {
- const E = [0, 0, -1, 0, 0, 0];
- let A = 0
- , H = 0;
- do {
- if (E[H + A] = p.params[C + H],
- p.hasSubParams(C + H)) {
- const j = p.getSubParams(C + H);
- let$ = 0;
- do
- E[1] === 5 && (A = 1),
- E[H + $ + 1 + A] = j[$];
- while (++$ < j.length && $ + H + 1 + A < E.length);
- break
- }
- if (E[1] === 5 && H + A >= 2 || E[1] === 2 && H + A >= 5)
- break;
- E[1] && (A = 1)
- } while (++H + C < p.length && H + A < E.length);
- for (let j = 2; j < E.length; ++j)
- E[j] === -1 && (E[j] = 0);
- switch (E[0]) {
- case 38:
- b.fg = this._updateAttrColor(b.fg, E[1], E[3], E[4], E[5]);
- break;
- case 48:
- b.bg = this._updateAttrColor(b.bg, E[1], E[3], E[4], E[5]);
- break;
- case 58:
- b.extended = b.extended.clone(),
- b.extended.underlineColor = this._updateAttrColor(b.extended.underlineColor, E[1], E[3], E[4], E[5])
- }
- return H
- }
- _processUnderline(p, C) {
- C.extended = C.extended.clone(),
- (!~p || p > 5) && (p = 1),
- C.extended.underlineStyle = p,
- C.fg |= 268435456,
- p === 0 && (C.fg &= -268435457),
- C.updateExtended()
- }
- charAttributes(p) {
- if (p.length === 1 && p.params[0] === 0)
- return this._curAttrData.fg = l.DEFAULT_ATTR_DATA.fg,
- this._curAttrData.bg = l.DEFAULT_ATTR_DATA.bg,
- !0;
- const C = p.length;
- let b;
- const E = this._curAttrData;
- for (let A = 0; A < C; A++)
- b = p.params[A],
- b >= 30 && b <= 37 ? (E.fg &= -50331904,
- E.fg |= 16777216 | b - 30) : b >= 40 && b <= 47 ? (E.bg &= -50331904,
- E.bg |= 16777216 | b - 40) : b >= 90 && b <= 97 ? (E.fg &= -50331904,
- E.fg |= 16777224 | b - 90) : b >= 100 && b <= 107 ? (E.bg &= -50331904,
- E.bg |= 16777224 | b - 100) : b === 0 ? (E.fg = l.DEFAULT_ATTR_DATA.fg,
- E.bg = l.DEFAULT_ATTR_DATA.bg) : b === 1 ? E.fg |= 134217728 : b === 3 ? E.bg |= 67108864 : b === 4 ? (E.fg |= 268435456,
- this._processUnderline(p.hasSubParams(A) ? p.getSubParams(A)[0] : 1, E)) : b === 5 ? E.fg |= 536870912 : b === 7 ? E.fg |= 67108864 : b === 8 ? E.fg |= 1073741824 : b === 9 ? E.fg |= 2147483648 : b === 2 ? E.bg |= 134217728 : b === 21 ? this._processUnderline(2, E) : b === 22 ? (E.fg &= -134217729,
- E.bg &= -134217729) : b === 23 ? E.bg &= -67108865 : b === 24 ? (E.fg &= -268435457,
- this._processUnderline(0, E)) : b === 25 ? E.fg &= -536870913 : b === 27 ? E.fg &= -67108865 : b === 28 ? E.fg &= -1073741825 : b === 29 ? E.fg &= 2147483647 : b === 39 ? (E.fg &= -67108864,
- E.fg |= 16777215 & l.DEFAULT_ATTR_DATA.fg) : b === 49 ? (E.bg &= -67108864,
- E.bg |= 16777215 & l.DEFAULT_ATTR_DATA.bg) : b === 38 || b === 48 || b === 58 ? A += this._extractColor(p, A, E) : b === 59 ? (E.extended = E.extended.clone(),
- E.extended.underlineColor = -1,
- E.updateExtended()) : b === 100 ? (E.fg &= -67108864,
- E.fg |= 16777215 & l.DEFAULT_ATTR_DATA.fg,
- E.bg &= -67108864,
- E.bg |= 16777215 & l.DEFAULT_ATTR_DATA.bg) : this._logService.debug("Unknown SGR attribute: %d.", b);
- return !0
- }
- deviceStatus(p) {
- switch (p.params[0]) {
- case 5:
- this._coreService.triggerDataEvent(`${n.C0.ESC}[0n`);
- break;
- case 6:
- const C = this._activeBuffer.y + 1
- , b = this._activeBuffer.x + 1;
- this._coreService.triggerDataEvent(`${n.C0.ESC}[${C};${b}R`)
- }
- return !0
- }
- deviceStatusPrivate(p) {
- if (p.params[0] === 6) {
- const C = this._activeBuffer.y + 1
- , b = this._activeBuffer.x + 1;
- this._coreService.triggerDataEvent(`${n.C0.ESC}[?${C};${b}R`)
- }
- return !0
- }
- softReset(p) {
- return this._coreService.isCursorHidden = !1,
- this._onRequestSyncScrollBar.fire(),
- this._activeBuffer.scrollTop = 0,
- this._activeBuffer.scrollBottom = this._bufferService.rows - 1,
- this._curAttrData = l.DEFAULT_ATTR_DATA.clone(),
- this._coreService.reset(),
- this._charsetService.reset(),
- this._activeBuffer.savedX = 0,
- this._activeBuffer.savedY = this._activeBuffer.ybase,
- this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg,
- this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg,
- this._activeBuffer.savedCharset = this._charsetService.charset,
- this._coreService.decPrivateModes.origin = !1,
- !0
- }
- setCursorStyle(p) {
- const C = p.params[0] || 1;
- switch (C) {
- case 1:
- case 2:
- this._optionsService.options.cursorStyle = "block";
- break;
- case 3:
- case 4:
- this._optionsService.options.cursorStyle = "underline";
- break;
- case 5:
- case 6:
- this._optionsService.options.cursorStyle = "bar"
- }
- const b = C % 2 == 1;
- return this._optionsService.options.cursorBlink = b,
- !0
- }
- setScrollRegion(p) {
- const C = p.params[0] || 1;
- let b;
- return (p.length < 2 || (b = p.params[1]) > this._bufferService.rows || b === 0) && (b = this._bufferService.rows),
- b > C && (this._activeBuffer.scrollTop = C - 1,
- this._activeBuffer.scrollBottom = b - 1,
- this._setCursor(0, 0)),
- !0
- }
- windowOptions(p) {
- if (!m(p.params[0], this._optionsService.rawOptions.windowOptions))
- return !0;
- const C = p.length > 1 ? p.params[1] : 0;
- switch (p.params[0]) {
- case 14:
- C !== 2 && this._onRequestWindowsOptionsReport.fire(w.GET_WIN_SIZE_PIXELS);
- break;
- case 16:
- this._onRequestWindowsOptionsReport.fire(w.GET_CELL_SIZE_PIXELS);
- break;
- case 18:
- this._bufferService && this._coreService.triggerDataEvent(`${n.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);
- break;
- case 22:
- C !== 0 && C !== 2 || (this._windowTitleStack.push(this._windowTitle),
- this._windowTitleStack.length > 10 && this._windowTitleStack.shift()),
- C !== 0 && C !== 1 || (this._iconNameStack.push(this._iconName),
- this._iconNameStack.length > 10 && this._iconNameStack.shift());
- break;
- case 23:
- C !== 0 && C !== 2 || this._windowTitleStack.length && this.setTitle(this._windowTitleStack.pop()),
- C !== 0 && C !== 1 || this._iconNameStack.length && this.setIconName(this._iconNameStack.pop())
- }
- return !0
- }
- saveCursor(p) {
- return this._activeBuffer.savedX = this._activeBuffer.x,
- this._activeBuffer.savedY = this._activeBuffer.ybase + this._activeBuffer.y,
- this._activeBuffer.savedCurAttrData.fg = this._curAttrData.fg,
- this._activeBuffer.savedCurAttrData.bg = this._curAttrData.bg,
- this._activeBuffer.savedCharset = this._charsetService.charset,
- !0
- }
- restoreCursor(p) {
- return this._activeBuffer.x = this._activeBuffer.savedX || 0,
- this._activeBuffer.y = Math.max(this._activeBuffer.savedY - this._activeBuffer.ybase, 0),
- this._curAttrData.fg = this._activeBuffer.savedCurAttrData.fg,
- this._curAttrData.bg = this._activeBuffer.savedCurAttrData.bg,
- this._charsetService.charset = this._savedCharset,
- this._activeBuffer.savedCharset && (this._charsetService.charset = this._activeBuffer.savedCharset),
- this._restrictCursor(),
- !0
- }
- setTitle(p) {
- return this._windowTitle = p,
- this._onTitleChange.fire(p),
- !0
- }
- setIconName(p) {
- return this._iconName = p,
- !0
- }
- setOrReportIndexedColor(p) {
- const C = []
- , b = p.split(";");
- for (; b.length > 1;) {
- const E = b.shift()
- , A = b.shift();
- if (/^\d+$/.exec(E)) {
- const H = parseInt(E);
- if (0 <= H && H < 256)
- if (A === "?")
- C.push({
- type: 0,
- index: H
- });
- else {
- const j = (0,
- v.parseColor)(A);
- j && C.push({
- type: 1,
- index: H,
- color: j
- })
- }
- }
- }
- return C.length && this._onColor.fire(C),
- !0
- }
- setHyperlink(p) {
- const C = p.split(";");
- return !(C.length < 2) && (C[1] ? this._createHyperlink(C[0], C[1]) : !C[0] && this._finishHyperlink())
- }
- _createHyperlink(p, C) {
- this._currentLinkId !== void 0 && this._finishHyperlink();
- const b = p.split(":");
- let E;
- const A = b.findIndex(H => H.startsWith("id="));
- return A !== -1 && (E = b[A].slice(3) || void 0),
- this._curAttrData.extended = this._curAttrData.extended.clone(),
- this._currentLinkId = this._oscLinkService.registerLink({
- id: E,
- uri: C
- }),
- this._curAttrData.extended.urlId = this._currentLinkId,
- this._curAttrData.updateExtended(),
- !0
- }
- _finishHyperlink() {
- return this._curAttrData.extended = this._curAttrData.extended.clone(),
- this._curAttrData.extended.urlId = 0,
- this._curAttrData.updateExtended(),
- this._currentLinkId = void 0,
- !0
- }
- _setOrReportSpecialColor(p, C) {
- const b = p.split(";");
- for (let E = 0; E < b.length && !(C >= this._specialColors.length); ++E,
- ++C)
- if (b[E] === "?")
- this._onColor.fire([{
- type: 0,
- index: this._specialColors[C]
- }]);
- else {
- const A = (0,
- v.parseColor)(b[E]);
- A && this._onColor.fire([{
- type: 1,
- index: this._specialColors[C],
- color: A
- }])
- }
- return !0
- }
- setOrReportFgColor(p) {
- return this._setOrReportSpecialColor(p, 0)
- }
- setOrReportBgColor(p) {
- return this._setOrReportSpecialColor(p, 1)
- }
- setOrReportCursorColor(p) {
- return this._setOrReportSpecialColor(p, 2)
- }
- restoreIndexedColor(p) {
- if (!p)
- return this._onColor.fire([{
- type: 2
- }]),
- !0;
- const C = []
- , b = p.split(";");
- for (let E = 0; E < b.length; ++E)
- if (/^\d+$/.exec(b[E])) {
- const A = parseInt(b[E]);
- 0 <= A && A < 256 && C.push({
- type: 2,
- index: A
- })
- }
- return C.length && this._onColor.fire(C),
- !0
- }
- restoreFgColor(p) {
- return this._onColor.fire([{
- type: 2,
- index: 256
- }]),
- !0
- }
- restoreBgColor(p) {
- return this._onColor.fire([{
- type: 2,
- index: 257
- }]),
- !0
- }
- restoreCursorColor(p) {
- return this._onColor.fire([{
- type: 2,
- index: 258
- }]),
- !0
- }
- nextLine() {
- return this._activeBuffer.x = 0,
- this.index(),
- !0
- }
- keypadApplicationMode() {
- return this._logService.debug("Serial port requested application keypad."),
- this._coreService.decPrivateModes.applicationKeypad = !0,
- this._onRequestSyncScrollBar.fire(),
- !0
- }
- keypadNumericMode() {
- return this._logService.debug("Switching back to normal keypad."),
- this._coreService.decPrivateModes.applicationKeypad = !1,
- this._onRequestSyncScrollBar.fire(),
- !0
- }
- selectDefaultCharset() {
- return this._charsetService.setgLevel(0),
- this._charsetService.setgCharset(0, _.DEFAULT_CHARSET),
- !0
- }
- selectCharset(p) {
- return p.length !== 2 ? (this.selectDefaultCharset(),
- !0) : (p[0] === "/" || this._charsetService.setgCharset(S[p[0]], _.CHARSETS[p[1]] || _.DEFAULT_CHARSET),
- !0)
- }
- index() {
- return this._restrictCursor(),
- this._activeBuffer.y++,
- this._activeBuffer.y === this._activeBuffer.scrollBottom + 1 ? (this._activeBuffer.y--,
- this._bufferService.scroll(this._eraseAttrData())) : this._activeBuffer.y >= this._bufferService.rows && (this._activeBuffer.y = this._bufferService.rows - 1),
- this._restrictCursor(),
- !0
- }
- tabSet() {
- return this._activeBuffer.tabs[this._activeBuffer.x] = !0,
- !0
- }
- reverseIndex() {
- if (this._restrictCursor(),
- this._activeBuffer.y === this._activeBuffer.scrollTop) {
- const p = this._activeBuffer.scrollBottom - this._activeBuffer.scrollTop;
- this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase + this._activeBuffer.y, p, 1),
- this._activeBuffer.lines.set(this._activeBuffer.ybase + this._activeBuffer.y, this._activeBuffer.getBlankLine(this._eraseAttrData())),
- this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop, this._activeBuffer.scrollBottom)
- } else
- this._activeBuffer.y--,
- this._restrictCursor();
- return !0
- }
- fullReset() {
- return this._parser.reset(),
- this._onRequestReset.fire(),
- !0
- }
- reset() {
- this._curAttrData = l.DEFAULT_ATTR_DATA.clone(),
- this._eraseAttrDataInternal = l.DEFAULT_ATTR_DATA.clone()
- }
- _eraseAttrData() {
- return this._eraseAttrDataInternal.bg &= -67108864,
- this._eraseAttrDataInternal.bg |= 67108863 & this._curAttrData.bg,
- this._eraseAttrDataInternal
- }
- setgLevel(p) {
- return this._charsetService.setgLevel(p),
- !0
- }
- screenAlignmentPattern() {
- const p = new s.CellData;
- p.content = 4194304 | "E".charCodeAt(0),
- p.fg = this._curAttrData.fg,
- p.bg = this._curAttrData.bg,
- this._setCursor(0, 0);
- for (let C = 0; C < this._bufferService.rows; ++C) {
- const b = this._activeBuffer.ybase + this._activeBuffer.y + C
- , E = this._activeBuffer.lines.get(b);
- E && (E.fill(p),
- E.isWrapped = !1)
- }
- return this._dirtyRowService.markAllDirty(),
- this._setCursor(0, 0),
- !0
- }
- requestStatusString(p, C) {
- const b = this._bufferService.buffer
- , E = this._optionsService.rawOptions;
- return (A => (this._coreService.triggerDataEvent(`${n.C0.ESC}${A}${n.C0.ESC}\\`),
- !0))(p === '"q' ? `P1$r${this._curAttrData.isProtected() ? 1 : 0}"q` : p === '"p' ? 'P1$r61;1"p' : p === "r" ? `P1$r${b.scrollTop + 1};${b.scrollBottom + 1}r` : p === "m" ? "P1$r0m" : p === " q" ? `P1$r${{
- block: 2,
- underline: 4,
- bar: 6
- }[E.cursorStyle] - (E.cursorBlink ? 1 : 0)} q` : "P0$r")
- }
- }
- r.InputHandler = R
- }
- ,
- 844: (x, r) => {
- function a(n) {
- for (const _ of n)
- _.dispose();
- n.length = 0
- }
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.getDisposeArrayDisposable = r.disposeArray = r.toDisposable = r.Disposable = void 0,
- r.Disposable = class {
- constructor() {
- this._disposables = [],
- this._isDisposed = !1
- }
- dispose() {
- this._isDisposed = !0;
- for (const n of this._disposables)
- n.dispose();
- this._disposables.length = 0
- }
- register(n) {
- return this._disposables.push(n),
- n
- }
- unregister(n) {
- const _ = this._disposables.indexOf(n);
- _ !== -1 && this._disposables.splice(_, 1)
- }
- }
- ,
- r.toDisposable = function (n) {
- return {
- dispose: n
- }
- }
- ,
- r.disposeArray = a,
- r.getDisposeArrayDisposable = function (n) {
- return {
- dispose: () => a(n)
- }
- }
- }
- ,
- 1505: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.FourKeyMap = r.TwoKeyMap = void 0;
- class a {
- constructor() {
- this._data = {}
- }
- set(_, h, f) {
- this._data[_] || (this._data[_] = {}),
- this._data[_][h] = f
- }
- get(_, h) {
- return this._data[_] ? this._data[_][h] : void 0
- }
- clear() {
- this._data = {}
- }
- }
- r.TwoKeyMap = a,
- r.FourKeyMap = class {
- constructor() {
- this._data = new a
- }
- set(n, _, h, f, d) {
- this._data.get(n, _) || this._data.set(n, _, new a),
- this._data.get(n, _).set(h, f, d)
- }
- get(n, _, h, f) {
- var d;
- return (d = this._data.get(n, _)) === null || d === void 0 ? void 0 : d.get(h, f)
- }
- clear() {
- this._data.clear()
- }
- }
- }
- ,
- 6114: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.isLinux = r.isWindows = r.isIphone = r.isIpad = r.isMac = r.isSafari = r.isLegacyEdge = r.isFirefox = void 0;
- const a = typeof navigator > "u"
- , n = a ? "node" : navigator.userAgent
- , _ = a ? "node" : navigator.platform;
- r.isFirefox = n.includes("Firefox"),
- r.isLegacyEdge = n.includes("Edge"),
- r.isSafari = /^((?!chrome|android).)*safari/i.test(n),
- r.isMac = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"].includes(_),
- r.isIpad = _ === "iPad",
- r.isIphone = _ === "iPhone",
- r.isWindows = ["Windows", "Win16", "Win32", "WinCE"].includes(_),
- r.isLinux = _.indexOf("Linux") >= 0
- }
- ,
- 6106: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.SortedList = void 0;
- let a = 0;
- r.SortedList = class {
- constructor(n) {
- this._getKey = n,
- this._array = []
- }
- clear() {
- this._array.length = 0
- }
- insert(n) {
- this._array.length !== 0 ? (a = this._search(this._getKey(n), 0, this._array.length - 1),
- this._array.splice(a, 0, n)) : this._array.push(n)
- }
- delete(n) {
- if (this._array.length === 0)
- return !1;
- const _ = this._getKey(n);
- if (_ === void 0 || (a = this._search(_, 0, this._array.length - 1),
- a === -1) || this._getKey(this._array[a]) !== _)
- return !1;
- do
- if (this._array[a] === n)
- return this._array.splice(a, 1),
- !0;
- while (++a < this._array.length && this._getKey(this._array[a]) === _);
- return !1
- }
- *getKeyIterator(n) {
- if (this._array.length !== 0 && (a = this._search(n, 0, this._array.length - 1),
- !(a < 0 || a >= this._array.length) && this._getKey(this._array[a]) === n))
- do
- yield this._array[a];
- while (++a < this._array.length && this._getKey(this._array[a]) === n)
- }
- forEachByKey(n, _) {
- if (this._array.length !== 0 && (a = this._search(n, 0, this._array.length - 1),
- !(a < 0 || a >= this._array.length) && this._getKey(this._array[a]) === n))
- do
- _(this._array[a]);
- while (++a < this._array.length && this._getKey(this._array[a]) === n)
- }
- values() {
- return this._array.values()
- }
- _search(n, _, h) {
- if (h < _)
- return _;
- let f = Math.floor((_ + h) / 2);
- const d = this._getKey(this._array[f]);
- if (d > n)
- return this._search(n, _, f - 1);
- if (d < n)
- return this._search(n, f + 1, h);
- for (; f > 0 && this._getKey(this._array[f - 1]) === n;)
- f--;
- return f
- }
- }
- }
- ,
- 8273: (x, r) => {
- function a(n, _, h = 0, f = n.length) {
- if (h >= n.length)
- return n;
- h = (n.length + h) % n.length,
- f = f >= n.length ? n.length : (n.length + f) % n.length;
- for (let d = h; d < f; ++d)
- n[d] = _;
- return n
- }
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.concat = r.fillFallback = r.fill = void 0,
- r.fill = function (n, _, h, f) {
- return n.fill ? n.fill(_, h, f) : a(n, _, h, f)
- }
- ,
- r.fillFallback = a,
- r.concat = function (n, _) {
- const h = new n.constructor(n.length + _.length);
- return h.set(n),
- h.set(_, n.length),
- h
- }
- }
- ,
- 9282: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.updateWindowsModeWrappedState = void 0;
- const n = a(643);
- r.updateWindowsModeWrappedState = function (_) {
- const h = _.buffer.lines.get(_.buffer.ybase + _.buffer.y - 1)
- , f = h == null ? void 0 : h.get(_.cols - 1)
- , d = _.buffer.lines.get(_.buffer.ybase + _.buffer.y);
- d && f && (d.isWrapped = f[n.CHAR_DATA_CODE_INDEX] !== n.NULL_CELL_CODE && f[n.CHAR_DATA_CODE_INDEX] !== n.WHITESPACE_CELL_CODE)
- }
- }
- ,
- 3734: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.ExtendedAttrs = r.AttributeData = void 0;
- class a {
- constructor() {
- this.fg = 0,
- this.bg = 0,
- this.extended = new n
- }
- static toColorRGB(h) {
- return [h >>> 16 & 255, h >>> 8 & 255, 255 & h]
- }
- static fromColorRGB(h) {
- return (255 & h[0]) << 16 | (255 & h[1]) << 8 | 255 & h[2]
- }
- clone() {
- const h = new a;
- return h.fg = this.fg,
- h.bg = this.bg,
- h.extended = this.extended.clone(),
- h
- }
- isInverse() {
- return 67108864 & this.fg
- }
- isBold() {
- return 134217728 & this.fg
- }
- isUnderline() {
- return this.hasExtendedAttrs() && this.extended.underlineStyle !== 0 ? 1 : 268435456 & this.fg
- }
- isBlink() {
- return 536870912 & this.fg
- }
- isInvisible() {
- return 1073741824 & this.fg
- }
- isItalic() {
- return 67108864 & this.bg
- }
- isDim() {
- return 134217728 & this.bg
- }
- isStrikethrough() {
- return 2147483648 & this.fg
- }
- isProtected() {
- return 536870912 & this.bg
- }
- getFgColorMode() {
- return 50331648 & this.fg
- }
- getBgColorMode() {
- return 50331648 & this.bg
- }
- isFgRGB() {
- return (50331648 & this.fg) == 50331648
- }
- isBgRGB() {
- return (50331648 & this.bg) == 50331648
- }
- isFgPalette() {
- return (50331648 & this.fg) == 16777216 || (50331648 & this.fg) == 33554432
- }
- isBgPalette() {
- return (50331648 & this.bg) == 16777216 || (50331648 & this.bg) == 33554432
- }
- isFgDefault() {
- return (50331648 & this.fg) == 0
- }
- isBgDefault() {
- return (50331648 & this.bg) == 0
- }
- isAttributeDefault() {
- return this.fg === 0 && this.bg === 0
- }
- getFgColor() {
- switch (50331648 & this.fg) {
- case 16777216:
- case 33554432:
- return 255 & this.fg;
- case 50331648:
- return 16777215 & this.fg;
- default:
- return -1
- }
- }
- getBgColor() {
- switch (50331648 & this.bg) {
- case 16777216:
- case 33554432:
- return 255 & this.bg;
- case 50331648:
- return 16777215 & this.bg;
- default:
- return -1
- }
- }
- hasExtendedAttrs() {
- return 268435456 & this.bg
- }
- updateExtended() {
- this.extended.isEmpty() ? this.bg &= -268435457 : this.bg |= 268435456
- }
- getUnderlineColor() {
- if (268435456 & this.bg && ~this.extended.underlineColor)
- switch (50331648 & this.extended.underlineColor) {
- case 16777216:
- case 33554432:
- return 255 & this.extended.underlineColor;
- case 50331648:
- return 16777215 & this.extended.underlineColor;
- default:
- return this.getFgColor()
- }
- return this.getFgColor()
- }
- getUnderlineColorMode() {
- return 268435456 & this.bg && ~this.extended.underlineColor ? 50331648 & this.extended.underlineColor : this.getFgColorMode()
- }
- isUnderlineColorRGB() {
- return 268435456 & this.bg && ~this.extended.underlineColor ? (50331648 & this.extended.underlineColor) == 50331648 : this.isFgRGB()
- }
- isUnderlineColorPalette() {
- return 268435456 & this.bg && ~this.extended.underlineColor ? (50331648 & this.extended.underlineColor) == 16777216 || (50331648 & this.extended.underlineColor) == 33554432 : this.isFgPalette()
- }
- isUnderlineColorDefault() {
- return 268435456 & this.bg && ~this.extended.underlineColor ? (50331648 & this.extended.underlineColor) == 0 : this.isFgDefault()
- }
- getUnderlineStyle() {
- return 268435456 & this.fg ? 268435456 & this.bg ? this.extended.underlineStyle : 1 : 0
- }
- }
- r.AttributeData = a;
- class n {
- constructor(h = 0, f = 0) {
- this._ext = 0,
- this._urlId = 0,
- this._ext = h,
- this._urlId = f
- }
- get ext() {
- return this._urlId ? -469762049 & this._ext | this.underlineStyle << 26 : this._ext
- }
- set ext(h) {
- this._ext = h
- }
- get underlineStyle() {
- return this._urlId ? 5 : (469762048 & this._ext) >> 26
- }
- set underlineStyle(h) {
- this._ext &= -469762049,
- this._ext |= h << 26 & 469762048
- }
- get underlineColor() {
- return 67108863 & this._ext
- }
- set underlineColor(h) {
- this._ext &= -67108864,
- this._ext |= 67108863 & h
- }
- get urlId() {
- return this._urlId
- }
- set urlId(h) {
- this._urlId = h
- }
- clone() {
- return new n(this._ext, this._urlId)
- }
- isEmpty() {
- return this.underlineStyle === 0 && this._urlId === 0
- }
- }
- r.ExtendedAttrs = n
- }
- ,
- 9092: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.BufferStringIterator = r.Buffer = r.MAX_BUFFER_SIZE = void 0;
- const n = a(6349)
- , _ = a(8437)
- , h = a(511)
- , f = a(643)
- , d = a(4634)
- , l = a(4863)
- , o = a(7116)
- , t = a(3734);
- r.MAX_BUFFER_SIZE = 4294967295,
- r.Buffer = class {
- constructor(e, i, c) {
- this._hasScrollback = e,
- this._optionsService = i,
- this._bufferService = c,
- this.ydisp = 0,
- this.ybase = 0,
- this.y = 0,
- this.x = 0,
- this.savedY = 0,
- this.savedX = 0,
- this.savedCurAttrData = _.DEFAULT_ATTR_DATA.clone(),
- this.savedCharset = o.DEFAULT_CHARSET,
- this.markers = [],
- this._nullCell = h.CellData.fromCharData([0, f.NULL_CELL_CHAR, f.NULL_CELL_WIDTH, f.NULL_CELL_CODE]),
- this._whitespaceCell = h.CellData.fromCharData([0, f.WHITESPACE_CELL_CHAR, f.WHITESPACE_CELL_WIDTH, f.WHITESPACE_CELL_CODE]),
- this._isClearing = !1,
- this._cols = this._bufferService.cols,
- this._rows = this._bufferService.rows,
- this.lines = new n.CircularList(this._getCorrectBufferLength(this._rows)),
- this.scrollTop = 0,
- this.scrollBottom = this._rows - 1,
- this.setupTabStops()
- }
- getNullCell(e) {
- return e ? (this._nullCell.fg = e.fg,
- this._nullCell.bg = e.bg,
- this._nullCell.extended = e.extended) : (this._nullCell.fg = 0,
- this._nullCell.bg = 0,
- this._nullCell.extended = new t.ExtendedAttrs),
- this._nullCell
- }
- getWhitespaceCell(e) {
- return e ? (this._whitespaceCell.fg = e.fg,
- this._whitespaceCell.bg = e.bg,
- this._whitespaceCell.extended = e.extended) : (this._whitespaceCell.fg = 0,
- this._whitespaceCell.bg = 0,
- this._whitespaceCell.extended = new t.ExtendedAttrs),
- this._whitespaceCell
- }
- getBlankLine(e, i) {
- return new _.BufferLine(this._bufferService.cols, this.getNullCell(e), i)
- }
- get hasScrollback() {
- return this._hasScrollback && this.lines.maxLength > this._rows
- }
- get isCursorInViewport() {
- const e = this.ybase + this.y - this.ydisp;
- return e >= 0 && e < this._rows
- }
- _getCorrectBufferLength(e) {
- if (!this._hasScrollback)
- return e;
- const i = e + this._optionsService.rawOptions.scrollback;
- return i > r.MAX_BUFFER_SIZE ? r.MAX_BUFFER_SIZE : i
- }
- fillViewportRows(e) {
- if (this.lines.length === 0) {
- e === void 0 && (e = _.DEFAULT_ATTR_DATA);
- let i = this._rows;
- for (; i--;)
- this.lines.push(this.getBlankLine(e))
- }
- }
- clear() {
- this.ydisp = 0,
- this.ybase = 0,
- this.y = 0,
- this.x = 0,
- this.lines = new n.CircularList(this._getCorrectBufferLength(this._rows)),
- this.scrollTop = 0,
- this.scrollBottom = this._rows - 1,
- this.setupTabStops()
- }
- resize(e, i) {
- const c = this.getNullCell(_.DEFAULT_ATTR_DATA)
- , g = this._getCorrectBufferLength(i);
- if (g > this.lines.maxLength && (this.lines.maxLength = g),
- this.lines.length > 0) {
- if (this._cols < e)
- for (let S = 0; S < this.lines.length; S++)
- this.lines.get(S).resize(e, c);
- let v = 0;
- if (this._rows < i)
- for (let S = this._rows; S < i; S++)
- this.lines.length < i + this.ybase && (this._optionsService.rawOptions.windowsMode ? this.lines.push(new _.BufferLine(e, c)) : this.ybase > 0 && this.lines.length <= this.ybase + this.y + v + 1 ? (this.ybase--,
- v++,
- this.ydisp > 0 && this.ydisp--) : this.lines.push(new _.BufferLine(e, c)));
- else
- for (let S = this._rows; S > i; S--)
- this.lines.length > i + this.ybase && (this.lines.length > this.ybase + this.y + 1 ? this.lines.pop() : (this.ybase++,
- this.ydisp++));
- if (g < this.lines.maxLength) {
- const S = this.lines.length - g;
- S > 0 && (this.lines.trimStart(S),
- this.ybase = Math.max(this.ybase - S, 0),
- this.ydisp = Math.max(this.ydisp - S, 0),
- this.savedY = Math.max(this.savedY - S, 0)),
- this.lines.maxLength = g
- }
- this.x = Math.min(this.x, e - 1),
- this.y = Math.min(this.y, i - 1),
- v && (this.y += v),
- this.savedX = Math.min(this.savedX, e - 1),
- this.scrollTop = 0
- }
- if (this.scrollBottom = i - 1,
- this._isReflowEnabled && (this._reflow(e, i),
- this._cols > e))
- for (let v = 0; v < this.lines.length; v++)
- this.lines.get(v).resize(e, c);
- this._cols = e,
- this._rows = i
- }
- get _isReflowEnabled() {
- return this._hasScrollback && !this._optionsService.rawOptions.windowsMode
- }
- _reflow(e, i) {
- this._cols !== e && (e > this._cols ? this._reflowLarger(e, i) : this._reflowSmaller(e, i))
- }
- _reflowLarger(e, i) {
- const c = (0,
- d.reflowLargerGetLinesToRemove)(this.lines, this._cols, e, this.ybase + this.y, this.getNullCell(_.DEFAULT_ATTR_DATA));
- if (c.length > 0) {
- const g = (0,
- d.reflowLargerCreateNewLayout)(this.lines, c);
- (0,
- d.reflowLargerApplyNewLayout)(this.lines, g.layout),
- this._reflowLargerAdjustViewport(e, i, g.countRemoved)
- }
- }
- _reflowLargerAdjustViewport(e, i, c) {
- const g = this.getNullCell(_.DEFAULT_ATTR_DATA);
- let v = c;
- for (; v-- > 0;)
- this.ybase === 0 ? (this.y > 0 && this.y--,
- this.lines.length < i && this.lines.push(new _.BufferLine(e, g))) : (this.ydisp === this.ybase && this.ydisp--,
- this.ybase--);
- this.savedY = Math.max(this.savedY - c, 0)
- }
- _reflowSmaller(e, i) {
- const c = this.getNullCell(_.DEFAULT_ATTR_DATA)
- , g = [];
- let v = 0;
- for (let S = this.lines.length - 1; S >= 0; S--) {
- let u = this.lines.get(S);
- if (!u || !u.isWrapped && u.getTrimmedLength() <= e)
- continue;
- const m = [u];
- for (; u.isWrapped && S > 0;)
- u = this.lines.get(--S),
- m.unshift(u);
- const w = this.ybase + this.y;
- if (w >= S && w < S + m.length)
- continue;
- const R = m[m.length - 1].getTrimmedLength()
- , L = (0,
- d.reflowSmallerGetNewLineLengths)(m, this._cols, e)
- , p = L.length - m.length;
- let C;
- C = this.ybase === 0 && this.y !== this.lines.length - 1 ? Math.max(0, this.y - this.lines.maxLength + p) : Math.max(0, this.lines.length - this.lines.maxLength + p);
- const b = [];
- for (let P = 0; P < p; P++) {
- const N = this.getBlankLine(_.DEFAULT_ATTR_DATA, !0);
- b.push(N)
- }
- b.length > 0 && (g.push({
- start: S + m.length + v,
- newLines: b
- }),
- v += b.length),
- m.push(...b);
- let E = L.length - 1
- , A = L[E];
- A === 0 && (E--,
- A = L[E]);
- let H = m.length - p - 1
- , j = R;
- for (; H >= 0;) {
- const P = Math.min(j, A);
- if (m[E] === void 0)
- break;
- if (m[E].copyCellsFrom(m[H], j - P, A - P, P, !0),
- A -= P,
- A === 0 && (E--,
- A = L[E]),
- j -= P,
- j === 0) {
- H--;
- const N = Math.max(H, 0);
- j = (0,
- d.getWrappedLineTrimmedLength)(m, N, this._cols)
- }
- }
- for (let P = 0; P < m.length; P++)
- L[P] < e && m[P].setCell(L[P], c);
- let$ = p - C;
- for (; $-- > 0;)
- this.ybase === 0 ? this.y < i - 1 ? (this.y++,
- this.lines.pop()) : (this.ybase++,
- this.ydisp++) : this.ybase < Math.min(this.lines.maxLength, this.lines.length + v) - i && (this.ybase === this.ydisp && this.ydisp++,
- this.ybase++);
- this.savedY = Math.min(this.savedY + p, this.ybase + i - 1)
- }
- if (g.length > 0) {
- const S = []
- , u = [];
- for (let E = 0; E < this.lines.length; E++)
- u.push(this.lines.get(E));
- const m = this.lines.length;
- let w = m - 1
- , R = 0
- , L = g[R];
- this.lines.length = Math.min(this.lines.maxLength, this.lines.length + v);
- let p = 0;
- for (let E = Math.min(this.lines.maxLength - 1, m + v - 1); E >= 0; E--)
- if (L && L.start > w + p) {
- for (let A = L.newLines.length - 1; A >= 0; A--)
- this.lines.set(E--, L.newLines[A]);
- E++,
- S.push({
- index: w + 1,
- amount: L.newLines.length
- }),
- p += L.newLines.length,
- L = g[++R]
- } else
- this.lines.set(E, u[w--]);
- let C = 0;
- for (let E = S.length - 1; E >= 0; E--)
- S[E].index += C,
- this.lines.onInsertEmitter.fire(S[E]),
- C += S[E].amount;
- const b = Math.max(0, m + v - this.lines.maxLength);
- b > 0 && this.lines.onTrimEmitter.fire(b)
- }
- }
- stringIndexToBufferIndex(e, i, c = !1) {
- for (; i;) {
- const g = this.lines.get(e);
- if (!g)
- return [-1, -1];
- const v = c ? g.getTrimmedLength() : g.length;
- for (let S = 0; S < v; ++S)
- if (g.get(S)[f.CHAR_DATA_WIDTH_INDEX] && (i -= g.get(S)[f.CHAR_DATA_CHAR_INDEX].length || 1),
- i < 0)
- return [e, S];
- e++
- }
- return [e, 0]
- }
- translateBufferLineToString(e, i, c = 0, g) {
- const v = this.lines.get(e);
- return v ? v.translateToString(i, c, g) : ""
- }
- getWrappedRangeForLine(e) {
- let i = e
- , c = e;
- for (; i > 0 && this.lines.get(i).isWrapped;)
- i--;
- for (; c + 1 < this.lines.length && this.lines.get(c + 1).isWrapped;)
- c++;
- return {
- first: i,
- last: c
- }
- }
- setupTabStops(e) {
- for (e != null ? this.tabs[e] || (e = this.prevStop(e)) : (this.tabs = {},
- e = 0); e < this._cols; e += this._optionsService.rawOptions.tabStopWidth)
- this.tabs[e] = !0
- }
- prevStop(e) {
- for (e == null && (e = this.x); !this.tabs[--e] && e > 0;)
- ;
- return e >= this._cols ? this._cols - 1 : e < 0 ? 0 : e
- }
- nextStop(e) {
- for (e == null && (e = this.x); !this.tabs[++e] && e < this._cols;)
- ;
- return e >= this._cols ? this._cols - 1 : e < 0 ? 0 : e
- }
- clearMarkers(e) {
- this._isClearing = !0;
- for (let i = 0; i < this.markers.length; i++)
- this.markers[i].line === e && (this.markers[i].dispose(),
- this.markers.splice(i--, 1));
- this._isClearing = !1
- }
- clearAllMarkers() {
- this._isClearing = !0;
- for (let e = 0; e < this.markers.length; e++)
- this.markers[e].dispose(),
- this.markers.splice(e--, 1);
- this._isClearing = !1
- }
- addMarker(e) {
- const i = new l.Marker(e);
- return this.markers.push(i),
- i.register(this.lines.onTrim(c => {
- i.line -= c,
- i.line < 0 && i.dispose()
- }
- )),
- i.register(this.lines.onInsert(c => {
- i.line >= c.index && (i.line += c.amount)
- }
- )),
- i.register(this.lines.onDelete(c => {
- i.line >= c.index && i.line < c.index + c.amount && i.dispose(),
- i.line > c.index && (i.line -= c.amount)
- }
- )),
- i.register(i.onDispose(() => this._removeMarker(i))),
- i
- }
- _removeMarker(e) {
- this._isClearing || this.markers.splice(this.markers.indexOf(e), 1)
- }
- iterator(e, i, c, g, v) {
- return new s(this, e, i, c, g, v)
- }
- }
- ;
- class s {
- constructor(i, c, g = 0, v = i.lines.length, S = 0, u = 0) {
- this._buffer = i,
- this._trimRight = c,
- this._startIndex = g,
- this._endIndex = v,
- this._startOverscan = S,
- this._endOverscan = u,
- this._startIndex < 0 && (this._startIndex = 0),
- this._endIndex > this._buffer.lines.length && (this._endIndex = this._buffer.lines.length),
- this._current = this._startIndex
- }
- hasNext() {
- return this._current < this._endIndex
- }
- next() {
- const i = this._buffer.getWrappedRangeForLine(this._current);
- i.first < this._startIndex - this._startOverscan && (i.first = this._startIndex - this._startOverscan),
- i.last > this._endIndex + this._endOverscan && (i.last = this._endIndex + this._endOverscan),
- i.first = Math.max(i.first, 0),
- i.last = Math.min(i.last, this._buffer.lines.length);
- let c = "";
- for (let g = i.first; g <= i.last; ++g)
- c += this._buffer.translateBufferLineToString(g, this._trimRight);
- return this._current = i.last + 1,
- {
- range: i,
- content: c
- }
- }
- }
- r.BufferStringIterator = s
- }
- ,
- 8437: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.BufferLine = r.DEFAULT_ATTR_DATA = void 0;
- const n = a(482)
- , _ = a(643)
- , h = a(511)
- , f = a(3734);
- r.DEFAULT_ATTR_DATA = Object.freeze(new f.AttributeData);
- const d = {
- startIndex: 0
- };
- class l {
- constructor(t, s, e = !1) {
- this.isWrapped = e,
- this._combined = {},
- this._extendedAttrs = {},
- this._data = new Uint32Array(3 * t);
- const i = s || h.CellData.fromCharData([0, _.NULL_CELL_CHAR, _.NULL_CELL_WIDTH, _.NULL_CELL_CODE]);
- for (let c = 0; c < t; ++c)
- this.setCell(c, i);
- this.length = t
- }
- get(t) {
- const s = this._data[3 * t + 0]
- , e = 2097151 & s;
- return [this._data[3 * t + 1], 2097152 & s ? this._combined[t] : e ? (0,
- n.stringFromCodePoint)(e) : "", s >> 22, 2097152 & s ? this._combined[t].charCodeAt(this._combined[t].length - 1) : e]
- }
- set(t, s) {
- this._data[3 * t + 1] = s[_.CHAR_DATA_ATTR_INDEX],
- s[_.CHAR_DATA_CHAR_INDEX].length > 1 ? (this._combined[t] = s[1],
- this._data[3 * t + 0] = 2097152 | t | s[_.CHAR_DATA_WIDTH_INDEX] << 22) : this._data[3 * t + 0] = s[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | s[_.CHAR_DATA_WIDTH_INDEX] << 22
- }
- getWidth(t) {
- return this._data[3 * t + 0] >> 22
- }
- hasWidth(t) {
- return 12582912 & this._data[3 * t + 0]
- }
- getFg(t) {
- return this._data[3 * t + 1]
- }
- getBg(t) {
- return this._data[3 * t + 2]
- }
- hasContent(t) {
- return 4194303 & this._data[3 * t + 0]
- }
- getCodePoint(t) {
- const s = this._data[3 * t + 0];
- return 2097152 & s ? this._combined[t].charCodeAt(this._combined[t].length - 1) : 2097151 & s
- }
- isCombined(t) {
- return 2097152 & this._data[3 * t + 0]
- }
- getString(t) {
- const s = this._data[3 * t + 0];
- return 2097152 & s ? this._combined[t] : 2097151 & s ? (0,
- n.stringFromCodePoint)(2097151 & s) : ""
- }
- isProtected(t) {
- return 536870912 & this._data[3 * t + 2]
- }
- loadCell(t, s) {
- return d.startIndex = 3 * t,
- s.content = this._data[d.startIndex + 0],
- s.fg = this._data[d.startIndex + 1],
- s.bg = this._data[d.startIndex + 2],
- 2097152 & s.content && (s.combinedData = this._combined[t]),
- 268435456 & s.bg && (s.extended = this._extendedAttrs[t]),
- s
- }
- setCell(t, s) {
- 2097152 & s.content && (this._combined[t] = s.combinedData),
- 268435456 & s.bg && (this._extendedAttrs[t] = s.extended),
- this._data[3 * t + 0] = s.content,
- this._data[3 * t + 1] = s.fg,
- this._data[3 * t + 2] = s.bg
- }
- setCellFromCodePoint(t, s, e, i, c, g) {
- 268435456 & c && (this._extendedAttrs[t] = g),
- this._data[3 * t + 0] = s | e << 22,
- this._data[3 * t + 1] = i,
- this._data[3 * t + 2] = c
- }
- addCodepointToCell(t, s) {
- let e = this._data[3 * t + 0];
- 2097152 & e ? this._combined[t] += (0,
- n.stringFromCodePoint)(s) : (2097151 & e ? (this._combined[t] = (0,
- n.stringFromCodePoint)(2097151 & e) + (0,
- n.stringFromCodePoint)(s),
- e &= -2097152,
- e |= 2097152) : e = s | 4194304,
- this._data[3 * t + 0] = e)
- }
- insertCells(t, s, e, i) {
- if ((t %= this.length) && this.getWidth(t - 1) === 2 && this.setCellFromCodePoint(t - 1, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs),
- s < this.length - t) {
- const c = new h.CellData;
- for (let g = this.length - t - s - 1; g >= 0; --g)
- this.setCell(t + s + g, this.loadCell(t + g, c));
- for (let g = 0; g < s; ++g)
- this.setCell(t + g, e)
- } else
- for (let c = t; c < this.length; ++c)
- this.setCell(c, e);
- this.getWidth(this.length - 1) === 2 && this.setCellFromCodePoint(this.length - 1, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs)
- }
- deleteCells(t, s, e, i) {
- if (t %= this.length,
- s < this.length - t) {
- const c = new h.CellData;
- for (let g = 0; g < this.length - t - s; ++g)
- this.setCell(t + g, this.loadCell(t + s + g, c));
- for (let g = this.length - s; g < this.length; ++g)
- this.setCell(g, e)
- } else
- for (let c = t; c < this.length; ++c)
- this.setCell(c, e);
- t && this.getWidth(t - 1) === 2 && this.setCellFromCodePoint(t - 1, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs),
- this.getWidth(t) !== 0 || this.hasContent(t) || this.setCellFromCodePoint(t, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs)
- }
- replaceCells(t, s, e, i, c = !1) {
- if (c)
- for (t && this.getWidth(t - 1) === 2 && !this.isProtected(t - 1) && this.setCellFromCodePoint(t - 1, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs),
- s < this.length && this.getWidth(s - 1) === 2 && !this.isProtected(s) && this.setCellFromCodePoint(s, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs); t < s && t < this.length;)
- this.isProtected(t) || this.setCell(t, e),
- t++;
- else
- for (t && this.getWidth(t - 1) === 2 && this.setCellFromCodePoint(t - 1, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs),
- s < this.length && this.getWidth(s - 1) === 2 && this.setCellFromCodePoint(s, 0, 1, (i == null ? void 0 : i.fg) || 0, (i == null ? void 0 : i.bg) || 0, (i == null ? void 0 : i.extended) || new f.ExtendedAttrs); t < s && t < this.length;)
- this.setCell(t++, e)
- }
- resize(t, s) {
- if (t !== this.length) {
- if (t > this.length) {
- const e = new Uint32Array(3 * t);
- this.length && (3 * t < this._data.length ? e.set(this._data.subarray(0, 3 * t)) : e.set(this._data)),
- this._data = e;
- for (let i = this.length; i < t; ++i)
- this.setCell(i, s)
- } else if (t) {
- const e = new Uint32Array(3 * t);
- e.set(this._data.subarray(0, 3 * t)),
- this._data = e;
- const i = Object.keys(this._combined);
- for (let c = 0; c < i.length; c++) {
- const g = parseInt(i[c], 10);
- g >= t && delete this._combined[g]
- }
- } else
- this._data = new Uint32Array(0),
- this._combined = {};
- this.length = t
- }
- }
- fill(t, s = !1) {
- if (s)
- for (let e = 0; e < this.length; ++e)
- this.isProtected(e) || this.setCell(e, t);
- else {
- this._combined = {},
- this._extendedAttrs = {};
- for (let e = 0; e < this.length; ++e)
- this.setCell(e, t)
- }
- }
- copyFrom(t) {
- this.length !== t.length ? this._data = new Uint32Array(t._data) : this._data.set(t._data),
- this.length = t.length,
- this._combined = {};
- for (const s in t._combined)
- this._combined[s] = t._combined[s];
- this._extendedAttrs = {};
- for (const s in t._extendedAttrs)
- this._extendedAttrs[s] = t._extendedAttrs[s];
- this.isWrapped = t.isWrapped
- }
- clone() {
- const t = new l(0);
- t._data = new Uint32Array(this._data),
- t.length = this.length;
- for (const s in this._combined)
- t._combined[s] = this._combined[s];
- for (const s in this._extendedAttrs)
- t._extendedAttrs[s] = this._extendedAttrs[s];
- return t.isWrapped = this.isWrapped,
- t
- }
- getTrimmedLength() {
- for (let t = this.length - 1; t >= 0; --t)
- if (4194303 & this._data[3 * t + 0])
- return t + (this._data[3 * t + 0] >> 22);
- return 0
- }
- copyCellsFrom(t, s, e, i, c) {
- const g = t._data;
- if (c)
- for (let S = i - 1; S >= 0; S--) {
- for (let u = 0; u < 3; u++)
- this._data[3 * (e + S) + u] = g[3 * (s + S) + u];
- 268435456 & g[3 * (s + S) + 2] && (this._extendedAttrs[e + S] = t._extendedAttrs[s + S])
- }
- else
- for (let S = 0; S < i; S++) {
- for (let u = 0; u < 3; u++)
- this._data[3 * (e + S) + u] = g[3 * (s + S) + u];
- 268435456 & g[3 * (s + S) + 2] && (this._extendedAttrs[e + S] = t._extendedAttrs[s + S])
- }
- const v = Object.keys(t._combined);
- for (let S = 0; S < v.length; S++) {
- const u = parseInt(v[S], 10);
- u >= s && (this._combined[u - s + e] = t._combined[u])
- }
- }
- translateToString(t = !1, s = 0, e = this.length) {
- t && (e = Math.min(e, this.getTrimmedLength()));
- let i = "";
- for (; s < e;) {
- const c = this._data[3 * s + 0]
- , g = 2097151 & c;
- i += 2097152 & c ? this._combined[s] : g ? (0,
- n.stringFromCodePoint)(g) : _.WHITESPACE_CELL_CHAR,
- s += c >> 22 || 1
- }
- return i
- }
- }
- r.BufferLine = l
- }
- ,
- 4841: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.getRangeLength = void 0,
- r.getRangeLength = function (a, n) {
- if (a.start.y > a.end.y)
- throw new Error(`Buffer range end (${a.end.x}, ${a.end.y}) cannot be before start (${a.start.x}, ${a.start.y})`);
- return n * (a.end.y - a.start.y) + (a.end.x - a.start.x + 1)
- }
- }
- ,
- 4634: (x, r) => {
- function a(n, _, h) {
- if (_ === n.length - 1)
- return n[_].getTrimmedLength();
- const f = !n[_].hasContent(h - 1) && n[_].getWidth(h - 1) === 1
- , d = n[_ + 1].getWidth(0) === 2;
- return f && d ? h - 1 : h
- }
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.getWrappedLineTrimmedLength = r.reflowSmallerGetNewLineLengths = r.reflowLargerApplyNewLayout = r.reflowLargerCreateNewLayout = r.reflowLargerGetLinesToRemove = void 0,
- r.reflowLargerGetLinesToRemove = function (n, _, h, f, d) {
- const l = [];
- for (let o = 0; o < n.length - 1; o++) {
- let t = o
- , s = n.get(++t);
- if (!s.isWrapped)
- continue;
- const e = [n.get(o)];
- for (; t < n.length && s.isWrapped;)
- e.push(s),
- s = n.get(++t);
- if (f >= o && f < t) {
- o += e.length - 1;
- continue
- }
- let i = 0
- , c = a(e, i, _)
- , g = 1
- , v = 0;
- for (; g < e.length;) {
- const u = a(e, g, _)
- , m = u - v
- , w = h - c
- , R = Math.min(m, w);
- e[i].copyCellsFrom(e[g], v, c, R, !1),
- c += R,
- c === h && (i++,
- c = 0),
- v += R,
- v === u && (g++,
- v = 0),
- c === 0 && i !== 0 && e[i - 1].getWidth(h - 1) === 2 && (e[i].copyCellsFrom(e[i - 1], h - 1, c++, 1, !1),
- e[i - 1].setCell(h - 1, d))
- }
- e[i].replaceCells(c, h, d);
- let S = 0;
- for (let u = e.length - 1; u > 0 && (u > i || e[u].getTrimmedLength() === 0); u--)
- S++;
- S > 0 && (l.push(o + e.length - S),
- l.push(S)),
- o += e.length - 1
- }
- return l
- }
- ,
- r.reflowLargerCreateNewLayout = function (n, _) {
- const h = [];
- let f = 0
- , d = _[f]
- , l = 0;
- for (let o = 0; o < n.length; o++)
- if (d === o) {
- const t = _[++f];
- n.onDeleteEmitter.fire({
- index: o - l,
- amount: t
- }),
- o += t - 1,
- l += t,
- d = _[++f]
- } else
- h.push(o);
- return {
- layout: h,
- countRemoved: l
- }
- }
- ,
- r.reflowLargerApplyNewLayout = function (n, _) {
- const h = [];
- for (let f = 0; f < _.length; f++)
- h.push(n.get(_[f]));
- for (let f = 0; f < h.length; f++)
- n.set(f, h[f]);
- n.length = _.length
- }
- ,
- r.reflowSmallerGetNewLineLengths = function (n, _, h) {
- const f = []
- , d = n.map((s, e) => a(n, e, _)).reduce((s, e) => s + e);
- let l = 0
- , o = 0
- , t = 0;
- for (; t < d;) {
- if (d - t < h) {
- f.push(d - t);
- break
- }
- l += h;
- const s = a(n, o, _);
- l > s && (l -= s,
- o++);
- const e = n[o].getWidth(l - 1) === 2;
- e && l--;
- const i = e ? h - 1 : h;
- f.push(i),
- t += i
- }
- return f
- }
- ,
- r.getWrappedLineTrimmedLength = a
- }
- ,
- 5295: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.BufferSet = void 0;
- const n = a(9092)
- , _ = a(8460)
- , h = a(844);
- class f extends h.Disposable {
- constructor(l, o) {
- super(),
- this._optionsService = l,
- this._bufferService = o,
- this._onBufferActivate = this.register(new _.EventEmitter),
- this.reset()
- }
- get onBufferActivate() {
- return this._onBufferActivate.event
- }
- reset() {
- this._normal = new n.Buffer(!0, this._optionsService, this._bufferService),
- this._normal.fillViewportRows(),
- this._alt = new n.Buffer(!1, this._optionsService, this._bufferService),
- this._activeBuffer = this._normal,
- this._onBufferActivate.fire({
- activeBuffer: this._normal,
- inactiveBuffer: this._alt
- }),
- this.setupTabStops()
- }
- get alt() {
- return this._alt
- }
- get active() {
- return this._activeBuffer
- }
- get normal() {
- return this._normal
- }
- activateNormalBuffer() {
- this._activeBuffer !== this._normal && (this._normal.x = this._alt.x,
- this._normal.y = this._alt.y,
- this._alt.clearAllMarkers(),
- this._alt.clear(),
- this._activeBuffer = this._normal,
- this._onBufferActivate.fire({
- activeBuffer: this._normal,
- inactiveBuffer: this._alt
- }))
- }
- activateAltBuffer(l) {
- this._activeBuffer !== this._alt && (this._alt.fillViewportRows(l),
- this._alt.x = this._normal.x,
- this._alt.y = this._normal.y,
- this._activeBuffer = this._alt,
- this._onBufferActivate.fire({
- activeBuffer: this._alt,
- inactiveBuffer: this._normal
- }))
- }
- resize(l, o) {
- this._normal.resize(l, o),
- this._alt.resize(l, o)
- }
- setupTabStops(l) {
- this._normal.setupTabStops(l),
- this._alt.setupTabStops(l)
- }
- }
- r.BufferSet = f
- }
- ,
- 511: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.CellData = void 0;
- const n = a(482)
- , _ = a(643)
- , h = a(3734);
- class f extends h.AttributeData {
- constructor() {
- super(...arguments),
- this.content = 0,
- this.fg = 0,
- this.bg = 0,
- this.extended = new h.ExtendedAttrs,
- this.combinedData = ""
- }
- static fromCharData(l) {
- const o = new f;
- return o.setFromCharData(l),
- o
- }
- isCombined() {
- return 2097152 & this.content
- }
- getWidth() {
- return this.content >> 22
- }
- getChars() {
- return 2097152 & this.content ? this.combinedData : 2097151 & this.content ? (0,
- n.stringFromCodePoint)(2097151 & this.content) : ""
- }
- getCode() {
- return this.isCombined() ? this.combinedData.charCodeAt(this.combinedData.length - 1) : 2097151 & this.content
- }
- setFromCharData(l) {
- this.fg = l[_.CHAR_DATA_ATTR_INDEX],
- this.bg = 0;
- let o = !1;
- if (l[_.CHAR_DATA_CHAR_INDEX].length > 2)
- o = !0;
- else if (l[_.CHAR_DATA_CHAR_INDEX].length === 2) {
- const t = l[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0);
- if (55296 <= t && t <= 56319) {
- const s = l[_.CHAR_DATA_CHAR_INDEX].charCodeAt(1);
- 56320 <= s && s <= 57343 ? this.content = 1024 * (t - 55296) + s - 56320 + 65536 | l[_.CHAR_DATA_WIDTH_INDEX] << 22 : o = !0
- } else
- o = !0
- } else
- this.content = l[_.CHAR_DATA_CHAR_INDEX].charCodeAt(0) | l[_.CHAR_DATA_WIDTH_INDEX] << 22;
- o && (this.combinedData = l[_.CHAR_DATA_CHAR_INDEX],
- this.content = 2097152 | l[_.CHAR_DATA_WIDTH_INDEX] << 22)
- }
- getAsCharData() {
- return [this.fg, this.getChars(), this.getWidth(), this.getCode()]
- }
- }
- r.CellData = f
- }
- ,
- 643: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.WHITESPACE_CELL_CODE = r.WHITESPACE_CELL_WIDTH = r.WHITESPACE_CELL_CHAR = r.NULL_CELL_CODE = r.NULL_CELL_WIDTH = r.NULL_CELL_CHAR = r.CHAR_DATA_CODE_INDEX = r.CHAR_DATA_WIDTH_INDEX = r.CHAR_DATA_CHAR_INDEX = r.CHAR_DATA_ATTR_INDEX = r.DEFAULT_EXT = r.DEFAULT_ATTR = r.DEFAULT_COLOR = void 0,
- r.DEFAULT_COLOR = 256,
- r.DEFAULT_ATTR = 256 | r.DEFAULT_COLOR << 9,
- r.DEFAULT_EXT = 0,
- r.CHAR_DATA_ATTR_INDEX = 0,
- r.CHAR_DATA_CHAR_INDEX = 1,
- r.CHAR_DATA_WIDTH_INDEX = 2,
- r.CHAR_DATA_CODE_INDEX = 3,
- r.NULL_CELL_CHAR = "",
- r.NULL_CELL_WIDTH = 1,
- r.NULL_CELL_CODE = 0,
- r.WHITESPACE_CELL_CHAR = " ",
- r.WHITESPACE_CELL_WIDTH = 1,
- r.WHITESPACE_CELL_CODE = 32
- }
- ,
- 4863: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.Marker = void 0;
- const n = a(8460)
- , _ = a(844);
- class h extends _.Disposable {
- constructor(d) {
- super(),
- this.line = d,
- this._id = h._nextId++,
- this.isDisposed = !1,
- this._onDispose = new n.EventEmitter
- }
- get id() {
- return this._id
- }
- get onDispose() {
- return this._onDispose.event
- }
- dispose() {
- this.isDisposed || (this.isDisposed = !0,
- this.line = -1,
- this._onDispose.fire(),
- super.dispose())
- }
- }
- r.Marker = h,
- h._nextId = 1
- }
- ,
- 7116: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.DEFAULT_CHARSET = r.CHARSETS = void 0,
- r.CHARSETS = {},
- r.DEFAULT_CHARSET = r.CHARSETS.B,
- r.CHARSETS[0] = {
- "`": "\u25C6",
- a: "\u2592",
- b: "\u2409",
- c: "\u240C",
- d: "\u240D",
- e: "\u240A",
- f: "\xB0",
- g: "\xB1",
- h: "\u2424",
- i: "\u240B",
- j: "\u2518",
- k: "\u2510",
- l: "\u250C",
- m: "\u2514",
- n: "\u253C",
- o: "\u23BA",
- p: "\u23BB",
- q: "\u2500",
- r: "\u23BC",
- s: "\u23BD",
- t: "\u251C",
- u: "\u2524",
- v: "\u2534",
- w: "\u252C",
- x: "\u2502",
- y: "\u2264",
- z: "\u2265",
- "{": "\u03C0",
- "|": "\u2260",
- "}": "\xA3",
- "~": "\xB7"
- },
- r.CHARSETS.A = {
- "#": "\xA3"
- },
- r.CHARSETS.B = void 0,
- r.CHARSETS[4] = {
- "#": "\xA3",
- "@": "\xBE",
- "[": "ij",
- "\\": "\xBD",
- "]": "|",
- "{": "\xA8",
- "|": "f",
- "}": "\xBC",
- "~": "\xB4"
- },
- r.CHARSETS.C = r.CHARSETS[5] = {
- "[": "\xC4",
- "\\": "\xD6",
- "]": "\xC5",
- "^": "\xDC",
- "`": "\xE9",
- "{": "\xE4",
- "|": "\xF6",
- "}": "\xE5",
- "~": "\xFC"
- },
- r.CHARSETS.R = {
- "#": "\xA3",
- "@": "\xE0",
- "[": "\xB0",
- "\\": "\xE7",
- "]": "\xA7",
- "{": "\xE9",
- "|": "\xF9",
- "}": "\xE8",
- "~": "\xA8"
- },
- r.CHARSETS.Q = {
- "@": "\xE0",
- "[": "\xE2",
- "\\": "\xE7",
- "]": "\xEA",
- "^": "\xEE",
- "`": "\xF4",
- "{": "\xE9",
- "|": "\xF9",
- "}": "\xE8",
- "~": "\xFB"
- },
- r.CHARSETS.K = {
- "@": "\xA7",
- "[": "\xC4",
- "\\": "\xD6",
- "]": "\xDC",
- "{": "\xE4",
- "|": "\xF6",
- "}": "\xFC",
- "~": "\xDF"
- },
- r.CHARSETS.Y = {
- "#": "\xA3",
- "@": "\xA7",
- "[": "\xB0",
- "\\": "\xE7",
- "]": "\xE9",
- "`": "\xF9",
- "{": "\xE0",
- "|": "\xF2",
- "}": "\xE8",
- "~": "\xEC"
- },
- r.CHARSETS.E = r.CHARSETS[6] = {
- "@": "\xC4",
- "[": "\xC6",
- "\\": "\xD8",
- "]": "\xC5",
- "^": "\xDC",
- "`": "\xE4",
- "{": "\xE6",
- "|": "\xF8",
- "}": "\xE5",
- "~": "\xFC"
- },
- r.CHARSETS.Z = {
- "#": "\xA3",
- "@": "\xA7",
- "[": "\xA1",
- "\\": "\xD1",
- "]": "\xBF",
- "{": "\xB0",
- "|": "\xF1",
- "}": "\xE7"
- },
- r.CHARSETS.H = r.CHARSETS[7] = {
- "@": "\xC9",
- "[": "\xC4",
- "\\": "\xD6",
- "]": "\xC5",
- "^": "\xDC",
- "`": "\xE9",
- "{": "\xE4",
- "|": "\xF6",
- "}": "\xE5",
- "~": "\xFC"
- },
- r.CHARSETS["="] = {
- "#": "\xF9",
- "@": "\xE0",
- "[": "\xE9",
- "\\": "\xE7",
- "]": "\xEA",
- "^": "\xEE",
- _: "\xE8",
- "`": "\xF4",
- "{": "\xE4",
- "|": "\xF6",
- "}": "\xFC",
- "~": "\xFB"
- }
- }
- ,
- 2584: (x, r) => {
- var a, n;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.C1_ESCAPED = r.C1 = r.C0 = void 0,
- function (_) {
- _.NUL = "\0",
- _.SOH = "",
- _.STX = "",
- _.ETX = "",
- _.EOT = "",
- _.ENQ = "",
- _.ACK = "",
- _.BEL = "\x07",
- _.BS = "\b",
- _.HT = " ",
- _.LF = `
- `,
- _.VT = "\v",
- _.FF = "\f",
- _.CR = "\r",
- _.SO = "",
- _.SI = "",
- _.DLE = "",
- _.DC1 = "",
- _.DC2 = "",
- _.DC3 = "",
- _.DC4 = "",
- _.NAK = "",
- _.SYN = "",
- _.ETB = "",
- _.CAN = "",
- _.EM = "",
- _.SUB = "",
- _.ESC = "\x1B",
- _.FS = "",
- _.GS = "",
- _.RS = "",
- _.US = "",
- _.SP = " ",
- _.DEL = "\x7F"
- }(a = r.C0 || (r.C0 = {})),
- (n = r.C1 || (r.C1 = {})).PAD = "\x80",
- n.HOP = "\x81",
- n.BPH = "\x82",
- n.NBH = "\x83",
- n.IND = "\x84",
- n.NEL = "\x85",
- n.SSA = "\x86",
- n.ESA = "\x87",
- n.HTS = "\x88",
- n.HTJ = "\x89",
- n.VTS = "\x8A",
- n.PLD = "\x8B",
- n.PLU = "\x8C",
- n.RI = "\x8D",
- n.SS2 = "\x8E",
- n.SS3 = "\x8F",
- n.DCS = "\x90",
- n.PU1 = "\x91",
- n.PU2 = "\x92",
- n.STS = "\x93",
- n.CCH = "\x94",
- n.MW = "\x95",
- n.SPA = "\x96",
- n.EPA = "\x97",
- n.SOS = "\x98",
- n.SGCI = "\x99",
- n.SCI = "\x9A",
- n.CSI = "\x9B",
- n.ST = "\x9C",
- n.OSC = "\x9D",
- n.PM = "\x9E",
- n.APC = "\x9F",
- (r.C1_ESCAPED || (r.C1_ESCAPED = {})).ST = `${a.ESC}\\`
- }
- ,
- 7399: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.evaluateKeyboardEvent = void 0;
- const n = a(2584)
- , _ = {
- 48: ["0", ")"],
- 49: ["1", "!"],
- 50: ["2", "@"],
- 51: ["3", "#"],
- 52: ["4", "$"],
- 53: ["5", "%"],
- 54: ["6", "^"],
- 55: ["7", "&"],
- 56: ["8", "*"],
- 57: ["9", "("],
- 186: [";", ":"],
- 187: ["=", "+"],
- 188: [",", "<"],
- 189: ["-", "_"],
- 190: [".", ">"],
- 191: ["/", "?"],
- 192: ["`", "~"],
- 219: ["[", "{"],
- 220: ["\\", "|"],
- 221: ["]", "}"],
- 222: ["'", '"']
- };
- r.evaluateKeyboardEvent = function (h, f, d, l) {
- const o = {
- type: 0,
- cancel: !1,
- key: void 0
- }
- , t = (h.shiftKey ? 1 : 0) | (h.altKey ? 2 : 0) | (h.ctrlKey ? 4 : 0) | (h.metaKey ? 8 : 0);
- switch (h.keyCode) {
- case 0:
- h.key === "UIKeyInputUpArrow" ? o.key = f ? n.C0.ESC + "OA" : n.C0.ESC + "[A" : h.key === "UIKeyInputLeftArrow" ? o.key = f ? n.C0.ESC + "OD" : n.C0.ESC + "[D" : h.key === "UIKeyInputRightArrow" ? o.key = f ? n.C0.ESC + "OC" : n.C0.ESC + "[C" : h.key === "UIKeyInputDownArrow" && (o.key = f ? n.C0.ESC + "OB" : n.C0.ESC + "[B");
- break;
- case 8:
- if (h.altKey) {
- o.key = n.C0.ESC + n.C0.DEL;
- break
- }
- o.key = n.C0.DEL;
- break;
- case 9:
- if (h.shiftKey) {
- o.key = n.C0.ESC + "[Z";
- break
- }
- o.key = n.C0.HT,
- o.cancel = !0;
- break;
- case 13:
- o.key = h.altKey ? n.C0.ESC + n.C0.CR : n.C0.CR,
- o.cancel = !0;
- break;
- case 27:
- o.key = n.C0.ESC,
- h.altKey && (o.key = n.C0.ESC + n.C0.ESC),
- o.cancel = !0;
- break;
- case 37:
- if (h.metaKey)
- break;
- t ? (o.key = n.C0.ESC + "[1;" + (t + 1) + "D",
- o.key === n.C0.ESC + "[1;3D" && (o.key = n.C0.ESC + (d ? "b" : "[1;5D"))) : o.key = f ? n.C0.ESC + "OD" : n.C0.ESC + "[D";
- break;
- case 39:
- if (h.metaKey)
- break;
- t ? (o.key = n.C0.ESC + "[1;" + (t + 1) + "C",
- o.key === n.C0.ESC + "[1;3C" && (o.key = n.C0.ESC + (d ? "f" : "[1;5C"))) : o.key = f ? n.C0.ESC + "OC" : n.C0.ESC + "[C";
- break;
- case 38:
- if (h.metaKey)
- break;
- t ? (o.key = n.C0.ESC + "[1;" + (t + 1) + "A",
- d || o.key !== n.C0.ESC + "[1;3A" || (o.key = n.C0.ESC + "[1;5A")) : o.key = f ? n.C0.ESC + "OA" : n.C0.ESC + "[A";
- break;
- case 40:
- if (h.metaKey)
- break;
- t ? (o.key = n.C0.ESC + "[1;" + (t + 1) + "B",
- d || o.key !== n.C0.ESC + "[1;3B" || (o.key = n.C0.ESC + "[1;5B")) : o.key = f ? n.C0.ESC + "OB" : n.C0.ESC + "[B";
- break;
- case 45:
- h.shiftKey || h.ctrlKey || (o.key = n.C0.ESC + "[2~");
- break;
- case 46:
- o.key = t ? n.C0.ESC + "[3;" + (t + 1) + "~" : n.C0.ESC + "[3~";
- break;
- case 36:
- o.key = t ? n.C0.ESC + "[1;" + (t + 1) + "H" : f ? n.C0.ESC + "OH" : n.C0.ESC + "[H";
- break;
- case 35:
- o.key = t ? n.C0.ESC + "[1;" + (t + 1) + "F" : f ? n.C0.ESC + "OF" : n.C0.ESC + "[F";
- break;
- case 33:
- h.shiftKey ? o.type = 2 : h.ctrlKey ? o.key = n.C0.ESC + "[5;" + (t + 1) + "~" : o.key = n.C0.ESC + "[5~";
- break;
- case 34:
- h.shiftKey ? o.type = 3 : h.ctrlKey ? o.key = n.C0.ESC + "[6;" + (t + 1) + "~" : o.key = n.C0.ESC + "[6~";
- break;
- case 112:
- o.key = t ? n.C0.ESC + "[1;" + (t + 1) + "P" : n.C0.ESC + "OP";
- break;
- case 113:
- o.key = t ? n.C0.ESC + "[1;" + (t + 1) + "Q" : n.C0.ESC + "OQ";
- break;
- case 114:
- o.key = t ? n.C0.ESC + "[1;" + (t + 1) + "R" : n.C0.ESC + "OR";
- break;
- case 115:
- o.key = t ? n.C0.ESC + "[1;" + (t + 1) + "S" : n.C0.ESC + "OS";
- break;
- case 116:
- o.key = t ? n.C0.ESC + "[15;" + (t + 1) + "~" : n.C0.ESC + "[15~";
- break;
- case 117:
- o.key = t ? n.C0.ESC + "[17;" + (t + 1) + "~" : n.C0.ESC + "[17~";
- break;
- case 118:
- o.key = t ? n.C0.ESC + "[18;" + (t + 1) + "~" : n.C0.ESC + "[18~";
- break;
- case 119:
- o.key = t ? n.C0.ESC + "[19;" + (t + 1) + "~" : n.C0.ESC + "[19~";
- break;
- case 120:
- o.key = t ? n.C0.ESC + "[20;" + (t + 1) + "~" : n.C0.ESC + "[20~";
- break;
- case 121:
- o.key = t ? n.C0.ESC + "[21;" + (t + 1) + "~" : n.C0.ESC + "[21~";
- break;
- case 122:
- o.key = t ? n.C0.ESC + "[23;" + (t + 1) + "~" : n.C0.ESC + "[23~";
- break;
- case 123:
- o.key = t ? n.C0.ESC + "[24;" + (t + 1) + "~" : n.C0.ESC + "[24~";
- break;
- default:
- if (!h.ctrlKey || h.shiftKey || h.altKey || h.metaKey)
- if (d && !l || !h.altKey || h.metaKey)
- !d || h.altKey || h.ctrlKey || h.shiftKey || !h.metaKey ? h.key && !h.ctrlKey && !h.altKey && !h.metaKey && h.keyCode >= 48 && h.key.length === 1 ? o.key = h.key : h.key && h.ctrlKey && (h.key === "_" && (o.key = n.C0.US),
- h.key === "@" && (o.key = n.C0.NUL)) : h.keyCode === 65 && (o.type = 1);
- else {
- const s = _[h.keyCode]
- , e = s == null ? void 0 : s[h.shiftKey ? 1 : 0];
- if (e)
- o.key = n.C0.ESC + e;
- else if (h.keyCode >= 65 && h.keyCode <= 90) {
- const i = h.ctrlKey ? h.keyCode - 64 : h.keyCode + 32;
- let c = String.fromCharCode(i);
- h.shiftKey && (c = c.toUpperCase()),
- o.key = n.C0.ESC + c
- } else if (h.key === "Dead" && h.code.startsWith("Key")) {
- let i = h.code.slice(3, 4);
- h.shiftKey || (i = i.toLowerCase()),
- o.key = n.C0.ESC + i,
- o.cancel = !0
- }
- }
- else
- h.keyCode >= 65 && h.keyCode <= 90 ? o.key = String.fromCharCode(h.keyCode - 64) : h.keyCode === 32 ? o.key = n.C0.NUL : h.keyCode >= 51 && h.keyCode <= 55 ? o.key = String.fromCharCode(h.keyCode - 51 + 27) : h.keyCode === 56 ? o.key = n.C0.DEL : h.keyCode === 219 ? o.key = n.C0.ESC : h.keyCode === 220 ? o.key = n.C0.FS : h.keyCode === 221 && (o.key = n.C0.GS)
- }
- return o
- }
- }
- ,
- 482: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.Utf8ToUtf32 = r.StringToUtf32 = r.utf32ToString = r.stringFromCodePoint = void 0,
- r.stringFromCodePoint = function (a) {
- return a > 65535 ? (a -= 65536,
- String.fromCharCode(55296 + (a >> 10)) + String.fromCharCode(a % 1024 + 56320)) : String.fromCharCode(a)
- }
- ,
- r.utf32ToString = function (a, n = 0, _ = a.length) {
- let h = "";
- for (let f = n; f < _; ++f) {
- let d = a[f];
- d > 65535 ? (d -= 65536,
- h += String.fromCharCode(55296 + (d >> 10)) + String.fromCharCode(d % 1024 + 56320)) : h += String.fromCharCode(d)
- }
- return h
- }
- ,
- r.StringToUtf32 = class {
- constructor() {
- this._interim = 0
- }
- clear() {
- this._interim = 0
- }
- decode(a, n) {
- const _ = a.length;
- if (!_)
- return 0;
- let h = 0
- , f = 0;
- if (this._interim) {
- const d = a.charCodeAt(f++);
- 56320 <= d && d <= 57343 ? n[h++] = 1024 * (this._interim - 55296) + d - 56320 + 65536 : (n[h++] = this._interim,
- n[h++] = d),
- this._interim = 0
- }
- for (let d = f; d < _; ++d) {
- const l = a.charCodeAt(d);
- if (55296 <= l && l <= 56319) {
- if (++d >= _)
- return this._interim = l,
- h;
- const o = a.charCodeAt(d);
- 56320 <= o && o <= 57343 ? n[h++] = 1024 * (l - 55296) + o - 56320 + 65536 : (n[h++] = l,
- n[h++] = o)
- } else
- l !== 65279 && (n[h++] = l)
- }
- return h
- }
- }
- ,
- r.Utf8ToUtf32 = class {
- constructor() {
- this.interim = new Uint8Array(3)
- }
- clear() {
- this.interim.fill(0)
- }
- decode(a, n) {
- const _ = a.length;
- if (!_)
- return 0;
- let h, f, d, l, o = 0, t = 0, s = 0;
- if (this.interim[0]) {
- let c = !1
- , g = this.interim[0];
- g &= (224 & g) == 192 ? 31 : (240 & g) == 224 ? 15 : 7;
- let v, S = 0;
- for (; (v = 63 & this.interim[++S]) && S < 4;)
- g <<= 6,
- g |= v;
- const u = (224 & this.interim[0]) == 192 ? 2 : (240 & this.interim[0]) == 224 ? 3 : 4
- , m = u - S;
- for (; s < m;) {
- if (s >= _)
- return 0;
- if (v = a[s++],
- (192 & v) != 128) {
- s--,
- c = !0;
- break
- }
- this.interim[S++] = v,
- g <<= 6,
- g |= 63 & v
- }
- c || (u === 2 ? g < 128 ? s-- : n[o++] = g : u === 3 ? g < 2048 || g >= 55296 && g <= 57343 || g === 65279 || (n[o++] = g) : g < 65536 || g > 1114111 || (n[o++] = g)),
- this.interim.fill(0)
- }
- const e = _ - 4;
- let i = s;
- for (; i < _;) {
- for (; !(!(i < e) || 128 & (h = a[i]) || 128 & (f = a[i + 1]) || 128 & (d = a[i + 2]) || 128 & (l = a[i + 3]));)
- n[o++] = h,
- n[o++] = f,
- n[o++] = d,
- n[o++] = l,
- i += 4;
- if (h = a[i++],
- h < 128)
- n[o++] = h;
- else if ((224 & h) == 192) {
- if (i >= _)
- return this.interim[0] = h,
- o;
- if (f = a[i++],
- (192 & f) != 128) {
- i--;
- continue
- }
- if (t = (31 & h) << 6 | 63 & f,
- t < 128) {
- i--;
- continue
- }
- n[o++] = t
- } else if ((240 & h) == 224) {
- if (i >= _)
- return this.interim[0] = h,
- o;
- if (f = a[i++],
- (192 & f) != 128) {
- i--;
- continue
- }
- if (i >= _)
- return this.interim[0] = h,
- this.interim[1] = f,
- o;
- if (d = a[i++],
- (192 & d) != 128) {
- i--;
- continue
- }
- if (t = (15 & h) << 12 | (63 & f) << 6 | 63 & d,
- t < 2048 || t >= 55296 && t <= 57343 || t === 65279)
- continue;
- n[o++] = t
- } else if ((248 & h) == 240) {
- if (i >= _)
- return this.interim[0] = h,
- o;
- if (f = a[i++],
- (192 & f) != 128) {
- i--;
- continue
- }
- if (i >= _)
- return this.interim[0] = h,
- this.interim[1] = f,
- o;
- if (d = a[i++],
- (192 & d) != 128) {
- i--;
- continue
- }
- if (i >= _)
- return this.interim[0] = h,
- this.interim[1] = f,
- this.interim[2] = d,
- o;
- if (l = a[i++],
- (192 & l) != 128) {
- i--;
- continue
- }
- if (t = (7 & h) << 18 | (63 & f) << 12 | (63 & d) << 6 | 63 & l,
- t < 65536 || t > 1114111)
- continue;
- n[o++] = t
- }
- }
- return o
- }
- }
- }
- ,
- 225: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.UnicodeV6 = void 0;
- const n = a(8273)
- , _ = [[768, 879], [1155, 1158], [1160, 1161], [1425, 1469], [1471, 1471], [1473, 1474], [1476, 1477], [1479, 1479], [1536, 1539], [1552, 1557], [1611, 1630], [1648, 1648], [1750, 1764], [1767, 1768], [1770, 1773], [1807, 1807], [1809, 1809], [1840, 1866], [1958, 1968], [2027, 2035], [2305, 2306], [2364, 2364], [2369, 2376], [2381, 2381], [2385, 2388], [2402, 2403], [2433, 2433], [2492, 2492], [2497, 2500], [2509, 2509], [2530, 2531], [2561, 2562], [2620, 2620], [2625, 2626], [2631, 2632], [2635, 2637], [2672, 2673], [2689, 2690], [2748, 2748], [2753, 2757], [2759, 2760], [2765, 2765], [2786, 2787], [2817, 2817], [2876, 2876], [2879, 2879], [2881, 2883], [2893, 2893], [2902, 2902], [2946, 2946], [3008, 3008], [3021, 3021], [3134, 3136], [3142, 3144], [3146, 3149], [3157, 3158], [3260, 3260], [3263, 3263], [3270, 3270], [3276, 3277], [3298, 3299], [3393, 3395], [3405, 3405], [3530, 3530], [3538, 3540], [3542, 3542], [3633, 3633], [3636, 3642], [3655, 3662], [3761, 3761], [3764, 3769], [3771, 3772], [3784, 3789], [3864, 3865], [3893, 3893], [3895, 3895], [3897, 3897], [3953, 3966], [3968, 3972], [3974, 3975], [3984, 3991], [3993, 4028], [4038, 4038], [4141, 4144], [4146, 4146], [4150, 4151], [4153, 4153], [4184, 4185], [4448, 4607], [4959, 4959], [5906, 5908], [5938, 5940], [5970, 5971], [6002, 6003], [6068, 6069], [6071, 6077], [6086, 6086], [6089, 6099], [6109, 6109], [6155, 6157], [6313, 6313], [6432, 6434], [6439, 6440], [6450, 6450], [6457, 6459], [6679, 6680], [6912, 6915], [6964, 6964], [6966, 6970], [6972, 6972], [6978, 6978], [7019, 7027], [7616, 7626], [7678, 7679], [8203, 8207], [8234, 8238], [8288, 8291], [8298, 8303], [8400, 8431], [12330, 12335], [12441, 12442], [43014, 43014], [43019, 43019], [43045, 43046], [64286, 64286], [65024, 65039], [65056, 65059], [65279, 65279], [65529, 65531]]
- , h = [[68097, 68099], [68101, 68102], [68108, 68111], [68152, 68154], [68159, 68159], [119143, 119145], [119155, 119170], [119173, 119179], [119210, 119213], [119362, 119364], [917505, 917505], [917536, 917631], [917760, 917999]];
- let f;
- r.UnicodeV6 = class {
- constructor() {
- if (this.version = "6",
- !f) {
- f = new Uint8Array(65536),
- (0,
- n.fill)(f, 1),
- f[0] = 0,
- (0,
- n.fill)(f, 0, 1, 32),
- (0,
- n.fill)(f, 0, 127, 160),
- (0,
- n.fill)(f, 2, 4352, 4448),
- f[9001] = 2,
- f[9002] = 2,
- (0,
- n.fill)(f, 2, 11904, 42192),
- f[12351] = 1,
- (0,
- n.fill)(f, 2, 44032, 55204),
- (0,
- n.fill)(f, 2, 63744, 64256),
- (0,
- n.fill)(f, 2, 65040, 65050),
- (0,
- n.fill)(f, 2, 65072, 65136),
- (0,
- n.fill)(f, 2, 65280, 65377),
- (0,
- n.fill)(f, 2, 65504, 65511);
- for (let d = 0; d < _.length; ++d)
- (0,
- n.fill)(f, 0, _[d][0], _[d][1] + 1)
- }
- }
- wcwidth(d) {
- return d < 32 ? 0 : d < 127 ? 1 : d < 65536 ? f[d] : function (l, o) {
- let t, s = 0, e = o.length - 1;
- if (l < o[0][0] || l > o[e][1])
- return !1;
- for (; e >= s;)
- if (t = s + e >> 1,
- l > o[t][1])
- s = t + 1;
- else {
- if (!(l < o[t][0]))
- return !0;
- e = t - 1
- }
- return !1
- }(d, h) ? 0 : d >= 131072 && d <= 196605 || d >= 196608 && d <= 262141 ? 2 : 1
- }
- }
- }
- ,
- 5981: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.WriteBuffer = void 0;
- const n = a(8460)
- , _ = typeof queueMicrotask > "u" ? h => {
- Promise.resolve().then(h)
- }
- : queueMicrotask;
- r.WriteBuffer = class {
- constructor(h) {
- this._action = h,
- this._writeBuffer = [],
- this._callbacks = [],
- this._pendingData = 0,
- this._bufferOffset = 0,
- this._isSyncWriting = !1,
- this._syncCalls = 0,
- this._onWriteParsed = new n.EventEmitter
- }
- get onWriteParsed() {
- return this._onWriteParsed.event
- }
- writeSync(h, f) {
- if (f !== void 0 && this._syncCalls > f)
- return void (this._syncCalls = 0);
- if (this._pendingData += h.length,
- this._writeBuffer.push(h),
- this._callbacks.push(void 0),
- this._syncCalls++,
- this._isSyncWriting)
- return;
- let d;
- for (this._isSyncWriting = !0; d = this._writeBuffer.shift();) {
- this._action(d);
- const l = this._callbacks.shift();
- l && l()
- }
- this._pendingData = 0,
- this._bufferOffset = 2147483647,
- this._isSyncWriting = !1,
- this._syncCalls = 0
- }
- write(h, f) {
- if (this._pendingData > 5e7)
- throw new Error("write data discarded, use flow control to avoid losing data");
- this._writeBuffer.length || (this._bufferOffset = 0,
- setTimeout(() => this._innerWrite())),
- this._pendingData += h.length,
- this._writeBuffer.push(h),
- this._callbacks.push(f)
- }
- _innerWrite(h = 0, f = !0) {
- const d = h || Date.now();
- for (; this._writeBuffer.length > this._bufferOffset;) {
- const l = this._writeBuffer[this._bufferOffset]
- , o = this._action(l, f);
- if (o) {
- const s = e => Date.now() - d >= 12 ? setTimeout(() => this._innerWrite(0, e)) : this._innerWrite(d, e);
- return void o.catch(e => (_(() => {
- throw e
- }
- ),
- Promise.resolve(!1))).then(s)
- }
- const t = this._callbacks[this._bufferOffset];
- if (t && t(),
- this._bufferOffset++,
- this._pendingData -= l.length,
- Date.now() - d >= 12)
- break
- }
- this._writeBuffer.length > this._bufferOffset ? (this._bufferOffset > 50 && (this._writeBuffer = this._writeBuffer.slice(this._bufferOffset),
- this._callbacks = this._callbacks.slice(this._bufferOffset),
- this._bufferOffset = 0),
- setTimeout(() => this._innerWrite())) : (this._writeBuffer.length = 0,
- this._callbacks.length = 0,
- this._pendingData = 0,
- this._bufferOffset = 0),
- this._onWriteParsed.fire()
- }
- }
- }
- ,
- 5941: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.toRgbString = r.parseColor = void 0;
- const a = /^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/
- , n = /^[\da-f]+$/;
- function _(h, f) {
- const d = h.toString(16)
- , l = d.length < 2 ? "0" + d : d;
- switch (f) {
- case 4:
- return d[0];
- case 8:
- return l;
- case 12:
- return (l + l).slice(0, 3);
- default:
- return l + l
- }
- }
- r.parseColor = function (h) {
- if (!h)
- return;
- let f = h.toLowerCase();
- if (f.indexOf("rgb:") === 0) {
- f = f.slice(4);
- const d = a.exec(f);
- if (d) {
- const l = d[1] ? 15 : d[4] ? 255 : d[7] ? 4095 : 65535;
- return [Math.round(parseInt(d[1] || d[4] || d[7] || d[10], 16) / l * 255), Math.round(parseInt(d[2] || d[5] || d[8] || d[11], 16) / l * 255), Math.round(parseInt(d[3] || d[6] || d[9] || d[12], 16) / l * 255)]
- }
- } else if (f.indexOf("#") === 0 && (f = f.slice(1),
- n.exec(f) && [3, 6, 9, 12].includes(f.length))) {
- const d = f.length / 3
- , l = [0, 0, 0];
- for (let o = 0; o < 3; ++o) {
- const t = parseInt(f.slice(d * o, d * o + d), 16);
- l[o] = d === 1 ? t << 4 : d === 2 ? t : d === 3 ? t >> 4 : t >> 8
- }
- return l
- }
- }
- ,
- r.toRgbString = function (h, f = 16) {
- const [d, l, o] = h;
- return `rgb:${_(d, f)}/${_(l, f)}/${_(o, f)}`
- }
- }
- ,
- 5770: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.PAYLOAD_LIMIT = void 0,
- r.PAYLOAD_LIMIT = 1e7
- }
- ,
- 6351: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.DcsHandler = r.DcsParser = void 0;
- const n = a(482)
- , _ = a(8742)
- , h = a(5770)
- , f = [];
- r.DcsParser = class {
- constructor() {
- this._handlers = Object.create(null),
- this._active = f,
- this._ident = 0,
- this._handlerFb = () => { }
- ,
- this._stack = {
- paused: !1,
- loopPosition: 0,
- fallThrough: !1
- }
- }
- dispose() {
- this._handlers = Object.create(null),
- this._handlerFb = () => { }
- ,
- this._active = f
- }
- registerHandler(l, o) {
- this._handlers[l] === void 0 && (this._handlers[l] = []);
- const t = this._handlers[l];
- return t.push(o),
- {
- dispose: () => {
- const s = t.indexOf(o);
- s !== -1 && t.splice(s, 1)
- }
- }
- }
- clearHandler(l) {
- this._handlers[l] && delete this._handlers[l]
- }
- setHandlerFallback(l) {
- this._handlerFb = l
- }
- reset() {
- if (this._active.length)
- for (let l = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; l >= 0; --l)
- this._active[l].unhook(!1);
- this._stack.paused = !1,
- this._active = f,
- this._ident = 0
- }
- hook(l, o) {
- if (this.reset(),
- this._ident = l,
- this._active = this._handlers[l] || f,
- this._active.length)
- for (let t = this._active.length - 1; t >= 0; t--)
- this._active[t].hook(o);
- else
- this._handlerFb(this._ident, "HOOK", o)
- }
- put(l, o, t) {
- if (this._active.length)
- for (let s = this._active.length - 1; s >= 0; s--)
- this._active[s].put(l, o, t);
- else
- this._handlerFb(this._ident, "PUT", (0,
- n.utf32ToString)(l, o, t))
- }
- unhook(l, o = !0) {
- if (this._active.length) {
- let t = !1
- , s = this._active.length - 1
- , e = !1;
- if (this._stack.paused && (s = this._stack.loopPosition - 1,
- t = o,
- e = this._stack.fallThrough,
- this._stack.paused = !1),
- !e && t === !1) {
- for (; s >= 0 && (t = this._active[s].unhook(l),
- t !== !0); s--)
- if (t instanceof Promise)
- return this._stack.paused = !0,
- this._stack.loopPosition = s,
- this._stack.fallThrough = !1,
- t;
- s--
- }
- for (; s >= 0; s--)
- if (t = this._active[s].unhook(!1),
- t instanceof Promise)
- return this._stack.paused = !0,
- this._stack.loopPosition = s,
- this._stack.fallThrough = !0,
- t
- } else
- this._handlerFb(this._ident, "UNHOOK", l);
- this._active = f,
- this._ident = 0
- }
- }
- ;
- const d = new _.Params;
- d.addParam(0),
- r.DcsHandler = class {
- constructor(l) {
- this._handler = l,
- this._data = "",
- this._params = d,
- this._hitLimit = !1
- }
- hook(l) {
- this._params = l.length > 1 || l.params[0] ? l.clone() : d,
- this._data = "",
- this._hitLimit = !1
- }
- put(l, o, t) {
- this._hitLimit || (this._data += (0,
- n.utf32ToString)(l, o, t),
- this._data.length > h.PAYLOAD_LIMIT && (this._data = "",
- this._hitLimit = !0))
- }
- unhook(l) {
- let o = !1;
- if (this._hitLimit)
- o = !1;
- else if (l && (o = this._handler(this._data, this._params),
- o instanceof Promise))
- return o.then(t => (this._params = d,
- this._data = "",
- this._hitLimit = !1,
- t));
- return this._params = d,
- this._data = "",
- this._hitLimit = !1,
- o
- }
- }
- }
- ,
- 2015: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.EscapeSequenceParser = r.VT500_TRANSITION_TABLE = r.TransitionTable = void 0;
- const n = a(844)
- , _ = a(8273)
- , h = a(8742)
- , f = a(6242)
- , d = a(6351);
- class l {
- constructor(e) {
- this.table = new Uint8Array(e)
- }
- setDefault(e, i) {
- (0,
- _.fill)(this.table, e << 4 | i)
- }
- add(e, i, c, g) {
- this.table[i << 8 | e] = c << 4 | g
- }
- addMany(e, i, c, g) {
- for (let v = 0; v < e.length; v++)
- this.table[i << 8 | e[v]] = c << 4 | g
- }
- }
- r.TransitionTable = l;
- const o = 160;
- r.VT500_TRANSITION_TABLE = function () {
- const s = new l(4095)
- , e = Array.apply(null, Array(256)).map((u, m) => m)
- , i = (u, m) => e.slice(u, m)
- , c = i(32, 127)
- , g = i(0, 24);
- g.push(25),
- g.push.apply(g, i(28, 32));
- const v = i(0, 14);
- let S;
- for (S in s.setDefault(1, 0),
- s.addMany(c, 0, 2, 0),
- v)
- s.addMany([24, 26, 153, 154], S, 3, 0),
- s.addMany(i(128, 144), S, 3, 0),
- s.addMany(i(144, 152), S, 3, 0),
- s.add(156, S, 0, 0),
- s.add(27, S, 11, 1),
- s.add(157, S, 4, 8),
- s.addMany([152, 158, 159], S, 0, 7),
- s.add(155, S, 11, 3),
- s.add(144, S, 11, 9);
- return s.addMany(g, 0, 3, 0),
- s.addMany(g, 1, 3, 1),
- s.add(127, 1, 0, 1),
- s.addMany(g, 8, 0, 8),
- s.addMany(g, 3, 3, 3),
- s.add(127, 3, 0, 3),
- s.addMany(g, 4, 3, 4),
- s.add(127, 4, 0, 4),
- s.addMany(g, 6, 3, 6),
- s.addMany(g, 5, 3, 5),
- s.add(127, 5, 0, 5),
- s.addMany(g, 2, 3, 2),
- s.add(127, 2, 0, 2),
- s.add(93, 1, 4, 8),
- s.addMany(c, 8, 5, 8),
- s.add(127, 8, 5, 8),
- s.addMany([156, 27, 24, 26, 7], 8, 6, 0),
- s.addMany(i(28, 32), 8, 0, 8),
- s.addMany([88, 94, 95], 1, 0, 7),
- s.addMany(c, 7, 0, 7),
- s.addMany(g, 7, 0, 7),
- s.add(156, 7, 0, 0),
- s.add(127, 7, 0, 7),
- s.add(91, 1, 11, 3),
- s.addMany(i(64, 127), 3, 7, 0),
- s.addMany(i(48, 60), 3, 8, 4),
- s.addMany([60, 61, 62, 63], 3, 9, 4),
- s.addMany(i(48, 60), 4, 8, 4),
- s.addMany(i(64, 127), 4, 7, 0),
- s.addMany([60, 61, 62, 63], 4, 0, 6),
- s.addMany(i(32, 64), 6, 0, 6),
- s.add(127, 6, 0, 6),
- s.addMany(i(64, 127), 6, 0, 0),
- s.addMany(i(32, 48), 3, 9, 5),
- s.addMany(i(32, 48), 5, 9, 5),
- s.addMany(i(48, 64), 5, 0, 6),
- s.addMany(i(64, 127), 5, 7, 0),
- s.addMany(i(32, 48), 4, 9, 5),
- s.addMany(i(32, 48), 1, 9, 2),
- s.addMany(i(32, 48), 2, 9, 2),
- s.addMany(i(48, 127), 2, 10, 0),
- s.addMany(i(48, 80), 1, 10, 0),
- s.addMany(i(81, 88), 1, 10, 0),
- s.addMany([89, 90, 92], 1, 10, 0),
- s.addMany(i(96, 127), 1, 10, 0),
- s.add(80, 1, 11, 9),
- s.addMany(g, 9, 0, 9),
- s.add(127, 9, 0, 9),
- s.addMany(i(28, 32), 9, 0, 9),
- s.addMany(i(32, 48), 9, 9, 12),
- s.addMany(i(48, 60), 9, 8, 10),
- s.addMany([60, 61, 62, 63], 9, 9, 10),
- s.addMany(g, 11, 0, 11),
- s.addMany(i(32, 128), 11, 0, 11),
- s.addMany(i(28, 32), 11, 0, 11),
- s.addMany(g, 10, 0, 10),
- s.add(127, 10, 0, 10),
- s.addMany(i(28, 32), 10, 0, 10),
- s.addMany(i(48, 60), 10, 8, 10),
- s.addMany([60, 61, 62, 63], 10, 0, 11),
- s.addMany(i(32, 48), 10, 9, 12),
- s.addMany(g, 12, 0, 12),
- s.add(127, 12, 0, 12),
- s.addMany(i(28, 32), 12, 0, 12),
- s.addMany(i(32, 48), 12, 9, 12),
- s.addMany(i(48, 64), 12, 0, 11),
- s.addMany(i(64, 127), 12, 12, 13),
- s.addMany(i(64, 127), 10, 12, 13),
- s.addMany(i(64, 127), 9, 12, 13),
- s.addMany(g, 13, 13, 13),
- s.addMany(c, 13, 13, 13),
- s.add(127, 13, 0, 13),
- s.addMany([27, 156, 24, 26], 13, 14, 0),
- s.add(o, 0, 2, 0),
- s.add(o, 8, 5, 8),
- s.add(o, 6, 0, 6),
- s.add(o, 11, 0, 11),
- s.add(o, 13, 13, 13),
- s
- }();
- class t extends n.Disposable {
- constructor(e = r.VT500_TRANSITION_TABLE) {
- super(),
- this._transitions = e,
- this._parseStack = {
- state: 0,
- handlers: [],
- handlerPos: 0,
- transition: 0,
- chunkPos: 0
- },
- this.initialState = 0,
- this.currentState = this.initialState,
- this._params = new h.Params,
- this._params.addParam(0),
- this._collect = 0,
- this.precedingCodepoint = 0,
- this._printHandlerFb = (i, c, g) => { }
- ,
- this._executeHandlerFb = i => { }
- ,
- this._csiHandlerFb = (i, c) => { }
- ,
- this._escHandlerFb = i => { }
- ,
- this._errorHandlerFb = i => i,
- this._printHandler = this._printHandlerFb,
- this._executeHandlers = Object.create(null),
- this._csiHandlers = Object.create(null),
- this._escHandlers = Object.create(null),
- this._oscParser = new f.OscParser,
- this._dcsParser = new d.DcsParser,
- this._errorHandler = this._errorHandlerFb,
- this.registerEscHandler({
- final: "\\"
- }, () => !0)
- }
- _identifier(e, i = [64, 126]) {
- let c = 0;
- if (e.prefix) {
- if (e.prefix.length > 1)
- throw new Error("only one byte as prefix supported");
- if (c = e.prefix.charCodeAt(0),
- c && 60 > c || c > 63)
- throw new Error("prefix must be in range 0x3c .. 0x3f")
- }
- if (e.intermediates) {
- if (e.intermediates.length > 2)
- throw new Error("only two bytes as intermediates are supported");
- for (let v = 0; v < e.intermediates.length; ++v) {
- const S = e.intermediates.charCodeAt(v);
- if (32 > S || S > 47)
- throw new Error("intermediate must be in range 0x20 .. 0x2f");
- c <<= 8,
- c |= S
- }
- }
- if (e.final.length !== 1)
- throw new Error("final must be a single byte");
- const g = e.final.charCodeAt(0);
- if (i[0] > g || g > i[1])
- throw new Error(`final must be in range ${i[0]} .. ${i[1]}`);
- return c <<= 8,
- c |= g,
- c
- }
- identToString(e) {
- const i = [];
- for (; e;)
- i.push(String.fromCharCode(255 & e)),
- e >>= 8;
- return i.reverse().join("")
- }
- dispose() {
- this._csiHandlers = Object.create(null),
- this._executeHandlers = Object.create(null),
- this._escHandlers = Object.create(null),
- this._oscParser.dispose(),
- this._dcsParser.dispose()
- }
- setPrintHandler(e) {
- this._printHandler = e
- }
- clearPrintHandler() {
- this._printHandler = this._printHandlerFb
- }
- registerEscHandler(e, i) {
- const c = this._identifier(e, [48, 126]);
- this._escHandlers[c] === void 0 && (this._escHandlers[c] = []);
- const g = this._escHandlers[c];
- return g.push(i),
- {
- dispose: () => {
- const v = g.indexOf(i);
- v !== -1 && g.splice(v, 1)
- }
- }
- }
- clearEscHandler(e) {
- this._escHandlers[this._identifier(e, [48, 126])] && delete this._escHandlers[this._identifier(e, [48, 126])]
- }
- setEscHandlerFallback(e) {
- this._escHandlerFb = e
- }
- setExecuteHandler(e, i) {
- this._executeHandlers[e.charCodeAt(0)] = i
- }
- clearExecuteHandler(e) {
- this._executeHandlers[e.charCodeAt(0)] && delete this._executeHandlers[e.charCodeAt(0)]
- }
- setExecuteHandlerFallback(e) {
- this._executeHandlerFb = e
- }
- registerCsiHandler(e, i) {
- const c = this._identifier(e);
- this._csiHandlers[c] === void 0 && (this._csiHandlers[c] = []);
- const g = this._csiHandlers[c];
- return g.push(i),
- {
- dispose: () => {
- const v = g.indexOf(i);
- v !== -1 && g.splice(v, 1)
- }
- }
- }
- clearCsiHandler(e) {
- this._csiHandlers[this._identifier(e)] && delete this._csiHandlers[this._identifier(e)]
- }
- setCsiHandlerFallback(e) {
- this._csiHandlerFb = e
- }
- registerDcsHandler(e, i) {
- return this._dcsParser.registerHandler(this._identifier(e), i)
- }
- clearDcsHandler(e) {
- this._dcsParser.clearHandler(this._identifier(e))
- }
- setDcsHandlerFallback(e) {
- this._dcsParser.setHandlerFallback(e)
- }
- registerOscHandler(e, i) {
- return this._oscParser.registerHandler(e, i)
- }
- clearOscHandler(e) {
- this._oscParser.clearHandler(e)
- }
- setOscHandlerFallback(e) {
- this._oscParser.setHandlerFallback(e)
- }
- setErrorHandler(e) {
- this._errorHandler = e
- }
- clearErrorHandler() {
- this._errorHandler = this._errorHandlerFb
- }
- reset() {
- this.currentState = this.initialState,
- this._oscParser.reset(),
- this._dcsParser.reset(),
- this._params.reset(),
- this._params.addParam(0),
- this._collect = 0,
- this.precedingCodepoint = 0,
- this._parseStack.state !== 0 && (this._parseStack.state = 2,
- this._parseStack.handlers = [])
- }
- _preserveStack(e, i, c, g, v) {
- this._parseStack.state = e,
- this._parseStack.handlers = i,
- this._parseStack.handlerPos = c,
- this._parseStack.transition = g,
- this._parseStack.chunkPos = v
- }
- parse(e, i, c) {
- let g, v = 0, S = 0, u = 0;
- if (this._parseStack.state)
- if (this._parseStack.state === 2)
- this._parseStack.state = 0,
- u = this._parseStack.chunkPos + 1;
- else {
- if (c === void 0 || this._parseStack.state === 1)
- throw this._parseStack.state = 1,
- new Error("improper continuation due to previous async handler, giving up parsing");
- const m = this._parseStack.handlers;
- let w = this._parseStack.handlerPos - 1;
- switch (this._parseStack.state) {
- case 3:
- if (c === !1 && w > -1) {
- for (; w >= 0 && (g = m[w](this._params),
- g !== !0); w--)
- if (g instanceof Promise)
- return this._parseStack.handlerPos = w,
- g
- }
- this._parseStack.handlers = [];
- break;
- case 4:
- if (c === !1 && w > -1) {
- for (; w >= 0 && (g = m[w](),
- g !== !0); w--)
- if (g instanceof Promise)
- return this._parseStack.handlerPos = w,
- g
- }
- this._parseStack.handlers = [];
- break;
- case 6:
- if (v = e[this._parseStack.chunkPos],
- g = this._dcsParser.unhook(v !== 24 && v !== 26, c),
- g)
- return g;
- v === 27 && (this._parseStack.transition |= 1),
- this._params.reset(),
- this._params.addParam(0),
- this._collect = 0;
- break;
- case 5:
- if (v = e[this._parseStack.chunkPos],
- g = this._oscParser.end(v !== 24 && v !== 26, c),
- g)
- return g;
- v === 27 && (this._parseStack.transition |= 1),
- this._params.reset(),
- this._params.addParam(0),
- this._collect = 0
- }
- this._parseStack.state = 0,
- u = this._parseStack.chunkPos + 1,
- this.precedingCodepoint = 0,
- this.currentState = 15 & this._parseStack.transition
- }
- for (let m = u; m < i; ++m) {
- switch (v = e[m],
- S = this._transitions.table[this.currentState << 8 | (v < 160 ? v : o)],
- S >> 4) {
- case 2:
- for (let C = m + 1; ; ++C) {
- if (C >= i || (v = e[C]) < 32 || v > 126 && v < o) {
- this._printHandler(e, m, C),
- m = C - 1;
- break
- }
- if (++C >= i || (v = e[C]) < 32 || v > 126 && v < o) {
- this._printHandler(e, m, C),
- m = C - 1;
- break
- }
- if (++C >= i || (v = e[C]) < 32 || v > 126 && v < o) {
- this._printHandler(e, m, C),
- m = C - 1;
- break
- }
- if (++C >= i || (v = e[C]) < 32 || v > 126 && v < o) {
- this._printHandler(e, m, C),
- m = C - 1;
- break
- }
- }
- break;
- case 3:
- this._executeHandlers[v] ? this._executeHandlers[v]() : this._executeHandlerFb(v),
- this.precedingCodepoint = 0;
- break;
- case 0:
- break;
- case 1:
- if (this._errorHandler({
- position: m,
- code: v,
- currentState: this.currentState,
- collect: this._collect,
- params: this._params,
- abort: !1
- }).abort)
- return;
- break;
- case 7:
- const w = this._csiHandlers[this._collect << 8 | v];
- let R = w ? w.length - 1 : -1;
- for (; R >= 0 && (g = w[R](this._params),
- g !== !0); R--)
- if (g instanceof Promise)
- return this._preserveStack(3, w, R, S, m),
- g;
- R < 0 && this._csiHandlerFb(this._collect << 8 | v, this._params),
- this.precedingCodepoint = 0;
- break;
- case 8:
- do
- switch (v) {
- case 59:
- this._params.addParam(0);
- break;
- case 58:
- this._params.addSubParam(-1);
- break;
- default:
- this._params.addDigit(v - 48)
- }
- while (++m < i && (v = e[m]) > 47 && v < 60);
- m--;
- break;
- case 9:
- this._collect <<= 8,
- this._collect |= v;
- break;
- case 10:
- const L = this._escHandlers[this._collect << 8 | v];
- let p = L ? L.length - 1 : -1;
- for (; p >= 0 && (g = L[p](),
- g !== !0); p--)
- if (g instanceof Promise)
- return this._preserveStack(4, L, p, S, m),
- g;
- p < 0 && this._escHandlerFb(this._collect << 8 | v),
- this.precedingCodepoint = 0;
- break;
- case 11:
- this._params.reset(),
- this._params.addParam(0),
- this._collect = 0;
- break;
- case 12:
- this._dcsParser.hook(this._collect << 8 | v, this._params);
- break;
- case 13:
- for (let C = m + 1; ; ++C)
- if (C >= i || (v = e[C]) === 24 || v === 26 || v === 27 || v > 127 && v < o) {
- this._dcsParser.put(e, m, C),
- m = C - 1;
- break
- }
- break;
- case 14:
- if (g = this._dcsParser.unhook(v !== 24 && v !== 26),
- g)
- return this._preserveStack(6, [], 0, S, m),
- g;
- v === 27 && (S |= 1),
- this._params.reset(),
- this._params.addParam(0),
- this._collect = 0,
- this.precedingCodepoint = 0;
- break;
- case 4:
- this._oscParser.start();
- break;
- case 5:
- for (let C = m + 1; ; C++)
- if (C >= i || (v = e[C]) < 32 || v > 127 && v < o) {
- this._oscParser.put(e, m, C),
- m = C - 1;
- break
- }
- break;
- case 6:
- if (g = this._oscParser.end(v !== 24 && v !== 26),
- g)
- return this._preserveStack(5, [], 0, S, m),
- g;
- v === 27 && (S |= 1),
- this._params.reset(),
- this._params.addParam(0),
- this._collect = 0,
- this.precedingCodepoint = 0
- }
- this.currentState = 15 & S
- }
- }
- }
- r.EscapeSequenceParser = t
- }
- ,
- 6242: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.OscHandler = r.OscParser = void 0;
- const n = a(5770)
- , _ = a(482)
- , h = [];
- r.OscParser = class {
- constructor() {
- this._state = 0,
- this._active = h,
- this._id = -1,
- this._handlers = Object.create(null),
- this._handlerFb = () => { }
- ,
- this._stack = {
- paused: !1,
- loopPosition: 0,
- fallThrough: !1
- }
- }
- registerHandler(f, d) {
- this._handlers[f] === void 0 && (this._handlers[f] = []);
- const l = this._handlers[f];
- return l.push(d),
- {
- dispose: () => {
- const o = l.indexOf(d);
- o !== -1 && l.splice(o, 1)
- }
- }
- }
- clearHandler(f) {
- this._handlers[f] && delete this._handlers[f]
- }
- setHandlerFallback(f) {
- this._handlerFb = f
- }
- dispose() {
- this._handlers = Object.create(null),
- this._handlerFb = () => { }
- ,
- this._active = h
- }
- reset() {
- if (this._state === 2)
- for (let f = this._stack.paused ? this._stack.loopPosition - 1 : this._active.length - 1; f >= 0; --f)
- this._active[f].end(!1);
- this._stack.paused = !1,
- this._active = h,
- this._id = -1,
- this._state = 0
- }
- _start() {
- if (this._active = this._handlers[this._id] || h,
- this._active.length)
- for (let f = this._active.length - 1; f >= 0; f--)
- this._active[f].start();
- else
- this._handlerFb(this._id, "START")
- }
- _put(f, d, l) {
- if (this._active.length)
- for (let o = this._active.length - 1; o >= 0; o--)
- this._active[o].put(f, d, l);
- else
- this._handlerFb(this._id, "PUT", (0,
- _.utf32ToString)(f, d, l))
- }
- start() {
- this.reset(),
- this._state = 1
- }
- put(f, d, l) {
- if (this._state !== 3) {
- if (this._state === 1)
- for (; d < l;) {
- const o = f[d++];
- if (o === 59) {
- this._state = 2,
- this._start();
- break
- }
- if (o < 48 || 57 < o)
- return void (this._state = 3);
- this._id === -1 && (this._id = 0),
- this._id = 10 * this._id + o - 48
- }
- this._state === 2 && l - d > 0 && this._put(f, d, l)
- }
- }
- end(f, d = !0) {
- if (this._state !== 0) {
- if (this._state !== 3)
- if (this._state === 1 && this._start(),
- this._active.length) {
- let l = !1
- , o = this._active.length - 1
- , t = !1;
- if (this._stack.paused && (o = this._stack.loopPosition - 1,
- l = d,
- t = this._stack.fallThrough,
- this._stack.paused = !1),
- !t && l === !1) {
- for (; o >= 0 && (l = this._active[o].end(f),
- l !== !0); o--)
- if (l instanceof Promise)
- return this._stack.paused = !0,
- this._stack.loopPosition = o,
- this._stack.fallThrough = !1,
- l;
- o--
- }
- for (; o >= 0; o--)
- if (l = this._active[o].end(!1),
- l instanceof Promise)
- return this._stack.paused = !0,
- this._stack.loopPosition = o,
- this._stack.fallThrough = !0,
- l
- } else
- this._handlerFb(this._id, "END", f);
- this._active = h,
- this._id = -1,
- this._state = 0
- }
- }
- }
- ,
- r.OscHandler = class {
- constructor(f) {
- this._handler = f,
- this._data = "",
- this._hitLimit = !1
- }
- start() {
- this._data = "",
- this._hitLimit = !1
- }
- put(f, d, l) {
- this._hitLimit || (this._data += (0,
- _.utf32ToString)(f, d, l),
- this._data.length > n.PAYLOAD_LIMIT && (this._data = "",
- this._hitLimit = !0))
- }
- end(f) {
- let d = !1;
- if (this._hitLimit)
- d = !1;
- else if (f && (d = this._handler(this._data),
- d instanceof Promise))
- return d.then(l => (this._data = "",
- this._hitLimit = !1,
- l));
- return this._data = "",
- this._hitLimit = !1,
- d
- }
- }
- }
- ,
- 8742: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.Params = void 0;
- const a = 2147483647;
- class n {
- constructor(h = 32, f = 32) {
- if (this.maxLength = h,
- this.maxSubParamsLength = f,
- f > 256)
- throw new Error("maxSubParamsLength must not be greater than 256");
- this.params = new Int32Array(h),
- this.length = 0,
- this._subParams = new Int32Array(f),
- this._subParamsLength = 0,
- this._subParamsIdx = new Uint16Array(h),
- this._rejectDigits = !1,
- this._rejectSubDigits = !1,
- this._digitIsSub = !1
- }
- static fromArray(h) {
- const f = new n;
- if (!h.length)
- return f;
- for (let d = Array.isArray(h[0]) ? 1 : 0; d < h.length; ++d) {
- const l = h[d];
- if (Array.isArray(l))
- for (let o = 0; o < l.length; ++o)
- f.addSubParam(l[o]);
- else
- f.addParam(l)
- }
- return f
- }
- clone() {
- const h = new n(this.maxLength, this.maxSubParamsLength);
- return h.params.set(this.params),
- h.length = this.length,
- h._subParams.set(this._subParams),
- h._subParamsLength = this._subParamsLength,
- h._subParamsIdx.set(this._subParamsIdx),
- h._rejectDigits = this._rejectDigits,
- h._rejectSubDigits = this._rejectSubDigits,
- h._digitIsSub = this._digitIsSub,
- h
- }
- toArray() {
- const h = [];
- for (let f = 0; f < this.length; ++f) {
- h.push(this.params[f]);
- const d = this._subParamsIdx[f] >> 8
- , l = 255 & this._subParamsIdx[f];
- l - d > 0 && h.push(Array.prototype.slice.call(this._subParams, d, l))
- }
- return h
- }
- reset() {
- this.length = 0,
- this._subParamsLength = 0,
- this._rejectDigits = !1,
- this._rejectSubDigits = !1,
- this._digitIsSub = !1
- }
- addParam(h) {
- if (this._digitIsSub = !1,
- this.length >= this.maxLength)
- this._rejectDigits = !0;
- else {
- if (h < -1)
- throw new Error("values lesser than -1 are not allowed");
- this._subParamsIdx[this.length] = this._subParamsLength << 8 | this._subParamsLength,
- this.params[this.length++] = h > a ? a : h
- }
- }
- addSubParam(h) {
- if (this._digitIsSub = !0,
- this.length)
- if (this._rejectDigits || this._subParamsLength >= this.maxSubParamsLength)
- this._rejectSubDigits = !0;
- else {
- if (h < -1)
- throw new Error("values lesser than -1 are not allowed");
- this._subParams[this._subParamsLength++] = h > a ? a : h,
- this._subParamsIdx[this.length - 1]++
- }
- }
- hasSubParams(h) {
- return (255 & this._subParamsIdx[h]) - (this._subParamsIdx[h] >> 8) > 0
- }
- getSubParams(h) {
- const f = this._subParamsIdx[h] >> 8
- , d = 255 & this._subParamsIdx[h];
- return d - f > 0 ? this._subParams.subarray(f, d) : null
- }
- getSubParamsAll() {
- const h = {};
- for (let f = 0; f < this.length; ++f) {
- const d = this._subParamsIdx[f] >> 8
- , l = 255 & this._subParamsIdx[f];
- l - d > 0 && (h[f] = this._subParams.slice(d, l))
- }
- return h
- }
- addDigit(h) {
- let f;
- if (this._rejectDigits || !(f = this._digitIsSub ? this._subParamsLength : this.length) || this._digitIsSub && this._rejectSubDigits)
- return;
- const d = this._digitIsSub ? this._subParams : this.params
- , l = d[f - 1];
- d[f - 1] = ~l ? Math.min(10 * l + h, a) : h
- }
- }
- r.Params = n
- }
- ,
- 5741: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.AddonManager = void 0,
- r.AddonManager = class {
- constructor() {
- this._addons = []
- }
- dispose() {
- for (let a = this._addons.length - 1; a >= 0; a--)
- this._addons[a].instance.dispose()
- }
- loadAddon(a, n) {
- const _ = {
- instance: n,
- dispose: n.dispose,
- isDisposed: !1
- };
- this._addons.push(_),
- n.dispose = () => this._wrappedAddonDispose(_),
- n.activate(a)
- }
- _wrappedAddonDispose(a) {
- if (a.isDisposed)
- return;
- let n = -1;
- for (let _ = 0; _ < this._addons.length; _++)
- if (this._addons[_] === a) {
- n = _;
- break
- }
- if (n === -1)
- throw new Error("Could not dispose an addon that has not been loaded");
- a.isDisposed = !0,
- a.dispose.apply(a.instance),
- this._addons.splice(n, 1)
- }
- }
- }
- ,
- 8771: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.BufferApiView = void 0;
- const n = a(3785)
- , _ = a(511);
- r.BufferApiView = class {
- constructor(h, f) {
- this._buffer = h,
- this.type = f
- }
- init(h) {
- return this._buffer = h,
- this
- }
- get cursorY() {
- return this._buffer.y
- }
- get cursorX() {
- return this._buffer.x
- }
- get viewportY() {
- return this._buffer.ydisp
- }
- get baseY() {
- return this._buffer.ybase
- }
- get length() {
- return this._buffer.lines.length
- }
- getLine(h) {
- const f = this._buffer.lines.get(h);
- if (f)
- return new n.BufferLineApiView(f)
- }
- getNullCell() {
- return new _.CellData
- }
- }
- }
- ,
- 3785: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.BufferLineApiView = void 0;
- const n = a(511);
- r.BufferLineApiView = class {
- constructor(_) {
- this._line = _
- }
- get isWrapped() {
- return this._line.isWrapped
- }
- get length() {
- return this._line.length
- }
- getCell(_, h) {
- if (!(_ < 0 || _ >= this._line.length))
- return h ? (this._line.loadCell(_, h),
- h) : this._line.loadCell(_, new n.CellData)
- }
- translateToString(_, h, f) {
- return this._line.translateToString(_, h, f)
- }
- }
- }
- ,
- 8285: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.BufferNamespaceApi = void 0;
- const n = a(8771)
- , _ = a(8460);
- r.BufferNamespaceApi = class {
- constructor(h) {
- this._core = h,
- this._onBufferChange = new _.EventEmitter,
- this._normal = new n.BufferApiView(this._core.buffers.normal, "normal"),
- this._alternate = new n.BufferApiView(this._core.buffers.alt, "alternate"),
- this._core.buffers.onBufferActivate(() => this._onBufferChange.fire(this.active))
- }
- get onBufferChange() {
- return this._onBufferChange.event
- }
- get active() {
- if (this._core.buffers.active === this._core.buffers.normal)
- return this.normal;
- if (this._core.buffers.active === this._core.buffers.alt)
- return this.alternate;
- throw new Error("Active buffer is neither normal nor alternate")
- }
- get normal() {
- return this._normal.init(this._core.buffers.normal)
- }
- get alternate() {
- return this._alternate.init(this._core.buffers.alt)
- }
- }
- }
- ,
- 7975: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.ParserApi = void 0,
- r.ParserApi = class {
- constructor(a) {
- this._core = a
- }
- registerCsiHandler(a, n) {
- return this._core.registerCsiHandler(a, _ => n(_.toArray()))
- }
- addCsiHandler(a, n) {
- return this.registerCsiHandler(a, n)
- }
- registerDcsHandler(a, n) {
- return this._core.registerDcsHandler(a, (_, h) => n(_, h.toArray()))
- }
- addDcsHandler(a, n) {
- return this.registerDcsHandler(a, n)
- }
- registerEscHandler(a, n) {
- return this._core.registerEscHandler(a, n)
- }
- addEscHandler(a, n) {
- return this.registerEscHandler(a, n)
- }
- registerOscHandler(a, n) {
- return this._core.registerOscHandler(a, n)
- }
- addOscHandler(a, n) {
- return this.registerOscHandler(a, n)
- }
- }
- }
- ,
- 7090: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.UnicodeApi = void 0,
- r.UnicodeApi = class {
- constructor(a) {
- this._core = a
- }
- register(a) {
- this._core.unicodeService.register(a)
- }
- get versions() {
- return this._core.unicodeService.versions
- }
- get activeVersion() {
- return this._core.unicodeService.activeVersion
- }
- set activeVersion(a) {
- this._core.unicodeService.activeVersion = a
- }
- }
- }
- ,
- 744: function (x, r, a) {
- var n = this && this.__decorate || function (t, s, e, i) {
- var c, g = arguments.length, v = g < 3 ? s : i === null ? i = Object.getOwnPropertyDescriptor(s, e) : i;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- v = Reflect.decorate(t, s, e, i);
- else
- for (var S = t.length - 1; S >= 0; S--)
- (c = t[S]) && (v = (g < 3 ? c(v) : g > 3 ? c(s, e, v) : c(s, e)) || v);
- return g > 3 && v && Object.defineProperty(s, e, v),
- v
- }
- , _ = this && this.__param || function (t, s) {
- return function (e, i) {
- s(e, i, t)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.BufferService = r.MINIMUM_ROWS = r.MINIMUM_COLS = void 0;
- const h = a(2585)
- , f = a(5295)
- , d = a(8460)
- , l = a(844);
- r.MINIMUM_COLS = 2,
- r.MINIMUM_ROWS = 1;
- let o = class extends l.Disposable {
- constructor(t) {
- super(),
- this.isUserScrolling = !1,
- this._onResize = new d.EventEmitter,
- this._onScroll = new d.EventEmitter,
- this.cols = Math.max(t.rawOptions.cols || 0, r.MINIMUM_COLS),
- this.rows = Math.max(t.rawOptions.rows || 0, r.MINIMUM_ROWS),
- this.buffers = new f.BufferSet(t, this)
- }
- get onResize() {
- return this._onResize.event
- }
- get onScroll() {
- return this._onScroll.event
- }
- get buffer() {
- return this.buffers.active
- }
- dispose() {
- super.dispose(),
- this.buffers.dispose()
- }
- resize(t, s) {
- this.cols = t,
- this.rows = s,
- this.buffers.resize(t, s),
- this.buffers.setupTabStops(this.cols),
- this._onResize.fire({
- cols: t,
- rows: s
- })
- }
- reset() {
- this.buffers.reset(),
- this.isUserScrolling = !1
- }
- scroll(t, s = !1) {
- const e = this.buffer;
- let i;
- i = this._cachedBlankLine,
- i && i.length === this.cols && i.getFg(0) === t.fg && i.getBg(0) === t.bg || (i = e.getBlankLine(t, s),
- this._cachedBlankLine = i),
- i.isWrapped = s;
- const c = e.ybase + e.scrollTop
- , g = e.ybase + e.scrollBottom;
- if (e.scrollTop === 0) {
- const v = e.lines.isFull;
- g === e.lines.length - 1 ? v ? e.lines.recycle().copyFrom(i) : e.lines.push(i.clone()) : e.lines.splice(g + 1, 0, i.clone()),
- v ? this.isUserScrolling && (e.ydisp = Math.max(e.ydisp - 1, 0)) : (e.ybase++,
- this.isUserScrolling || e.ydisp++)
- } else {
- const v = g - c + 1;
- e.lines.shiftElements(c + 1, v - 1, -1),
- e.lines.set(g, i.clone())
- }
- this.isUserScrolling || (e.ydisp = e.ybase),
- this._onScroll.fire(e.ydisp)
- }
- scrollLines(t, s, e) {
- const i = this.buffer;
- if (t < 0) {
- if (i.ydisp === 0)
- return;
- this.isUserScrolling = !0
- } else
- t + i.ydisp >= i.ybase && (this.isUserScrolling = !1);
- const c = i.ydisp;
- i.ydisp = Math.max(Math.min(i.ydisp + t, i.ybase), 0),
- c !== i.ydisp && (s || this._onScroll.fire(i.ydisp))
- }
- scrollPages(t) {
- this.scrollLines(t * (this.rows - 1))
- }
- scrollToTop() {
- this.scrollLines(-this.buffer.ydisp)
- }
- scrollToBottom() {
- this.scrollLines(this.buffer.ybase - this.buffer.ydisp)
- }
- scrollToLine(t) {
- const s = t - this.buffer.ydisp;
- s !== 0 && this.scrollLines(s)
- }
- }
- ;
- o = n([_(0, h.IOptionsService)], o),
- r.BufferService = o
- },
- 7994: (x, r) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.CharsetService = void 0,
- r.CharsetService = class {
- constructor() {
- this.glevel = 0,
- this._charsets = []
- }
- reset() {
- this.charset = void 0,
- this._charsets = [],
- this.glevel = 0
- }
- setgLevel(a) {
- this.glevel = a,
- this.charset = this._charsets[a]
- }
- setgCharset(a, n) {
- this._charsets[a] = n,
- this.glevel === a && (this.charset = n)
- }
- }
- }
- ,
- 1753: function (x, r, a) {
- var n = this && this.__decorate || function (e, i, c, g) {
- var v, S = arguments.length, u = S < 3 ? i : g === null ? g = Object.getOwnPropertyDescriptor(i, c) : g;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- u = Reflect.decorate(e, i, c, g);
- else
- for (var m = e.length - 1; m >= 0; m--)
- (v = e[m]) && (u = (S < 3 ? v(u) : S > 3 ? v(i, c, u) : v(i, c)) || u);
- return S > 3 && u && Object.defineProperty(i, c, u),
- u
- }
- , _ = this && this.__param || function (e, i) {
- return function (c, g) {
- i(c, g, e)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.CoreMouseService = void 0;
- const h = a(2585)
- , f = a(8460)
- , d = {
- NONE: {
- events: 0,
- restrict: () => !1
- },
- X10: {
- events: 1,
- restrict: e => e.button !== 4 && e.action === 1 && (e.ctrl = !1,
- e.alt = !1,
- e.shift = !1,
- !0)
- },
- VT200: {
- events: 19,
- restrict: e => e.action !== 32
- },
- DRAG: {
- events: 23,
- restrict: e => e.action !== 32 || e.button !== 3
- },
- ANY: {
- events: 31,
- restrict: e => !0
- }
- };
- function l(e, i) {
- let c = (e.ctrl ? 16 : 0) | (e.shift ? 4 : 0) | (e.alt ? 8 : 0);
- return e.button === 4 ? (c |= 64,
- c |= e.action) : (c |= 3 & e.button,
- 4 & e.button && (c |= 64),
- 8 & e.button && (c |= 128),
- e.action === 32 ? c |= 32 : e.action !== 0 || i || (c |= 3)),
- c
- }
- const o = String.fromCharCode
- , t = {
- DEFAULT: e => {
- const i = [l(e, !1) + 32, e.col + 32, e.row + 32];
- return i[0] > 255 || i[1] > 255 || i[2] > 255 ? "" : `\x1B[M${o(i[0])}${o(i[1])}${o(i[2])}`
- }
- ,
- SGR: e => {
- const i = e.action === 0 && e.button !== 4 ? "m" : "M";
- return `\x1B[<${l(e, !0)};${e.col};${e.row}${i}`
- }
- ,
- SGR_PIXELS: e => {
- const i = e.action === 0 && e.button !== 4 ? "m" : "M";
- return `\x1B[<${l(e, !0)};${e.x};${e.y}${i}`
- }
- };
- let s = class {
- constructor(e, i) {
- this._bufferService = e,
- this._coreService = i,
- this._protocols = {},
- this._encodings = {},
- this._activeProtocol = "",
- this._activeEncoding = "",
- this._onProtocolChange = new f.EventEmitter,
- this._lastEvent = null;
- for (const c of Object.keys(d))
- this.addProtocol(c, d[c]);
- for (const c of Object.keys(t))
- this.addEncoding(c, t[c]);
- this.reset()
- }
- addProtocol(e, i) {
- this._protocols[e] = i
- }
- addEncoding(e, i) {
- this._encodings[e] = i
- }
- get activeProtocol() {
- return this._activeProtocol
- }
- get areMouseEventsActive() {
- return this._protocols[this._activeProtocol].events !== 0
- }
- set activeProtocol(e) {
- if (!this._protocols[e])
- throw new Error(`unknown protocol "${e}"`);
- this._activeProtocol = e,
- this._onProtocolChange.fire(this._protocols[e].events)
- }
- get activeEncoding() {
- return this._activeEncoding
- }
- set activeEncoding(e) {
- if (!this._encodings[e])
- throw new Error(`unknown encoding "${e}"`);
- this._activeEncoding = e
- }
- reset() {
- this.activeProtocol = "NONE",
- this.activeEncoding = "DEFAULT",
- this._lastEvent = null
- }
- get onProtocolChange() {
- return this._onProtocolChange.event
- }
- triggerMouseEvent(e) {
- if (e.col < 0 || e.col >= this._bufferService.cols || e.row < 0 || e.row >= this._bufferService.rows || e.button === 4 && e.action === 32 || e.button === 3 && e.action !== 32 || e.button !== 4 && (e.action === 2 || e.action === 3) || (e.col++,
- e.row++,
- e.action === 32 && this._lastEvent && this._equalEvents(this._lastEvent, e, this._activeEncoding === "SGR_PIXELS")) || !this._protocols[this._activeProtocol].restrict(e))
- return !1;
- const i = this._encodings[this._activeEncoding](e);
- return i && (this._activeEncoding === "DEFAULT" ? this._coreService.triggerBinaryEvent(i) : this._coreService.triggerDataEvent(i, !0)),
- this._lastEvent = e,
- !0
- }
- explainEvents(e) {
- return {
- down: !!(1 & e),
- up: !!(2 & e),
- drag: !!(4 & e),
- move: !!(8 & e),
- wheel: !!(16 & e)
- }
- }
- _equalEvents(e, i, c) {
- if (c) {
- if (e.x !== i.x || e.y !== i.y)
- return !1
- } else if (e.col !== i.col || e.row !== i.row)
- return !1;
- return e.button === i.button && e.action === i.action && e.ctrl === i.ctrl && e.alt === i.alt && e.shift === i.shift
- }
- }
- ;
- s = n([_(0, h.IBufferService), _(1, h.ICoreService)], s),
- r.CoreMouseService = s
- },
- 6975: function (x, r, a) {
- var n = this && this.__decorate || function (e, i, c, g) {
- var v, S = arguments.length, u = S < 3 ? i : g === null ? g = Object.getOwnPropertyDescriptor(i, c) : g;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- u = Reflect.decorate(e, i, c, g);
- else
- for (var m = e.length - 1; m >= 0; m--)
- (v = e[m]) && (u = (S < 3 ? v(u) : S > 3 ? v(i, c, u) : v(i, c)) || u);
- return S > 3 && u && Object.defineProperty(i, c, u),
- u
- }
- , _ = this && this.__param || function (e, i) {
- return function (c, g) {
- i(c, g, e)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.CoreService = void 0;
- const h = a(2585)
- , f = a(8460)
- , d = a(1439)
- , l = a(844)
- , o = Object.freeze({
- insertMode: !1
- })
- , t = Object.freeze({
- applicationCursorKeys: !1,
- applicationKeypad: !1,
- bracketedPasteMode: !1,
- origin: !1,
- reverseWraparound: !1,
- sendFocus: !1,
- wraparound: !0
- });
- let s = class extends l.Disposable {
- constructor(e, i, c, g) {
- super(),
- this._bufferService = i,
- this._logService = c,
- this._optionsService = g,
- this.isCursorInitialized = !1,
- this.isCursorHidden = !1,
- this._onData = this.register(new f.EventEmitter),
- this._onUserInput = this.register(new f.EventEmitter),
- this._onBinary = this.register(new f.EventEmitter),
- this._scrollToBottom = e,
- this.register({
- dispose: () => this._scrollToBottom = void 0
- }),
- this.modes = (0,
- d.clone)(o),
- this.decPrivateModes = (0,
- d.clone)(t)
- }
- get onData() {
- return this._onData.event
- }
- get onUserInput() {
- return this._onUserInput.event
- }
- get onBinary() {
- return this._onBinary.event
- }
- reset() {
- this.modes = (0,
- d.clone)(o),
- this.decPrivateModes = (0,
- d.clone)(t)
- }
- triggerDataEvent(e, i = !1) {
- if (this._optionsService.rawOptions.disableStdin)
- return;
- const c = this._bufferService.buffer;
- c.ybase !== c.ydisp && this._scrollToBottom(),
- i && this._onUserInput.fire(),
- this._logService.debug(`sending data "${e}"`, () => e.split("").map(g => g.charCodeAt(0))),
- this._onData.fire(e)
- }
- triggerBinaryEvent(e) {
- this._optionsService.rawOptions.disableStdin || (this._logService.debug(`sending binary "${e}"`, () => e.split("").map(i => i.charCodeAt(0))),
- this._onBinary.fire(e))
- }
- }
- ;
- s = n([_(1, h.IBufferService), _(2, h.ILogService), _(3, h.IOptionsService)], s),
- r.CoreService = s
- },
- 9074: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.DecorationService = void 0;
- const n = a(8055)
- , _ = a(8460)
- , h = a(844)
- , f = a(6106)
- , d = {
- xmin: 0,
- xmax: 0
- };
- class l extends h.Disposable {
- constructor() {
- super(...arguments),
- this._decorations = new f.SortedList(s => s == null ? void 0 : s.marker.line),
- this._onDecorationRegistered = this.register(new _.EventEmitter),
- this._onDecorationRemoved = this.register(new _.EventEmitter)
- }
- get onDecorationRegistered() {
- return this._onDecorationRegistered.event
- }
- get onDecorationRemoved() {
- return this._onDecorationRemoved.event
- }
- get decorations() {
- return this._decorations.values()
- }
- registerDecoration(s) {
- if (s.marker.isDisposed)
- return;
- const e = new o(s);
- if (e) {
- const i = e.marker.onDispose(() => e.dispose());
- e.onDispose(() => {
- e && (this._decorations.delete(e) && this._onDecorationRemoved.fire(e),
- i.dispose())
- }
- ),
- this._decorations.insert(e),
- this._onDecorationRegistered.fire(e)
- }
- return e
- }
- reset() {
- for (const s of this._decorations.values())
- s.dispose();
- this._decorations.clear()
- }
- *getDecorationsAtCell(s, e, i) {
- var c, g, v;
- let S = 0
- , u = 0;
- for (const m of this._decorations.getKeyIterator(e))
- S = (c = m.options.x) !== null && c !== void 0 ? c : 0,
- u = S + ((g = m.options.width) !== null && g !== void 0 ? g : 1),
- s >= S && s < u && (!i || ((v = m.options.layer) !== null && v !== void 0 ? v : "bottom") === i) && (yield m)
- }
- forEachDecorationAtCell(s, e, i, c) {
- this._decorations.forEachByKey(e, g => {
- var v, S, u;
- d.xmin = (v = g.options.x) !== null && v !== void 0 ? v : 0,
- d.xmax = d.xmin + ((S = g.options.width) !== null && S !== void 0 ? S : 1),
- s >= d.xmin && s < d.xmax && (!i || ((u = g.options.layer) !== null && u !== void 0 ? u : "bottom") === i) && c(g)
- }
- )
- }
- dispose() {
- for (const s of this._decorations.values())
- this._onDecorationRemoved.fire(s);
- this.reset()
- }
- }
- r.DecorationService = l;
- class o extends h.Disposable {
- constructor(s) {
- super(),
- this.options = s,
- this.isDisposed = !1,
- this.onRenderEmitter = this.register(new _.EventEmitter),
- this.onRender = this.onRenderEmitter.event,
- this._onDispose = this.register(new _.EventEmitter),
- this.onDispose = this._onDispose.event,
- this._cachedBg = null,
- this._cachedFg = null,
- this.marker = s.marker,
- this.options.overviewRulerOptions && !this.options.overviewRulerOptions.position && (this.options.overviewRulerOptions.position = "full")
- }
- get backgroundColorRGB() {
- return this._cachedBg === null && (this.options.backgroundColor ? this._cachedBg = n.css.toColor(this.options.backgroundColor) : this._cachedBg = void 0),
- this._cachedBg
- }
- get foregroundColorRGB() {
- return this._cachedFg === null && (this.options.foregroundColor ? this._cachedFg = n.css.toColor(this.options.foregroundColor) : this._cachedFg = void 0),
- this._cachedFg
- }
- dispose() {
- this._isDisposed || (this._isDisposed = !0,
- this._onDispose.fire(),
- super.dispose())
- }
- }
- }
- ,
- 3730: function (x, r, a) {
- var n = this && this.__decorate || function (d, l, o, t) {
- var s, e = arguments.length, i = e < 3 ? l : t === null ? t = Object.getOwnPropertyDescriptor(l, o) : t;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- i = Reflect.decorate(d, l, o, t);
- else
- for (var c = d.length - 1; c >= 0; c--)
- (s = d[c]) && (i = (e < 3 ? s(i) : e > 3 ? s(l, o, i) : s(l, o)) || i);
- return e > 3 && i && Object.defineProperty(l, o, i),
- i
- }
- , _ = this && this.__param || function (d, l) {
- return function (o, t) {
- l(o, t, d)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.DirtyRowService = void 0;
- const h = a(2585);
- let f = class {
- constructor(d) {
- this._bufferService = d,
- this.clearRange()
- }
- get start() {
- return this._start
- }
- get end() {
- return this._end
- }
- clearRange() {
- this._start = this._bufferService.buffer.y,
- this._end = this._bufferService.buffer.y
- }
- markDirty(d) {
- d < this._start ? this._start = d : d > this._end && (this._end = d)
- }
- markRangeDirty(d, l) {
- if (d > l) {
- const o = d;
- d = l,
- l = o
- }
- d < this._start && (this._start = d),
- l > this._end && (this._end = l)
- }
- markAllDirty() {
- this.markRangeDirty(0, this._bufferService.rows - 1)
- }
- }
- ;
- f = n([_(0, h.IBufferService)], f),
- r.DirtyRowService = f
- },
- 4348: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.InstantiationService = r.ServiceCollection = void 0;
- const n = a(2585)
- , _ = a(8343);
- class h {
- constructor(...d) {
- this._entries = new Map;
- for (const [l, o] of d)
- this.set(l, o)
- }
- set(d, l) {
- const o = this._entries.get(d);
- return this._entries.set(d, l),
- o
- }
- forEach(d) {
- this._entries.forEach((l, o) => d(o, l))
- }
- has(d) {
- return this._entries.has(d)
- }
- get(d) {
- return this._entries.get(d)
- }
- }
- r.ServiceCollection = h,
- r.InstantiationService = class {
- constructor() {
- this._services = new h,
- this._services.set(n.IInstantiationService, this)
- }
- setService(f, d) {
- this._services.set(f, d)
- }
- getService(f) {
- return this._services.get(f)
- }
- createInstance(f, ...d) {
- const l = (0,
- _.getServiceDependencies)(f).sort((s, e) => s.index - e.index)
- , o = [];
- for (const s of l) {
- const e = this._services.get(s.id);
- if (!e)
- throw new Error(`[createInstance] ${f.name} depends on UNKNOWN service ${s.id}.`);
- o.push(e)
- }
- const t = l.length > 0 ? l[0].index : d.length;
- if (d.length !== t)
- throw new Error(`[createInstance] First service dependency of ${f.name} at position ${t + 1} conflicts with ${d.length} static arguments`);
- return new f(...d, ...o)
- }
- }
- }
- ,
- 7866: function (x, r, a) {
- var n = this && this.__decorate || function (l, o, t, s) {
- var e, i = arguments.length, c = i < 3 ? o : s === null ? s = Object.getOwnPropertyDescriptor(o, t) : s;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- c = Reflect.decorate(l, o, t, s);
- else
- for (var g = l.length - 1; g >= 0; g--)
- (e = l[g]) && (c = (i < 3 ? e(c) : i > 3 ? e(o, t, c) : e(o, t)) || c);
- return i > 3 && c && Object.defineProperty(o, t, c),
- c
- }
- , _ = this && this.__param || function (l, o) {
- return function (t, s) {
- o(t, s, l)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.LogService = void 0;
- const h = a(2585)
- , f = {
- debug: h.LogLevelEnum.DEBUG,
- info: h.LogLevelEnum.INFO,
- warn: h.LogLevelEnum.WARN,
- error: h.LogLevelEnum.ERROR,
- off: h.LogLevelEnum.OFF
- };
- let d = class {
- constructor(l) {
- this._optionsService = l,
- this.logLevel = h.LogLevelEnum.OFF,
- this._updateLogLevel(),
- this._optionsService.onOptionChange(o => {
- o === "logLevel" && this._updateLogLevel()
- }
- )
- }
- _updateLogLevel() {
- this.logLevel = f[this._optionsService.rawOptions.logLevel]
- }
- _evalLazyOptionalParams(l) {
- for (let o = 0; o < l.length; o++)
- typeof l[o] == "function" && (l[o] = l[o]())
- }
- _log(l, o, t) {
- this._evalLazyOptionalParams(t),
- l.call(console, "xterm.js: " + o, ...t)
- }
- debug(l, ...o) {
- this.logLevel <= h.LogLevelEnum.DEBUG && this._log(console.log, l, o)
- }
- info(l, ...o) {
- this.logLevel <= h.LogLevelEnum.INFO && this._log(console.info, l, o)
- }
- warn(l, ...o) {
- this.logLevel <= h.LogLevelEnum.WARN && this._log(console.warn, l, o)
- }
- error(l, ...o) {
- this.logLevel <= h.LogLevelEnum.ERROR && this._log(console.error, l, o)
- }
- }
- ;
- d = n([_(0, h.IOptionsService)], d),
- r.LogService = d
- },
- 7302: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.OptionsService = r.DEFAULT_OPTIONS = void 0;
- const n = a(8460)
- , _ = a(6114);
- r.DEFAULT_OPTIONS = {
- cols: 80,
- rows: 24,
- cursorBlink: !1,
- cursorStyle: "block",
- cursorWidth: 1,
- customGlyphs: !0,
- drawBoldTextInBrightColors: !0,
- fastScrollModifier: "alt",
- fastScrollSensitivity: 5,
- fontFamily: "courier-new, courier, monospace",
- fontSize: 15,
- fontWeight: "normal",
- fontWeightBold: "bold",
- lineHeight: 1,
- letterSpacing: 0,
- linkHandler: null,
- logLevel: "info",
- scrollback: 1e3,
- scrollSensitivity: 1,
- screenReaderMode: !1,
- smoothScrollDuration: 0,
- macOptionIsMeta: !1,
- macOptionClickForcesSelection: !1,
- minimumContrastRatio: 1,
- disableStdin: !1,
- allowProposedApi: !1,
- allowTransparency: !1,
- tabStopWidth: 8,
- theme: {},
- rightClickSelectsWord: _.isMac,
- windowOptions: {},
- windowsMode: !1,
- wordSeparator: " ()[]{}',\"`",
- altClickMovesCursor: !0,
- convertEol: !1,
- termName: "xterm",
- cancelEvents: !1,
- overviewRulerWidth: 0
- };
- const h = ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900"];
- r.OptionsService = class {
- constructor(f) {
- this._onOptionChange = new n.EventEmitter;
- const d = Object.assign({}, r.DEFAULT_OPTIONS);
- for (const l in f)
- if (l in d)
- try {
- const o = f[l];
- d[l] = this._sanitizeAndValidateOption(l, o)
- } catch (o) {
- console.error(o)
- }
- this.rawOptions = d,
- this.options = Object.assign({}, d),
- this._setupOptions()
- }
- get onOptionChange() {
- return this._onOptionChange.event
- }
- _setupOptions() {
- const f = l => {
- if (!(l in r.DEFAULT_OPTIONS))
- throw new Error(`No option with key "${l}"`);
- return this.rawOptions[l]
- }
- , d = (l, o) => {
- if (!(l in r.DEFAULT_OPTIONS))
- throw new Error(`No option with key "${l}"`);
- o = this._sanitizeAndValidateOption(l, o),
- this.rawOptions[l] !== o && (this.rawOptions[l] = o,
- this._onOptionChange.fire(l))
- }
- ;
- for (const l in this.rawOptions) {
- const o = {
- get: f.bind(this, l),
- set: d.bind(this, l)
- };
- Object.defineProperty(this.options, l, o)
- }
- }
- _sanitizeAndValidateOption(f, d) {
- switch (f) {
- case "cursorStyle":
- if (d || (d = r.DEFAULT_OPTIONS[f]),
- !function (l) {
- return l === "block" || l === "underline" || l === "bar"
- }(d))
- throw new Error(`"${d}" is not a valid value for ${f}`);
- break;
- case "wordSeparator":
- d || (d = r.DEFAULT_OPTIONS[f]);
- break;
- case "fontWeight":
- case "fontWeightBold":
- if (typeof d == "number" && 1 <= d && d <= 1e3)
- break;
- d = h.includes(d) ? d : r.DEFAULT_OPTIONS[f];
- break;
- case "cursorWidth":
- d = Math.floor(d);
- case "lineHeight":
- case "tabStopWidth":
- if (d < 1)
- throw new Error(`${f} cannot be less than 1, value: ${d}`);
- break;
- case "minimumContrastRatio":
- d = Math.max(1, Math.min(21, Math.round(10 * d) / 10));
- break;
- case "scrollback":
- if ((d = Math.min(d, 4294967295)) < 0)
- throw new Error(`${f} cannot be less than 0, value: ${d}`);
- break;
- case "fastScrollSensitivity":
- case "scrollSensitivity":
- if (d <= 0)
- throw new Error(`${f} cannot be less than or equal to 0, value: ${d}`);
- case "rows":
- case "cols":
- if (!d && d !== 0)
- throw new Error(`${f} must be numeric, value: ${d}`)
- }
- return d
- }
- }
- }
- ,
- 2660: function (x, r, a) {
- var n = this && this.__decorate || function (d, l, o, t) {
- var s, e = arguments.length, i = e < 3 ? l : t === null ? t = Object.getOwnPropertyDescriptor(l, o) : t;
- if (typeof Reflect == "object" && typeof Reflect.decorate == "function")
- i = Reflect.decorate(d, l, o, t);
- else
- for (var c = d.length - 1; c >= 0; c--)
- (s = d[c]) && (i = (e < 3 ? s(i) : e > 3 ? s(l, o, i) : s(l, o)) || i);
- return e > 3 && i && Object.defineProperty(l, o, i),
- i
- }
- , _ = this && this.__param || function (d, l) {
- return function (o, t) {
- l(o, t, d)
- }
- }
- ;
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.OscLinkService = void 0;
- const h = a(2585);
- let f = class {
- constructor(d) {
- this._bufferService = d,
- this._nextId = 1,
- this._entriesWithId = new Map,
- this._dataByLinkId = new Map
- }
- registerLink(d) {
- const l = this._bufferService.buffer;
- if (d.id === void 0) {
- const c = l.addMarker(l.ybase + l.y)
- , g = {
- data: d,
- id: this._nextId++,
- lines: [c]
- };
- return c.onDispose(() => this._removeMarkerFromLink(g, c)),
- this._dataByLinkId.set(g.id, g),
- g.id
- }
- const o = d
- , t = this._getEntryIdKey(o)
- , s = this._entriesWithId.get(t);
- if (s)
- return this.addLineToLink(s.id, l.ybase + l.y),
- s.id;
- const e = l.addMarker(l.ybase + l.y)
- , i = {
- id: this._nextId++,
- key: this._getEntryIdKey(o),
- data: o,
- lines: [e]
- };
- return e.onDispose(() => this._removeMarkerFromLink(i, e)),
- this._entriesWithId.set(i.key, i),
- this._dataByLinkId.set(i.id, i),
- i.id
- }
- addLineToLink(d, l) {
- const o = this._dataByLinkId.get(d);
- if (o && o.lines.every(t => t.line !== l)) {
- const t = this._bufferService.buffer.addMarker(l);
- o.lines.push(t),
- t.onDispose(() => this._removeMarkerFromLink(o, t))
- }
- }
- getLinkData(d) {
- var l;
- return (l = this._dataByLinkId.get(d)) === null || l === void 0 ? void 0 : l.data
- }
- _getEntryIdKey(d) {
- return `${d.id};;${d.uri}`
- }
- _removeMarkerFromLink(d, l) {
- const o = d.lines.indexOf(l);
- o !== -1 && (d.lines.splice(o, 1),
- d.lines.length === 0 && (d.data.id !== void 0 && this._entriesWithId.delete(d.key),
- this._dataByLinkId.delete(d.id)))
- }
- }
- ;
- f = n([_(0, h.IBufferService)], f),
- r.OscLinkService = f
- },
- 8343: (x, r) => {
- function a(n, _, h) {
- _.di$target === _ ? _.di$dependencies.push({
- id: n,
- index: h
- }) : (_.di$dependencies = [{
- id: n,
- index: h
- }],
- _.di$target = _)
- }
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.createDecorator = r.getServiceDependencies = r.serviceRegistry = void 0,
- r.serviceRegistry = new Map,
- r.getServiceDependencies = function (n) {
- return n.di$dependencies || []
- }
- ,
- r.createDecorator = function (n) {
- if (r.serviceRegistry.has(n))
- return r.serviceRegistry.get(n);
- const _ = function (h, f, d) {
- if (arguments.length !== 3)
- throw new Error("@IServiceName-decorator can only be used to decorate a parameter");
- a(_, h, d)
- };
- return _.toString = () => n,
- r.serviceRegistry.set(n, _),
- _
- }
- }
- ,
- 2585: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.IDecorationService = r.IUnicodeService = r.IOscLinkService = r.IOptionsService = r.ILogService = r.LogLevelEnum = r.IInstantiationService = r.IDirtyRowService = r.ICharsetService = r.ICoreService = r.ICoreMouseService = r.IBufferService = void 0;
- const n = a(8343);
- var _;
- r.IBufferService = (0,
- n.createDecorator)("BufferService"),
- r.ICoreMouseService = (0,
- n.createDecorator)("CoreMouseService"),
- r.ICoreService = (0,
- n.createDecorator)("CoreService"),
- r.ICharsetService = (0,
- n.createDecorator)("CharsetService"),
- r.IDirtyRowService = (0,
- n.createDecorator)("DirtyRowService"),
- r.IInstantiationService = (0,
- n.createDecorator)("InstantiationService"),
- (_ = r.LogLevelEnum || (r.LogLevelEnum = {}))[_.DEBUG = 0] = "DEBUG",
- _[_.INFO = 1] = "INFO",
- _[_.WARN = 2] = "WARN",
- _[_.ERROR = 3] = "ERROR",
- _[_.OFF = 4] = "OFF",
- r.ILogService = (0,
- n.createDecorator)("LogService"),
- r.IOptionsService = (0,
- n.createDecorator)("OptionsService"),
- r.IOscLinkService = (0,
- n.createDecorator)("OscLinkService"),
- r.IUnicodeService = (0,
- n.createDecorator)("UnicodeService"),
- r.IDecorationService = (0,
- n.createDecorator)("DecorationService")
- }
- ,
- 1480: (x, r, a) => {
- Object.defineProperty(r, "__esModule", {
- value: !0
- }),
- r.UnicodeService = void 0;
- const n = a(8460)
- , _ = a(225);
- r.UnicodeService = class {
- constructor() {
- this._providers = Object.create(null),
- this._active = "",
- this._onChange = new n.EventEmitter;
- const h = new _.UnicodeV6;
- this.register(h),
- this._active = h.version,
- this._activeProvider = h
- }
- get onChange() {
- return this._onChange.event
- }
- get versions() {
- return Object.keys(this._providers)
- }
- get activeVersion() {
- return this._active
- }
- set activeVersion(h) {
- if (!this._providers[h])
- throw new Error(`unknown Unicode version "${h}"`);
- this._active = h,
- this._activeProvider = this._providers[h],
- this._onChange.fire(h)
- }
- register(h) {
- this._providers[h.version] = h
- }
- wcwidth(h) {
- return this._activeProvider.wcwidth(h)
- }
- getStringCellWidth(h) {
- let f = 0;
- const d = h.length;
- for (let l = 0; l < d; ++l) {
- let o = h.charCodeAt(l);
- if (55296 <= o && o <= 56319) {
- if (++l >= d)
- return f + this.wcwidth(o);
- const t = h.charCodeAt(l);
- 56320 <= t && t <= 57343 ? o = 1024 * (o - 55296) + t - 56320 + 65536 : f += this.wcwidth(t)
- }
- f += this.wcwidth(o)
- }
- return f
- }
- }
- }
- }
- , G = {};
- function U(x) {
- var r = G[x];
- if (r !== void 0)
- return r.exports;
- var a = G[x] = {
- exports: {}
- };
- return V[x].call(a.exports, a, a.exports, U),
- a.exports
- }
- var q = {};
- return (() => {
- var x = q;
- Object.defineProperty(x, "__esModule", {
- value: !0
- }),
- x.Terminal = void 0;
- const r = U(3236)
- , a = U(9042)
- , n = U(7975)
- , _ = U(7090)
- , h = U(5741)
- , f = U(8285)
- , d = ["cols", "rows"];
- x.Terminal = class {
- constructor(l) {
- this._core = new r.Terminal(l),
- this._addonManager = new h.AddonManager,
- this._publicOptions = Object.assign({}, this._core.options);
- const o = s => this._core.options[s]
- , t = (s, e) => {
- this._checkReadonlyOptions(s),
- this._core.options[s] = e
- }
- ;
- for (const s in this._core.options) {
- const e = {
- get: o.bind(this, s),
- set: t.bind(this, s)
- };
- Object.defineProperty(this._publicOptions, s, e)
- }
- }
- _checkReadonlyOptions(l) {
- if (d.includes(l))
- throw new Error(`Option "${l}" can only be set in the constructor`)
- }
- _checkProposedApi() {
- if (!this._core.optionsService.rawOptions.allowProposedApi)
- throw new Error("You must set the allowProposedApi option to true to use proposed API")
- }
- get onBell() {
- return this._core.onBell
- }
- get onBinary() {
- return this._core.onBinary
- }
- get onCursorMove() {
- return this._core.onCursorMove
- }
- get onData() {
- return this._core.onData
- }
- get onKey() {
- return this._core.onKey
- }
- get onLineFeed() {
- return this._core.onLineFeed
- }
- get onRender() {
- return this._core.onRender
- }
- get onResize() {
- return this._core.onResize
- }
- get onScroll() {
- return this._core.onScroll
- }
- get onSelectionChange() {
- return this._core.onSelectionChange
- }
- get onTitleChange() {
- return this._core.onTitleChange
- }
- get onWriteParsed() {
- return this._core.onWriteParsed
- }
- get element() {
- return this._core.element
- }
- get parser() {
- return this._checkProposedApi(),
- this._parser || (this._parser = new n.ParserApi(this._core)),
- this._parser
- }
- get unicode() {
- return this._checkProposedApi(),
- new _.UnicodeApi(this._core)
- }
- get textarea() {
- return this._core.textarea
- }
- get rows() {
- return this._core.rows
- }
- get cols() {
- return this._core.cols
- }
- get buffer() {
- return this._checkProposedApi(),
- this._buffer || (this._buffer = new f.BufferNamespaceApi(this._core)),
- this._buffer
- }
- get markers() {
- return this._checkProposedApi(),
- this._core.markers
- }
- get modes() {
- const l = this._core.coreService.decPrivateModes;
- let o = "none";
- switch (this._core.coreMouseService.activeProtocol) {
- case "X10":
- o = "x10";
- break;
- case "VT200":
- o = "vt200";
- break;
- case "DRAG":
- o = "drag";
- break;
- case "ANY":
- o = "any"
- }
- return {
- applicationCursorKeysMode: l.applicationCursorKeys,
- applicationKeypadMode: l.applicationKeypad,
- bracketedPasteMode: l.bracketedPasteMode,
- insertMode: this._core.coreService.modes.insertMode,
- mouseTrackingMode: o,
- originMode: l.origin,
- reverseWraparoundMode: l.reverseWraparound,
- sendFocusMode: l.sendFocus,
- wraparoundMode: l.wraparound
- }
- }
- get options() {
- return this._publicOptions
- }
- set options(l) {
- for (const o in l)
- this._publicOptions[o] = l[o]
- }
- blur() {
- this._core.blur()
- }
- focus() {
- this._core.focus()
- }
- resize(l, o) {
- this._verifyIntegers(l, o),
- this._core.resize(l, o)
- }
- open(l) {
- this._core.open(l)
- }
- attachCustomKeyEventHandler(l) {
- this._core.attachCustomKeyEventHandler(l)
- }
- registerLinkProvider(l) {
- return this._checkProposedApi(),
- this._core.registerLinkProvider(l)
- }
- registerCharacterJoiner(l) {
- return this._checkProposedApi(),
- this._core.registerCharacterJoiner(l)
- }
- deregisterCharacterJoiner(l) {
- this._checkProposedApi(),
- this._core.deregisterCharacterJoiner(l)
- }
- registerMarker(l = 0) {
- return this._verifyIntegers(l),
- this._core.addMarker(l)
- }
- registerDecoration(l) {
- var o, t, s;
- return this._checkProposedApi(),
- this._verifyPositiveIntegers((o = l.x) !== null && o !== void 0 ? o : 0, (t = l.width) !== null && t !== void 0 ? t : 0, (s = l.height) !== null && s !== void 0 ? s : 0),
- this._core.registerDecoration(l)
- }
- hasSelection() {
- return this._core.hasSelection()
- }
- select(l, o, t) {
- this._verifyIntegers(l, o, t),
- this._core.select(l, o, t)
- }
- getSelection() {
- return this._core.getSelection()
- }
- getSelectionPosition() {
- return this._core.getSelectionPosition()
- }
- clearSelection() {
- this._core.clearSelection()
- }
- selectAll() {
- this._core.selectAll()
- }
- selectLines(l, o) {
- this._verifyIntegers(l, o),
- this._core.selectLines(l, o)
- }
- dispose() {
- this._addonManager.dispose(),
- this._core.dispose()
- }
- scrollLines(l) {
- this._verifyIntegers(l),
- this._core.scrollLines(l)
- }
- scrollPages(l) {
- this._verifyIntegers(l),
- this._core.scrollPages(l)
- }
- scrollToTop() {
- this._core.scrollToTop()
- }
- scrollToBottom() {
- this._core.scrollToBottom()
- }
- scrollToLine(l) {
- this._verifyIntegers(l),
- this._core.scrollToLine(l)
- }
- clear() {
- this._core.clear()
- }
- write(l, o) {
- this._core.write(l, o)
- }
- writeln(l, o) {
- this._core.write(l),
- this._core.write(`\r
- `, o)
- }
- paste(l) {
- this._core.paste(l)
- }
- refresh(l, o) {
- this._verifyIntegers(l, o),
- this._core.refresh(l, o)
- }
- reset() {
- this._core.reset()
- }
- clearTextureAtlas() {
- this._core.clearTextureAtlas()
- }
- loadAddon(l) {
- return this._addonManager.loadAddon(this, l)
- }
- static get strings() {
- return a
- }
- _verifyIntegers(...l) {
- for (const o of l)
- if (o === 1 / 0 || isNaN(o) || o % 1 != 0)
- throw new Error("This API only accepts integers")
- }
- _verifyPositiveIntegers(...l) {
- for (const o of l)
- if (o && (o === 1 / 0 || isNaN(o) || o % 1 != 0 || o < 0))
- throw new Error("This API only accepts positive integers")
- }
- }
- }
- )(),
- q
- }
- )()
- })
- }
- )(Ce);
- var ye = {
- exports: {}
- };
- (function (z, W) {
- (function (V, G) {
- z.exports = G()
- }
- )(self, function () {
- return (() => {
- var V = {};
- return (() => {
- var G = V;
- Object.defineProperty(G, "__esModule", {
- value: !0
- }),
- G.FitAddon = void 0,
- G.FitAddon = class {
- constructor() { }
- activate(U) {
- this._terminal = U
- }
- dispose() { }
- fit() {
- const U = this.proposeDimensions();
- if (!U || !this._terminal || isNaN(U.cols) || isNaN(U.rows))
- return;
- const q = this._terminal._core;
- this._terminal.rows === U.rows && this._terminal.cols === U.cols || (q._renderService.clear(),
- this._terminal.resize(U.cols, U.rows))
- }
- proposeDimensions() {
- if (!this._terminal || !this._terminal.element || !this._terminal.element.parentElement)
- return;
- const U = this._terminal._core;
- if (U._renderService.dimensions.actualCellWidth === 0 || U._renderService.dimensions.actualCellHeight === 0)
- return;
- const q = this._terminal.options.scrollback === 0 ? 0 : U.viewport.scrollBarWidth
- , x = window.getComputedStyle(this._terminal.element.parentElement)
- , r = parseInt(x.getPropertyValue("height"))
- , a = Math.max(0, parseInt(x.getPropertyValue("width")))
- , n = window.getComputedStyle(this._terminal.element)
- , _ = r - (parseInt(n.getPropertyValue("padding-top")) + parseInt(n.getPropertyValue("padding-bottom")))
- , h = a - (parseInt(n.getPropertyValue("padding-right")) + parseInt(n.getPropertyValue("padding-left"))) - q;
- return {
- cols: Math.max(2, Math.floor(h / U._renderService.dimensions.actualCellWidth)),
- rows: Math.max(1, Math.floor(_ / U._renderService.dimensions.actualCellHeight))
- }
- }
- }
- }
- )(),
- V
- }
- )()
- })
- }
- )(ye);
- var fe = {};
- (function (z) {
- Object.defineProperty(z, "__esModule", {
- value: !0
- }),
- z.serial = z.SerialPort = z.SerialPolyfillProtocol = void 0;
- var W;
- (function (g) {
- g[g.UsbCdcAcm = 0] = "UsbCdcAcm"
- }
- )(W = z.SerialPolyfillProtocol || (z.SerialPolyfillProtocol = {}));
- const V = 32
- , G = 34
- , U = 35
- , q = 255
- , x = 8
- , r = "none"
- , a = 1
- , n = [16, 8, 7, 6, 5]
- , _ = [1, 2]
- , h = ["none", "even", "odd"]
- , f = ["none", "odd", "even"]
- , d = [1, 1.5, 2]
- , l = {
- protocol: W.UsbCdcAcm,
- usbControlInterfaceClass: 2,
- usbTransferInterfaceClass: 10
- };
- function o(g, v) {
- const S = g.configurations[0];
- for (const u of S.interfaces)
- if (u.alternates[0].interfaceClass === v)
- return u;
- throw new TypeError(`Unable to find interface with class ${v}.`)
- }
- function t(g, v) {
- const S = g.alternates[0];
- for (const u of S.endpoints)
- if (u.direction == v)
- return u;
- throw new TypeError(`Interface ${g.interfaceNumber} does not have an ${v} endpoint.`)
- }
- class s {
- constructor(v, S, u) {
- this.type = "bytes",
- this.device_ = v,
- this.endpoint_ = S,
- this.onError_ = u
- }
- pull(v) {
- (async () => {
- var S;
- let u;
- if (v.desiredSize) {
- const m = v.desiredSize / this.endpoint_.packetSize;
- u = Math.ceil(m) * this.endpoint_.packetSize
- } else
- u = this.endpoint_.packetSize;
- try {
- const m = await this.device_.transferIn(this.endpoint_.endpointNumber, u);
- if (m.status != "ok" && (v.error(`USB error: ${m.status}`),
- this.onError_()),
- !((S = m.data) === null || S === void 0) && S.buffer) {
- const w = new Uint8Array(m.data.buffer, m.data.byteOffset, m.data.byteLength);
- v.enqueue(w)
- }
- } catch (m) {
- v.error(m.toString()),
- this.onError_()
- }
- }
- )()
- }
- }
- class e {
- constructor(v, S, u) {
- this.device_ = v,
- this.endpoint_ = S,
- this.onError_ = u
- }
- async write(v, S) {
- try {
- const u = await this.device_.transferOut(this.endpoint_.endpointNumber, v);
- u.status != "ok" && (S.error(u.status),
- this.onError_())
- } catch (u) {
- S.error(u.toString()),
- this.onError_()
- }
- }
- }
- class i {
- constructor(v, S) {
- this.polyfillOptions_ = Object.assign(Object.assign({}, l), S),
- this.outputSignals_ = {
- dataTerminalReady: !1,
- requestToSend: !1,
- break: !1
- },
- this.device_ = v,
- this.controlInterface_ = o(this.device_, this.polyfillOptions_.usbControlInterfaceClass),
- this.transferInterface_ = o(this.device_, this.polyfillOptions_.usbTransferInterfaceClass),
- this.inEndpoint_ = t(this.transferInterface_, "in"),
- this.outEndpoint_ = t(this.transferInterface_, "out")
- }
- get readable() {
- var v;
- return !this.readable_ && this.device_.opened && (this.readable_ = new ReadableStream(new s(this.device_, this.inEndpoint_, () => {
- this.readable_ = null
- }
- ), {
- highWaterMark: (v = this.serialOptions_.bufferSize) !== null && v !== void 0 ? v : q
- })),
- this.readable_
- }
- get writable() {
- var v;
- return !this.writable_ && this.device_.opened && (this.writable_ = new WritableStream(new e(this.device_, this.outEndpoint_, () => {
- this.writable_ = null
- }
- ), new ByteLengthQueuingStrategy({
- highWaterMark: (v = this.serialOptions_.bufferSize) !== null && v !== void 0 ? v : q
- }))),
- this.writable_
- }
- async open(v) {
- this.serialOptions_ = v,
- this.validateOptions();
- try {
- await this.device_.open(),
- this.device_.configuration === null && await this.device_.selectConfiguration(1),
- await this.device_.claimInterface(this.controlInterface_.interfaceNumber),
- this.controlInterface_ !== this.transferInterface_ && await this.device_.claimInterface(this.transferInterface_.interfaceNumber),
- await this.setLineCoding(),
- await this.setSignals({
- dataTerminalReady: !0
- })
- } catch (S) {
- throw this.device_.opened && await this.device_.close(),
- new Error("Error setting up device: " + S.toString())
- }
- }
- async close() {
- const v = [];
- this.readable_ && v.push(this.readable_.cancel()),
- this.writable_ && v.push(this.writable_.abort()),
- await Promise.all(v),
- this.readable_ = null,
- this.writable_ = null,
- this.device_.opened && (await this.setSignals({
- dataTerminalReady: !1,
- requestToSend: !1
- }),
- await this.device_.close())
- }
- async forget() {
- return this.device_.forget()
- }
- getInfo() {
- return {
- usbVendorId: this.device_.vendorId,
- usbProductId: this.device_.productId
- }
- }
- reconfigure(v) {
- return this.serialOptions_ = Object.assign(Object.assign({}, this.serialOptions_), v),
- this.validateOptions(),
- this.setLineCoding()
- }
- async setSignals(v) {
- if (this.outputSignals_ = Object.assign(Object.assign({}, this.outputSignals_), v),
- v.dataTerminalReady !== void 0 || v.requestToSend !== void 0) {
- const S = (this.outputSignals_.dataTerminalReady ? 1 : 0) | (this.outputSignals_.requestToSend ? 2 : 0);
- await this.device_.controlTransferOut({
- requestType: "class",
- recipient: "interface",
- request: G,
- value: S,
- index: this.controlInterface_.interfaceNumber
- })
- }
- if (v.break !== void 0) {
- const S = this.outputSignals_.break ? 65535 : 0;
- await this.device_.controlTransferOut({
- requestType: "class",
- recipient: "interface",
- request: U,
- value: S,
- index: this.controlInterface_.interfaceNumber
- })
- }
- }
- validateOptions() {
- if (!this.isValidBaudRate(this.serialOptions_.baudRate))
- throw new RangeError("invalid Baud Rate " + this.serialOptions_.baudRate);
- if (!this.isValidDataBits(this.serialOptions_.dataBits))
- throw new RangeError("invalid dataBits " + this.serialOptions_.dataBits);
- if (!this.isValidStopBits(this.serialOptions_.stopBits))
- throw new RangeError("invalid stopBits " + this.serialOptions_.stopBits);
- if (!this.isValidParity(this.serialOptions_.parity))
- throw new RangeError("invalid parity " + this.serialOptions_.parity)
- }
- isValidBaudRate(v) {
- return v % 1 === 0
- }
- isValidDataBits(v) {
- return typeof v > "u" ? !0 : n.includes(v)
- }
- isValidStopBits(v) {
- return typeof v > "u" ? !0 : _.includes(v)
- }
- isValidParity(v) {
- return typeof v > "u" ? !0 : h.includes(v)
- }
- async setLineCoding() {
- var v, S, u;
- const m = new ArrayBuffer(7)
- , w = new DataView(m);
- if (w.setUint32(0, this.serialOptions_.baudRate, !0),
- w.setUint8(4, d.indexOf((v = this.serialOptions_.stopBits) !== null && v !== void 0 ? v : a)),
- w.setUint8(5, f.indexOf((S = this.serialOptions_.parity) !== null && S !== void 0 ? S : r)),
- w.setUint8(6, (u = this.serialOptions_.dataBits) !== null && u !== void 0 ? u : x),
- (await this.device_.controlTransferOut({
- requestType: "class",
- recipient: "interface",
- request: V,
- value: 0,
- index: this.controlInterface_.interfaceNumber
- }, m)).status != "ok")
- throw new DOMException("NetworkError", "Failed to set line coding.")
- }
- }
- z.SerialPort = i;
- class c {
- async requestPort(v, S) {
- S = Object.assign(Object.assign({}, l), S);
- const u = [];
- if (v && v.filters)
- for (const R of v.filters) {
- const L = {
- classCode: S.usbControlInterfaceClass
- };
- R.usbVendorId !== void 0 && (L.vendorId = R.usbVendorId),
- R.usbProductId !== void 0 && (L.productId = R.usbProductId),
- u.push(L)
- }
- u.length === 0 && u.push({
- classCode: S.usbControlInterfaceClass
- });
- const m = await navigator.usb.requestDevice({
- filters: u
- });
- return new i(m, S)
- }
- async getPorts(v) {
- v = Object.assign(Object.assign({}, l), v);
- const S = await navigator.usb.getDevices()
- , u = [];
- return S.forEach(m => {
- try {
- const w = new i(m, v);
- u.push(w)
- } catch { }
- }
- ),
- u
- }
- }
- z.serial = new c
- }
- )(fe);
- let te, ee, ie, se, re, ae, ne, oe, we, Ee, ge, ke = 1, J, Q;
- const Re = new URLSearchParams(window.location.search)
- , le = Re.has("polyfill")
- , he = 8 * 1024
- , Y = new Ce.exports.Terminal({
- scrollback: 1e4
- })
- , de = new ye.exports.FitAddon;
- Y.loadAddon(de);
- const pe = new TextEncoder;
- let ce = "";
- Y.onData(z => {
- if (we.checked && Y.write(z),
- (J == null ? void 0 : J.writable) == null) {
- console.warn("unable to find writable port");
- return
- }
- const W = J.writable.getWriter();
- Ee.checked ? (ce += z,
- z === "\r" && (W.write(pe.encode(ce)),
- W.releaseLock(),
- ce = "")) : W.write(pe.encode(z)),
- W.releaseLock()
- }
- );
- function Le(z) {
- for (let W = 0; W < te.options.length; ++W) {
- const V = te.options[W];
- if (V.value === "prompt")
- continue;
- const G = V;
- if (G.port === z)
- return G
- }
- return null
- }
- function _e(z) {
- const W = document.createElement("option");
- return W.textContent = `Port ${ke++}`,
- W.port = z,
- te.appendChild(W),
- W
- }
- function De(z) {
- const W = Le(z);
- return W || _e(z)
- }
- function Ae() {
- if (!Y)
- throw new Error("no terminal instance found");
- if (Y.rows === 0) {
- console.log("No output yet");
- return
- }
- Y.selectAll();
- const z = Y.getSelection();
- Y.clearSelection();
- const W = URL.createObjectURL(new Blob([new TextEncoder().encode(z).buffer], {
- type: "text/plain"
- }))
- , V = document.createElement("a");
- V.download = `terminal_content_${new Date().getTime()}.txt`,
- V.href = W,
- V.click()
- }
- function xe() {
- if (!Y)
- throw new Error("no terminal instance found");
- if (Y.rows === 0) {
- console.log("No output yet");
- return
- }
- Y.clear()
- }
- async function Be() {
- if (te.value == "prompt") {
- try {
- J = await (le ? fe.serial : navigator.serial).requestPort({})
- } catch {
- return
- }
- const z = De(J);
- z.selected = !0
- } else
- J = te.selectedOptions[0].port
- }
- function Se() {
- return ie.value == "custom" ? Number.parseInt(se.value) : Number.parseInt(ie.value)
- }
- function ue() {
- Y.writeln("<DISCONNECTED>"),
- te.disabled = !1,
- ee.textContent = "Connect",
- ee.disabled = !1,
- ie.disabled = !1,
- se.disabled = !1,
- re.disabled = !1,
- ae.disabled = !1,
- ne.disabled = !1,
- oe.disabled = !1,
- J = void 0
- }
- async function me() {
- if (await Be(),
- !J)
- return;
- const z = {
- baudRate: Se(),
- dataBits: Number.parseInt(re.value),
- parity: ae.value,
- stopBits: Number.parseInt(ne.value),
- flowControl: oe.checked ? "hardware" : "none",
- bufferSize: he,
- baudrate: Se(),
- databits: Number.parseInt(re.value),
- stopbits: Number.parseInt(ne.value),
- rtscts: oe.checked
- };
- console.log(z),
- te.disabled = !0,
- ee.textContent = "Connecting...",
- ee.disabled = !0,
- ie.disabled = !0,
- se.disabled = !0,
- re.disabled = !0,
- ae.disabled = !0,
- ne.disabled = !0,
- oe.disabled = !0;
- try {
- await J.open(z),
- Y.writeln("<CONNECTED>"),
- ee.textContent = "Disconnect",
- ee.disabled = !1
- } catch (W) {
- console.error(W),
- W instanceof Error && Y.writeln(`<ERROR: ${W.message}>`),
- ue();
- return
- }
- for (; J && J.readable;)
- try {
- try {
- Q = J.readable.getReader({
- mode: "byob"
- })
- } catch {
- Q = J.readable.getReader()
- }
- let W = null;
- for (; ;) {
- const { value: V, done: G } = await (async () => {
- if (Q instanceof ReadableStreamBYOBReader) {
- W || (W = new ArrayBuffer(he));
- const { value: U, done: q } = await Q.read(new Uint8Array(W, 0, he));
- return W = U == null ? void 0 : U.buffer,
- {
- value: U,
- done: q
- }
- } else
- return await Q.read()
- }
- )();
- if (V && await new Promise(U => {
- Y.write(V, U)
- }
- ),
- G)
- break
- }
- } catch (W) {
- console.error(W),
- await new Promise(V => {
- W instanceof Error && Y.writeln(`<ERROR: ${W.message}>`, V)
- }
- )
- } finally {
- Q && (Q.releaseLock(),
- Q = void 0)
- }
- if (J) {
- try {
- await J.close()
- } catch (W) {
- console.error(W),
- W instanceof Error && Y.writeln(`<ERROR: ${W.message}>`)
- }
- ue()
- }
- }
- async function Te() {
- const z = J;
- if (J = void 0,
- Q && await Q.cancel(),
- z)
- try {
- await z.close()
- } catch (W) {
- console.error(W),
- W instanceof Error && Y.writeln(`<ERROR: ${W.message}>`)
- }
- ue()
- }
- document.addEventListener("DOMContentLoaded", async () => {
- const z = document.getElementById("terminal");
- z && (Y.open(z),
- de.fit(),
- window.addEventListener("resize", () => {
- de.fit()
- }
- )),
- document.getElementById("download").addEventListener("click", Ae),
- document.getElementById("clear").addEventListener("click", xe),
- te = document.getElementById("ports"),
- ee = document.getElementById("connect"),
- ee.addEventListener("click", () => {
- J ? Te() : me()
- }
- ),
- ie = document.getElementById("baudrate"),
- ie.addEventListener("input", () => {
- ie.value == "custom" ? se.hidden = !1 : se.hidden = !0
- }
- ),
- se = document.getElementById("custom_baudrate"),
- re = document.getElementById("databits"),
- ae = document.getElementById("parity"),
- ne = document.getElementById("stopbits"),
- oe = document.getElementById("rtscts"),
- we = document.getElementById("echo"),
- Ee = document.getElementById("enter_flush"),
- ge = document.getElementById("autoconnect");
- const G = document.getElementById("convert_eol")
- , U = () => {
- Y.options.convertEol = G.checked
- }
- ;
- G.addEventListener("change", U),
- U(),
- (await (le ? fe.serial : navigator.serial).getPorts()).forEach(r => _e(r)),
- le || (navigator.serial.addEventListener("connect", r => {
- const a = _e(r.target);
- ge.checked && (a.selected = !0,
- me())
- }
- ),
- navigator.serial.addEventListener("disconnect", r => {
- const a = Le(r.target);
- a && a.remove()
- }
- ))
- }
- );
|